diff --git a/.fern/metadata.json b/.fern/metadata.json index 27fc514..b6fb4f3 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -1,10 +1,14 @@ { - "cliVersion": "4.4.1", + "cliVersion": "4.46.0", "generatorName": "fernapi/fern-java-sdk", "generatorVersion": "4.0.4", "generatorConfig": { + "package-prefix": "com.deepgram", "client": { "class-name": "DeepgramClient" - } - } + }, + "enable-wire-tests": true + }, + "originGitCommit": "78fd4d4c60752a78daaa68b3d58da0554c9ce481", + "sdkVersion": "0.1.0" } \ No newline at end of file diff --git a/.fernignore b/.fernignore index abaf5f9..142a264 100644 --- a/.fernignore +++ b/.fernignore @@ -1,8 +1,14 @@ # Custom client wrappers (extend generated DeepgramApiClient with Bearer auth, session ID) +# Flat paths (local generation strips package-prefix) src/main/java/DeepgramClient.java src/main/java/AsyncDeepgramClient.java src/main/java/DeepgramClientBuilder.java src/main/java/AsyncDeepgramClientBuilder.java +# Full package paths (Maven/PR generation) +src/main/java/com/deepgram/DeepgramClient.java +src/main/java/com/deepgram/AsyncDeepgramClient.java +src/main/java/com/deepgram/DeepgramClientBuilder.java +src/main/java/com/deepgram/AsyncDeepgramClientBuilder.java # Custom project files .editorconfig diff --git a/.github/release-please-config.json b/.github/release-please-config.json index ddcc05f..9eff91c 100644 --- a/.github/release-please-config.json +++ b/.github/release-please-config.json @@ -24,6 +24,10 @@ "type": "json", "path": ".fern/metadata.json", "jsonpath": "$.sdkVersion" + }, + { + "type": "generic", + "path": "src/main/java/com/deepgram/core/ClientOptions.java" } ] } diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b6d5f06..f760034 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -91,5 +91,8 @@ jobs: restore-keys: | ${{ runner.os }}-gradle- - - name: Run Spotless check + - name: Lint custom files run: ./gradlew spotlessCheck + + - name: Build + run: ./gradlew build -x test diff --git a/.github/workflows/tests-daily.yml b/.github/workflows/tests-daily.yml index 150be98..fb4a604 100644 --- a/.github/workflows/tests-daily.yml +++ b/.github/workflows/tests-daily.yml @@ -93,7 +93,7 @@ jobs: ${{ runner.os }}-gradle- - name: Build project - run: ./gradlew build -x test -x spotlessCheck + run: ./gradlew build -x test - name: Run integration tests env: diff --git a/Makefile b/Makefile index fc59376..28102ca 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,16 @@ -.PHONY: lint format build test check test-all test-integration +.PHONY: lint format build test check test-all test-integration compile-examples -# Lint: check code formatting with Spotless +# Lint: check formatting of custom (non-generated) files lint: ./gradlew spotlessCheck -# Format: apply code formatting with Spotless +# Format: apply formatting to custom (non-generated) files format: ./gradlew spotlessApply -# Build: compile without tests or lint +# Build: compile without tests build: - ./gradlew build -x test -x spotlessCheck + ./gradlew build -x test # Unit tests: exclude integration tests test: @@ -26,3 +26,7 @@ test-all: check # Integration tests only (requires DEEPGRAM_API_KEY) test-integration: ./gradlew integrationTest + +# Compile all examples +compile-examples: + ./gradlew compileExamples diff --git a/README.md b/README.md index cae75f8..310dd2f 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ Add the dependency to your `pom.xml`: The SDK supports API Key authentication with automatic environment variable loading: ```java -import DeepgramClient; +import com.deepgram.DeepgramClient; // Using environment variable (DEEPGRAM_API_KEY) DeepgramClient client = DeepgramClient.builder().build(); @@ -88,25 +88,38 @@ DeepgramClient client = DeepgramClient.builder() Transcribe pre-recorded audio from files or URLs. ```java -import DeepgramClient; -import resources.listen.v1.media.requests.ListenV1RequestUrl; -import resources.listen.v1.media.types.MediaTranscribeResponse; +import com.deepgram.DeepgramClient; +import com.deepgram.resources.listen.v1.media.requests.ListenV1RequestUrl; +import com.deepgram.resources.listen.v1.media.types.MediaTranscribeResponse; +import com.deepgram.types.ListenV1AcceptedResponse; +import com.deepgram.types.ListenV1Response; DeepgramClient client = DeepgramClient.builder().build(); // Transcribe from URL MediaTranscribeResponse result = client.listen().v1().media().transcribeUrl( ListenV1RequestUrl.builder() - .url("https://static.deepgram.com/examples/Bueller-Life-moves-702702070.wav") + .url("https://static.deepgram.com/examples/Bueller-Life-moves-pretty-fast.wav") .build() ); -// Access transcription -String transcript = result.getResults() - .getChannels().get(0) - .getAlternatives().get(0) - .getTranscript(); -System.out.println(transcript); +// Access transcription (MediaTranscribeResponse is a union type) +result.visit(new MediaTranscribeResponse.Visitor() { + @Override + public Void visit(ListenV1Response response) { + response.getResults().getChannels().get(0) + .getAlternatives().ifPresent(alts -> { + alts.get(0).getTranscript().ifPresent(System.out::println); + }); + return null; + } + + @Override + public Void visit(ListenV1AcceptedResponse accepted) { + System.out.println("Request accepted (callback mode)"); + return null; + } +}); ``` #### Transcribe from File @@ -116,8 +129,6 @@ import java.nio.file.Files; import java.nio.file.Path; byte[] audioData = Files.readAllBytes(Path.of("audio.wav")); - -// File upload body is byte[] MediaTranscribeResponse result = client.listen().v1().media().transcribeFile(audioData); ``` @@ -126,8 +137,8 @@ MediaTranscribeResponse result = client.listen().v1().media().transcribeFile(aud Convert text to natural-sounding speech. ```java -import DeepgramClient; -import resources.speak.v1.audio.requests.SpeakV1Request; +import com.deepgram.DeepgramClient; +import com.deepgram.resources.speak.v1.audio.requests.SpeakV1Request; import java.io.InputStream; DeepgramClient client = DeepgramClient.builder().build(); @@ -147,15 +158,22 @@ InputStream audioStream = client.speak().v1().audio().generate( Analyze text for sentiment, topics, summaries, and intents. ```java -import DeepgramClient; -import types.ReadV1Request; -import types.ReadV1Response; +import com.deepgram.DeepgramClient; +import com.deepgram.resources.read.v1.text.requests.TextAnalyzeRequest; +import com.deepgram.types.ReadV1Request; +import com.deepgram.types.ReadV1RequestText; +import com.deepgram.types.ReadV1Response; DeepgramClient client = DeepgramClient.builder().build(); ReadV1Response result = client.read().v1().text().analyze( - ReadV1Request.builder() - .text("Deepgram's speech recognition is incredibly accurate and fast.") + TextAnalyzeRequest.builder() + .body(ReadV1Request.of( + ReadV1RequestText.builder() + .text("Deepgram's speech recognition is incredibly accurate and fast.") + .build())) + .sentiment(true) + .language("en") .build() ); ``` @@ -165,7 +183,7 @@ ReadV1Response result = client.read().v1().text().analyze( Manage projects, API keys, members, usage, and billing. ```java -import DeepgramClient; +import com.deepgram.DeepgramClient; DeepgramClient client = DeepgramClient.builder().build(); @@ -184,7 +202,7 @@ var usage = client.manage().v1().projects().usage().get("project-id"); Manage voice agent configurations and models. ```java -import DeepgramClient; +import com.deepgram.DeepgramClient; DeepgramClient client = DeepgramClient.builder().build(); @@ -201,10 +219,10 @@ The SDK includes built-in WebSocket clients for real-time streaming. Stream audio for real-time speech-to-text. ```java -import DeepgramClient; -import resources.listen.v1.websocket.V1WebSocketClient; -import resources.listen.v1.websocket.V1ConnectOptions; -import types.ListenV1Model; +import com.deepgram.DeepgramClient; +import com.deepgram.resources.listen.v1.websocket.V1WebSocketClient; +import com.deepgram.resources.listen.v1.websocket.V1ConnectOptions; +import com.deepgram.types.ListenV1Model; DeepgramClient client = DeepgramClient.builder().build(); @@ -242,8 +260,8 @@ ws.close(); Stream text for real-time audio generation. ```java -import DeepgramClient; -import resources.speak.v1.websocket.V1WebSocketClient; +import com.deepgram.DeepgramClient; +import com.deepgram.resources.speak.v1.websocket.V1WebSocketClient; DeepgramClient client = DeepgramClient.builder().build(); @@ -275,8 +293,8 @@ ttsWs.close(); Connect to Deepgram's voice agent for real-time conversational AI. ```java -import DeepgramClient; -import resources.agent.v1.websocket.V1WebSocketClient; +import com.deepgram.DeepgramClient; +import com.deepgram.resources.agent.v1.websocket.V1WebSocketClient; DeepgramClient client = DeepgramClient.builder().build(); @@ -321,6 +339,8 @@ DeepgramClient client = DeepgramClient.builder() ### Custom HTTP Client +> **Note:** When providing a custom `OkHttpClient`, the SDK's built-in retry interceptor is not added automatically. Add your own retry logic if needed. + ```java import okhttp3.OkHttpClient; import java.util.concurrent.TimeUnit; @@ -341,7 +361,7 @@ DeepgramClient client = DeepgramClient.builder() For on-premises deployments or custom endpoints: ```java -import core.Environment; +import com.deepgram.core.Environment; DeepgramClient client = DeepgramClient.builder() .apiKey("YOUR_DEEPGRAM_API_KEY") @@ -378,9 +398,9 @@ DeepgramClient client = DeepgramClient.builder() The SDK provides a fully asynchronous client for non-blocking operations: ```java -import AsyncDeepgramClient; -import resources.listen.v1.media.requests.ListenV1RequestUrl; -import resources.listen.v1.media.types.MediaTranscribeResponse; +import com.deepgram.AsyncDeepgramClient; +import com.deepgram.resources.listen.v1.media.requests.ListenV1RequestUrl; +import com.deepgram.resources.listen.v1.media.types.MediaTranscribeResponse; import java.util.concurrent.CompletableFuture; AsyncDeepgramClient asyncClient = AsyncDeepgramClient.builder().build(); @@ -388,7 +408,7 @@ AsyncDeepgramClient asyncClient = AsyncDeepgramClient.builder().build(); // Async transcription CompletableFuture future = asyncClient.listen().v1().media() .transcribeUrl(ListenV1RequestUrl.builder() - .url("https://static.deepgram.com/examples/Bueller-Life-moves-702702070.wav") + .url("https://static.deepgram.com/examples/Bueller-Life-moves-pretty-fast.wav") .build()); future.thenAccept(result -> { @@ -401,7 +421,7 @@ future.thenAccept(result -> { The SDK provides structured error handling: ```java -import errors.BadRequestError; +import com.deepgram.errors.BadRequestError; try { var result = client.listen().v1().media().transcribeUrl( @@ -418,19 +438,19 @@ try { ### Raw Response Access -All client methods support raw response access for advanced use cases: +All client methods support raw response access via the raw client: ```java -import core.RawResponse; +import com.deepgram.core.DeepgramApiHttpResponse; +import com.deepgram.resources.listen.v1.media.types.MediaTranscribeResponse; // Access raw HTTP response -var rawResponse = client.listen().v1().media() - .withRawResponse() - .transcribeUrl(request); +DeepgramApiHttpResponse rawResponse = + client.listen().v1().media().withRawResponse().transcribeUrl(request); int statusCode = rawResponse.statusCode(); var headers = rawResponse.headers(); -var body = rawResponse.body(); +MediaTranscribeResponse body = rawResponse.body(); ``` ## Complete SDK Reference diff --git a/build.gradle b/build.gradle index 29b08d3..30cc121 100644 --- a/build.gradle +++ b/build.gradle @@ -1,8 +1,17 @@ plugins { id 'java-library' + id 'maven-publish' id 'com.diffplug.spotless' version '6.25.0' } +publishing { + publications { + mavenJava(MavenPublication) { + from components.java + } + } +} + group = 'com.deepgram' version = '0.1.0' @@ -20,11 +29,11 @@ dependencies { api 'com.squareup.okhttp3:okhttp:4.12.0' // JSON serialization - api 'com.fasterxml.jackson.core:jackson-databind:2.18.2' - api 'com.fasterxml.jackson.core:jackson-core:2.18.2' - api 'com.fasterxml.jackson.core:jackson-annotations:2.18.2' - api 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.18.2' - api 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.18.2' + api 'com.fasterxml.jackson.core:jackson-databind:2.18.6' + api 'com.fasterxml.jackson.core:jackson-core:2.18.6' + api 'com.fasterxml.jackson.core:jackson-annotations:2.18.6' + api 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.18.6' + api 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.18.6' // Annotations compileOnly 'org.jetbrains:annotations:24.1.0' @@ -64,10 +73,54 @@ tasks.register('integrationTest', Test) { } } +// Examples source set +sourceSets { + examples { + java { + srcDir 'examples' + // Exclude examples with known issues (see ISSUES section below) + exclude 'agent/**' // Blocked: missing AgentV1UpdateThink type + exclude 'manage/ListModels.java' // Duplicate class name with agent/ListModels + exclude 'manage/MemberPermissions.java' // getScopes() not in generated API + exclude 'manage/UsageBreakdown.java' // getModels() return type mismatch + } + compileClasspath += sourceSets.main.output + configurations.runtimeClasspath + runtimeClasspath += sourceSets.main.output + configurations.runtimeClasspath + } +} + +// Compile all examples +tasks.register('compileExamples') { + dependsOn 'examplesClasses' + description = 'Compile all example files' + group = 'examples' +} + +// Run a specific example: ./gradlew runExample -PmainClass=TranscribeUrl +tasks.register('runExample', JavaExec) { + description = 'Run an example. Usage: ./gradlew runExample -PmainClass=TranscribeUrl' + group = 'examples' + classpath = sourceSets.examples.runtimeClasspath + mainClass = project.hasProperty('mainClass') ? project.property('mainClass') : '' +} + spotless { java { - target 'src/**/*.java' - googleJavaFormat('1.19.2') + // Only lint custom (non-generated) files — Fern output uses JavaPoet formatting + // which no standard formatter reproduces exactly + target( + 'src/main/java/com/deepgram/DeepgramClient.java', + 'src/main/java/com/deepgram/AsyncDeepgramClient.java', + 'src/main/java/com/deepgram/DeepgramClientBuilder.java', + 'src/main/java/com/deepgram/AsyncDeepgramClientBuilder.java', + 'src/test/java/com/deepgram/ClientBuilderTest.java', + 'src/test/java/com/deepgram/IntegrationTest.java', + 'src/test/java/com/deepgram/core/EnvironmentTest.java', + 'src/test/java/com/deepgram/core/RetryInterceptorTest.java', + 'examples/**/*.java', + ) + palantirJavaFormat('2.46.0').formatJavadoc(true) removeUnusedImports() } } + diff --git a/examples/advanced/BinaryResponse.java b/examples/advanced/BinaryResponse.java index 7faf204..11aae93 100644 --- a/examples/advanced/BinaryResponse.java +++ b/examples/advanced/BinaryResponse.java @@ -1,12 +1,13 @@ +import com.deepgram.DeepgramClient; +import com.deepgram.core.DeepgramApiHttpResponse; +import com.deepgram.resources.listen.v1.media.requests.ListenV1RequestUrl; +import com.deepgram.resources.listen.v1.media.types.MediaTranscribeResponse; import java.util.List; import java.util.Map; -import core.DeepgramApiHttpResponse; -import resources.listen.v1.media.requests.ListenV1RequestUrl; -import resources.listen.v1.media.types.MediaTranscribeResponse; /** - * Demonstrates accessing raw HTTP response headers alongside the parsed body. - * Uses the withRawResponse() method to get both headers and body from the API. + * Demonstrates accessing raw HTTP response headers alongside the parsed body. Uses the withRawResponse() method to get + * both headers and body from the API. * *

Usage: java BinaryResponse */ @@ -23,9 +24,7 @@ public static void main(String[] args) { System.out.println(); // Create client - DeepgramClient client = DeepgramClient.builder() - .apiKey(apiKey) - .build(); + DeepgramClient client = DeepgramClient.builder().apiKey(apiKey).build(); try { // Build request diff --git a/examples/advanced/CustomEndpoint.java b/examples/advanced/CustomEndpoint.java index 17ff82f..125ddb1 100644 --- a/examples/advanced/CustomEndpoint.java +++ b/examples/advanced/CustomEndpoint.java @@ -1,12 +1,13 @@ +import com.deepgram.DeepgramClient; +import com.deepgram.core.Environment; +import com.deepgram.types.ListProjectsV1Response; +import com.deepgram.types.ListProjectsV1ResponseProjectsItem; import java.util.Collections; import java.util.List; -import core.Environment; -import types.ListProjectsV1Response; -import types.ListProjectsV1ResponseProjectsItem; /** - * Demonstrates configuring a regional or EU endpoint for data residency. - * Uses Environment.custom() to point all API traffic to a specific region. + * Demonstrates configuring a regional or EU endpoint for data residency. Uses Environment.custom() to point all API + * traffic to a specific region. * *

Usage: java CustomEndpoint */ @@ -39,10 +40,8 @@ public static void main(String[] args) { .build(); // Create client with the regional environment - DeepgramClient client = DeepgramClient.builder() - .apiKey(apiKey) - .environment(regionalEnv) - .build(); + DeepgramClient client = + DeepgramClient.builder().apiKey(apiKey).environment(regionalEnv).build(); try { // Verify the connection diff --git a/examples/advanced/ErrorHandling.java b/examples/advanced/ErrorHandling.java index 8dce838..107c226 100644 --- a/examples/advanced/ErrorHandling.java +++ b/examples/advanced/ErrorHandling.java @@ -1,12 +1,12 @@ -import core.DeepgramApiApiException; -import errors.BadRequestError; -import resources.listen.v1.media.requests.ListenV1RequestUrl; -import resources.listen.v1.media.types.MediaTranscribeResponse; +import com.deepgram.DeepgramClient; +import com.deepgram.core.DeepgramApiApiException; +import com.deepgram.errors.BadRequestError; +import com.deepgram.resources.listen.v1.media.requests.ListenV1RequestUrl; +import com.deepgram.resources.listen.v1.media.types.MediaTranscribeResponse; /** - * Demonstrates error handling patterns with the Deepgram Java SDK. - * Shows how to catch and handle different error types including - * API errors, bad requests, and network issues. + * Demonstrates error handling patterns with the Deepgram Java SDK. Shows how to catch and handle different error types + * including API errors, bad requests, and network issues. * *

Usage: java ErrorHandling */ @@ -20,9 +20,7 @@ public static void main(String[] args) { } // Create client - DeepgramClient client = DeepgramClient.builder() - .apiKey(apiKey) - .build(); + DeepgramClient client = DeepgramClient.builder().apiKey(apiKey).build(); System.out.println("Error Handling Examples"); System.out.println(); @@ -31,9 +29,8 @@ public static void main(String[] args) { System.out.println("1. Bad Request Error (invalid audio URL):"); System.out.println("-".repeat(50)); try { - ListenV1RequestUrl request = ListenV1RequestUrl.builder() - .url("not-a-valid-url") - .build(); + ListenV1RequestUrl request = + ListenV1RequestUrl.builder().url("not-a-valid-url").build(); MediaTranscribeResponse result = client.listen().v1().media().transcribeUrl(request); System.out.println("Unexpected success: " + result); @@ -58,9 +55,8 @@ public static void main(String[] args) { System.out.println("2. Authentication Error (invalid API key):"); System.out.println("-".repeat(50)); try { - DeepgramClient badClient = DeepgramClient.builder() - .apiKey("invalid-api-key") - .build(); + DeepgramClient badClient = + DeepgramClient.builder().apiKey("invalid-api-key").build(); badClient.manage().v1().projects().list(); System.out.println("Unexpected success"); diff --git a/examples/advanced/RequestOptions.java b/examples/advanced/RequestOptions.java index e6f8006..04066c3 100644 --- a/examples/advanced/RequestOptions.java +++ b/examples/advanced/RequestOptions.java @@ -1,16 +1,17 @@ +import com.deepgram.DeepgramClient; +import com.deepgram.resources.listen.v1.media.requests.ListenV1RequestUrl; +import com.deepgram.resources.listen.v1.media.types.MediaTranscribeResponse; +import com.deepgram.types.ListenV1Response; +import com.deepgram.types.ListenV1ResponseResults; +import com.deepgram.types.ListenV1ResponseResultsChannelsItem; +import com.deepgram.types.ListenV1ResponseResultsChannelsItemAlternativesItem; import java.util.Collections; import java.util.List; import java.util.concurrent.TimeUnit; -import resources.listen.v1.media.requests.ListenV1RequestUrl; -import resources.listen.v1.media.types.MediaTranscribeResponse; -import types.ListenV1Response; -import types.ListenV1ResponseResults; -import types.ListenV1ResponseResultsChannelsItem; -import types.ListenV1ResponseResultsChannelsItemAlternativesItem; /** - * Demonstrates using custom request options to override settings per-request, - * such as timeouts, custom headers, and query parameters. + * Demonstrates using custom request options to override settings per-request, such as timeouts, custom headers, and + * query parameters. * *

Usage: java RequestOptions */ @@ -24,17 +25,15 @@ public static void main(String[] args) { } // Create client - DeepgramClient client = DeepgramClient.builder() - .apiKey(apiKey) - .build(); + DeepgramClient client = DeepgramClient.builder().apiKey(apiKey).build(); System.out.println("Custom Request Options"); System.out.println(); try { // Build custom request options - core.RequestOptions requestOptions = core.RequestOptions.builder() - .timeout(60, TimeUnit.SECONDS) // 60-second timeout + com.deepgram.core.RequestOptions requestOptions = com.deepgram.core.RequestOptions.builder() + .timeout(60, TimeUnit.SECONDS) // 60-second timeout .addHeader("X-Custom-Header", "example-value") // Custom header .build(); @@ -50,8 +49,7 @@ public static void main(String[] args) { .build(); // Make the request with custom options - MediaTranscribeResponse result = - client.listen().v1().media().transcribeUrl(request, requestOptions); + MediaTranscribeResponse result = client.listen().v1().media().transcribeUrl(request, requestOptions); // Display results result.visit(new MediaTranscribeResponse.Visitor() { @@ -59,7 +57,8 @@ public static void main(String[] args) { public Void visit(ListenV1Response response) { ListenV1ResponseResults results = response.getResults(); if (results != null && !results.getChannels().isEmpty()) { - ListenV1ResponseResultsChannelsItem channel = results.getChannels().get(0); + ListenV1ResponseResultsChannelsItem channel = + results.getChannels().get(0); List alternatives = channel.getAlternatives().orElse(Collections.emptyList()); if (!alternatives.isEmpty()) { @@ -75,7 +74,7 @@ public Void visit(ListenV1Response response) { } @Override - public Void visit(types.ListenV1AcceptedResponse accepted) { + public Void visit(com.deepgram.types.ListenV1AcceptedResponse accepted) { System.out.println("Request accepted: " + accepted.getRequestId()); return null; } @@ -87,7 +86,7 @@ public Void visit(types.ListenV1AcceptedResponse accepted) { // Example: Per-request API key override System.out.println(); System.out.println("Note: You can also override the API key per-request:"); - System.out.println(" core.RequestOptions.builder()"); + System.out.println(" com.deepgram.core.RequestOptions.builder()"); System.out.println(" .apiKey(\"different-api-key\")"); System.out.println(" .build();"); diff --git a/examples/advanced/ScopedConfig.java b/examples/advanced/ScopedConfig.java index a3ef1ba..80a6576 100644 --- a/examples/advanced/ScopedConfig.java +++ b/examples/advanced/ScopedConfig.java @@ -1,17 +1,18 @@ +import com.deepgram.DeepgramClient; +import com.deepgram.resources.listen.v1.media.requests.ListenV1RequestUrl; +import com.deepgram.resources.listen.v1.media.types.MediaTranscribeResponse; +import com.deepgram.types.ListenV1AcceptedResponse; +import com.deepgram.types.ListenV1Response; +import com.deepgram.types.ListenV1ResponseResults; +import com.deepgram.types.ListenV1ResponseResultsChannelsItem; +import com.deepgram.types.ListenV1ResponseResultsChannelsItemAlternativesItem; import java.util.Collections; import java.util.List; import java.util.concurrent.TimeUnit; -import resources.listen.v1.media.requests.ListenV1RequestUrl; -import resources.listen.v1.media.types.MediaTranscribeResponse; -import types.ListenV1AcceptedResponse; -import types.ListenV1Response; -import types.ListenV1ResponseResults; -import types.ListenV1ResponseResultsChannelsItem; -import types.ListenV1ResponseResultsChannelsItemAlternativesItem; /** - * Demonstrates per-request configuration overrides using RequestOptions. - * Different requests can have different timeouts, headers, and even API keys. + * Demonstrates per-request configuration overrides using RequestOptions. Different requests can have different + * timeouts, headers, and even API keys. * *

Usage: java ScopedConfig */ @@ -28,9 +29,7 @@ public static void main(String[] args) { } // Create client with default settings - DeepgramClient client = DeepgramClient.builder() - .apiKey(apiKey) - .build(); + DeepgramClient client = DeepgramClient.builder().apiKey(apiKey).build(); System.out.println("Scoped Configuration (Per-Request Overrides)"); System.out.println(); @@ -43,35 +42,32 @@ public static void main(String[] args) { .smartFormat(true) .build(); - MediaTranscribeResponse result1 = - client.listen().v1().media().transcribeUrl(request); + MediaTranscribeResponse result1 = client.listen().v1().media().transcribeUrl(request); printTranscript("Default", result1); System.out.println(); // Request 2: Extended timeout for long audio System.out.println("=== Request 2: Extended timeout (120s) ==="); - core.RequestOptions longTimeoutOptions = core.RequestOptions.builder() + com.deepgram.core.RequestOptions longTimeoutOptions = com.deepgram.core.RequestOptions.builder() .timeout(120, TimeUnit.SECONDS) .addHeader("X-Request-Context", "long-audio-processing") .build(); - MediaTranscribeResponse result2 = - client.listen().v1().media().transcribeUrl(request, longTimeoutOptions); + MediaTranscribeResponse result2 = client.listen().v1().media().transcribeUrl(request, longTimeoutOptions); printTranscript("Extended timeout", result2); System.out.println(); // Request 3: Custom tag header for tracking System.out.println("=== Request 3: Tagged request ==="); - core.RequestOptions taggedOptions = core.RequestOptions.builder() + com.deepgram.core.RequestOptions taggedOptions = com.deepgram.core.RequestOptions.builder() .timeout(30, TimeUnit.SECONDS) .addHeader("X-Batch-Id", "batch-2024-001") .addHeader("X-Priority", "high") .build(); - MediaTranscribeResponse result3 = - client.listen().v1().media().transcribeUrl(request, taggedOptions); + MediaTranscribeResponse result3 = client.listen().v1().media().transcribeUrl(request, taggedOptions); printTranscript("Tagged", result3); System.out.println(); @@ -90,15 +86,15 @@ private static void printTranscript(String label, MediaTranscribeResponse respon public Void visit(ListenV1Response resp) { ListenV1ResponseResults results = resp.getResults(); if (results != null && !results.getChannels().isEmpty()) { - ListenV1ResponseResultsChannelsItem channel = results.getChannels().get(0); + ListenV1ResponseResultsChannelsItem channel = + results.getChannels().get(0); List alternatives = channel.getAlternatives().orElse(Collections.emptyList()); if (!alternatives.isEmpty()) { alternatives.get(0).getTranscript().ifPresent(transcript -> { - System.out.printf("[%s] Transcript: %s%n", label, - transcript.length() > 80 - ? transcript.substring(0, 80) + "..." - : transcript); + System.out.printf( + "[%s] Transcript: %s%n", + label, transcript.length() > 80 ? transcript.substring(0, 80) + "..." : transcript); }); } } diff --git a/examples/advanced/SessionHeader.java b/examples/advanced/SessionHeader.java index 179b527..a714cc8 100644 --- a/examples/advanced/SessionHeader.java +++ b/examples/advanced/SessionHeader.java @@ -1,17 +1,18 @@ +import com.deepgram.DeepgramClient; +import com.deepgram.resources.listen.v1.media.requests.ListenV1RequestUrl; +import com.deepgram.resources.listen.v1.media.types.MediaTranscribeResponse; +import com.deepgram.types.ListenV1AcceptedResponse; +import com.deepgram.types.ListenV1Response; +import com.deepgram.types.ListenV1ResponseResults; +import com.deepgram.types.ListenV1ResponseResultsChannelsItem; +import com.deepgram.types.ListenV1ResponseResultsChannelsItemAlternativesItem; import java.util.Collections; import java.util.List; import java.util.UUID; -import resources.listen.v1.media.requests.ListenV1RequestUrl; -import resources.listen.v1.media.types.MediaTranscribeResponse; -import types.ListenV1AcceptedResponse; -import types.ListenV1Response; -import types.ListenV1ResponseResults; -import types.ListenV1ResponseResultsChannelsItem; -import types.ListenV1ResponseResultsChannelsItemAlternativesItem; /** - * Demonstrates setting custom session and tracking headers via the client builder. - * These headers are sent with every request for correlation and debugging. + * Demonstrates setting custom session and tracking headers via the client builder. These headers are sent with every + * request for correlation and debugging. * *

Usage: java SessionHeader */ @@ -49,8 +50,7 @@ public static void main(String[] args) { .build(); System.out.println("Making request with custom headers..."); - MediaTranscribeResponse result = - client.listen().v1().media().transcribeUrl(request); + MediaTranscribeResponse result = client.listen().v1().media().transcribeUrl(request); // Display results result.visit(new MediaTranscribeResponse.Visitor() { @@ -58,7 +58,8 @@ public static void main(String[] args) { public Void visit(ListenV1Response response) { ListenV1ResponseResults results = response.getResults(); if (results != null && !results.getChannels().isEmpty()) { - ListenV1ResponseResultsChannelsItem channel = results.getChannels().get(0); + ListenV1ResponseResultsChannelsItem channel = + results.getChannels().get(0); List alternatives = channel.getAlternatives().orElse(Collections.emptyList()); if (!alternatives.isEmpty()) { diff --git a/examples/agent/CustomProviders.java b/examples/agent/CustomProviders.java index 72a8816..a15a767 100644 --- a/examples/agent/CustomProviders.java +++ b/examples/agent/CustomProviders.java @@ -1,25 +1,26 @@ +import com.deepgram.DeepgramClient; +import com.deepgram.resources.agent.v1.types.AgentV1Settings; +import com.deepgram.resources.agent.v1.types.AgentV1SettingsAgent; +import com.deepgram.resources.agent.v1.types.AgentV1SettingsAgentContext; +import com.deepgram.resources.agent.v1.types.AgentV1SettingsAgentContextSpeak; +import com.deepgram.resources.agent.v1.types.AgentV1SettingsAgentContextThink; +import com.deepgram.resources.agent.v1.types.AgentV1SettingsAudio; +import com.deepgram.resources.agent.v1.websocket.V1WebSocketClient; +import com.deepgram.types.Anthropic; +import com.deepgram.types.AnthropicThinkProviderModel; +import com.deepgram.types.Deepgram; +import com.deepgram.types.DeepgramSpeakProviderModel; +import com.deepgram.types.SpeakSettingsV1; +import com.deepgram.types.SpeakSettingsV1Provider; +import com.deepgram.types.ThinkSettingsV1; +import com.deepgram.types.ThinkSettingsV1Provider; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import resources.agent.v1.types.AgentV1Settings; -import resources.agent.v1.types.AgentV1SettingsAgent; -import resources.agent.v1.types.AgentV1SettingsAgentContext; -import resources.agent.v1.types.AgentV1SettingsAgentContextSpeak; -import resources.agent.v1.types.AgentV1SettingsAgentContextThink; -import resources.agent.v1.types.AgentV1SettingsAudio; -import resources.agent.v1.websocket.V1WebSocketClient; -import types.Anthropic; -import types.AnthropicThinkProviderModel; -import types.Deepgram; -import types.DeepgramSpeakProviderModel; -import types.SpeakSettingsV1; -import types.SpeakSettingsV1Provider; -import types.ThinkSettingsV1; -import types.ThinkSettingsV1Provider; /** - * Demonstrates configuring an agent with different LLM (think) and TTS (speak) providers. - * Uses Anthropic for thinking and Deepgram for speech synthesis. + * Demonstrates configuring an agent with different LLM (think) and TTS (speak) providers. Uses Anthropic for thinking + * and Deepgram for speech synthesis. * *

Usage: java CustomProviders */ @@ -38,9 +39,7 @@ public static void main(String[] args) { System.out.println(); // Create client - DeepgramClient client = DeepgramClient.builder() - .apiKey(apiKey) - .build(); + DeepgramClient client = DeepgramClient.builder().apiKey(apiKey).build(); // Get the Agent WebSocket client V1WebSocketClient wsClient = client.agent().v1().v1WebSocket(); @@ -102,13 +101,14 @@ public static void main(String[] args) { // Disconnect after demonstrating configuration new Thread(() -> { - try { - Thread.sleep(3000); - wsClient.disconnect(); - } catch (Exception e) { - // ignore - } - }).start(); + try { + Thread.sleep(3000); + wsClient.disconnect(); + } catch (Exception e) { + // ignore + } + }) + .start(); }); wsClient.onConversationText(text -> { @@ -140,8 +140,8 @@ public static void main(String[] args) { }); wsClient.onDisconnected(reason -> { - System.out.println("\nConnection closed (code: " + reason.getCode() - + ", reason: " + reason.getReason() + ")"); + System.out.println( + "\nConnection closed (code: " + reason.getCode() + ", reason: " + reason.getReason() + ")"); closeLatch.countDown(); }); diff --git a/examples/agent/InjectMessage.java b/examples/agent/InjectMessage.java index b62e620..a1cfea2 100644 --- a/examples/agent/InjectMessage.java +++ b/examples/agent/InjectMessage.java @@ -1,23 +1,23 @@ +import com.deepgram.DeepgramClient; +import com.deepgram.resources.agent.v1.types.AgentV1InjectAgentMessage; +import com.deepgram.resources.agent.v1.types.AgentV1InjectUserMessage; +import com.deepgram.resources.agent.v1.types.AgentV1Settings; +import com.deepgram.resources.agent.v1.types.AgentV1SettingsAgent; +import com.deepgram.resources.agent.v1.types.AgentV1SettingsAgentContext; +import com.deepgram.resources.agent.v1.types.AgentV1SettingsAgentContextThink; +import com.deepgram.resources.agent.v1.types.AgentV1SettingsAudio; +import com.deepgram.resources.agent.v1.websocket.V1WebSocketClient; +import com.deepgram.types.OpenAiThinkProvider; +import com.deepgram.types.OpenAiThinkProviderModel; +import com.deepgram.types.ThinkSettingsV1; +import com.deepgram.types.ThinkSettingsV1Provider; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import resources.agent.v1.types.AgentV1InjectAgentMessage; -import resources.agent.v1.types.AgentV1InjectUserMessage; -import resources.agent.v1.types.AgentV1Settings; -import resources.agent.v1.types.AgentV1SettingsAgent; -import resources.agent.v1.types.AgentV1SettingsAgentContext; -import resources.agent.v1.types.AgentV1SettingsAgentContextThink; -import resources.agent.v1.types.AgentV1SettingsAudio; -import resources.agent.v1.websocket.V1WebSocketClient; -import types.OpenAiThinkProvider; -import types.OpenAiThinkProviderModel; -import types.ThinkSettingsV1; -import types.ThinkSettingsV1Provider; /** - * Demonstrates injecting messages into an agent conversation. - * You can inject both user messages (as if the user said something) - * and agent messages (as if the agent said something). + * Demonstrates injecting messages into an agent conversation. You can inject both user messages (as if the user said + * something) and agent messages (as if the agent said something). * *

Usage: java InjectMessage */ @@ -34,9 +34,7 @@ public static void main(String[] args) { System.out.println(); // Create client - DeepgramClient client = DeepgramClient.builder() - .apiKey(apiKey) - .build(); + DeepgramClient client = DeepgramClient.builder().apiKey(apiKey).build(); // Get the Agent WebSocket client V1WebSocketClient wsClient = client.agent().v1().v1WebSocket(); @@ -121,8 +119,8 @@ public static void main(String[] args) { }); wsClient.onDisconnected(reason -> { - System.out.println("\nConnection closed (code: " + reason.getCode() - + ", reason: " + reason.getReason() + ")"); + System.out.println( + "\nConnection closed (code: " + reason.getCode() + ", reason: " + reason.getReason() + ")"); closeLatch.countDown(); }); @@ -141,9 +139,7 @@ public static void main(String[] args) { } } - /** - * Inject user and agent messages into the conversation. - */ + /** Inject user and agent messages into the conversation. */ private static void injectMessages(V1WebSocketClient wsClient, CountDownLatch closeLatch) { try { // Wait for greeting to be processed @@ -152,10 +148,9 @@ private static void injectMessages(V1WebSocketClient wsClient, CountDownLatch cl // Inject a user message (as if the user spoke) System.out.println(); System.out.println("--- Injecting user message ---"); - wsClient.sendInjectUserMessage( - AgentV1InjectUserMessage.builder() - .content("What is the capital of France?") - .build()); + wsClient.sendInjectUserMessage(AgentV1InjectUserMessage.builder() + .content("What is the capital of France?") + .build()); // Wait for the agent to respond Thread.sleep(8000); @@ -163,10 +158,9 @@ private static void injectMessages(V1WebSocketClient wsClient, CountDownLatch cl // Inject an agent message (force the agent to say something) System.out.println(); System.out.println("--- Injecting agent message ---"); - wsClient.sendInjectAgentMessage( - AgentV1InjectAgentMessage.builder() - .message("By the way, I can also help you with math and science questions!") - .build()); + wsClient.sendInjectAgentMessage(AgentV1InjectAgentMessage.builder() + .message("By the way, I can also help you with math and science questions!") + .build()); // Wait for the response to be processed Thread.sleep(5000); diff --git a/examples/agent/ListModels.java b/examples/agent/ListModels.java index 7ed6de3..a18320f 100644 --- a/examples/agent/ListModels.java +++ b/examples/agent/ListModels.java @@ -1,8 +1,9 @@ +import com.deepgram.DeepgramClient; +import com.deepgram.types.ListModelsV1Response; +import com.deepgram.types.ListModelsV1ResponseSttModels; +import com.deepgram.types.ListModelsV1ResponseTtsModels; import java.util.Collections; import java.util.List; -import types.ListModelsV1Response; -import types.ListModelsV1ResponseSttModels; -import types.ListModelsV1ResponseTtsModels; /** * List all available Deepgram models (speech-to-text and text-to-speech). @@ -19,9 +20,7 @@ public static void main(String[] args) { } // Create client - DeepgramClient client = DeepgramClient.builder() - .apiKey(apiKey) - .build(); + DeepgramClient client = DeepgramClient.builder().apiKey(apiKey).build(); System.out.println("Listing available Deepgram models..."); System.out.println(); @@ -30,8 +29,7 @@ public static void main(String[] args) { ListModelsV1Response response = client.manage().v1().models().list(); // Display STT models - List sttModels = - response.getStt().orElse(Collections.emptyList()); + List sttModels = response.getStt().orElse(Collections.emptyList()); System.out.println("Speech-to-Text Models (" + sttModels.size() + "):"); System.out.println("-".repeat(60)); for (ListModelsV1ResponseSttModels model : sttModels) { @@ -44,8 +42,7 @@ public static void main(String[] args) { System.out.println(); // Display TTS models - List ttsModels = - response.getTts().orElse(Collections.emptyList()); + List ttsModels = response.getTts().orElse(Collections.emptyList()); System.out.println("Text-to-Speech Models (" + ttsModels.size() + "):"); System.out.println("-".repeat(60)); for (ListModelsV1ResponseTtsModels model : ttsModels) { diff --git a/examples/agent/ProviderCombinations.java b/examples/agent/ProviderCombinations.java index 59fbd70..9f8e323 100644 --- a/examples/agent/ProviderCombinations.java +++ b/examples/agent/ProviderCombinations.java @@ -1,23 +1,22 @@ -import resources.agent.v1.types.AgentV1SettingsAgentContext; -import resources.agent.v1.types.AgentV1SettingsAgentContextSpeak; -import resources.agent.v1.types.AgentV1SettingsAgentContextThink; -import types.Anthropic; -import types.AnthropicThinkProviderModel; -import types.Deepgram; -import types.DeepgramSpeakProviderModel; -import types.Google; -import types.GoogleThinkProviderModel; -import types.OpenAiThinkProvider; -import types.OpenAiThinkProviderModel; -import types.SpeakSettingsV1; -import types.SpeakSettingsV1Provider; -import types.ThinkSettingsV1; -import types.ThinkSettingsV1Provider; +import com.deepgram.resources.agent.v1.types.AgentV1SettingsAgentContext; +import com.deepgram.resources.agent.v1.types.AgentV1SettingsAgentContextSpeak; +import com.deepgram.resources.agent.v1.types.AgentV1SettingsAgentContextThink; +import com.deepgram.types.Anthropic; +import com.deepgram.types.AnthropicThinkProviderModel; +import com.deepgram.types.Deepgram; +import com.deepgram.types.DeepgramSpeakProviderModel; +import com.deepgram.types.Google; +import com.deepgram.types.GoogleThinkProviderModel; +import com.deepgram.types.OpenAiThinkProvider; +import com.deepgram.types.OpenAiThinkProviderModel; +import com.deepgram.types.SpeakSettingsV1; +import com.deepgram.types.SpeakSettingsV1Provider; +import com.deepgram.types.ThinkSettingsV1; +import com.deepgram.types.ThinkSettingsV1Provider; /** - * Demonstrates building different provider combination configurations for comparison. - * Shows how to configure OpenAI, Anthropic, and Google as think providers, - * each paired with Deepgram as the speak provider. + * Demonstrates building different provider combination configurations for comparison. Shows how to configure OpenAI, + * Anthropic, and Google as think providers, each paired with Deepgram as the speak provider. * *

Usage: java ProviderCombinations */ @@ -77,9 +76,8 @@ public static void main(String[] args) { // Combination 3: Google Gemini + Deepgram System.out.println("=== Combination 3: Google + Deepgram ==="); - Google googleProvider = Google.builder() - .model(GoogleThinkProviderModel.GEMINI25FLASH) - .build(); + Google googleProvider = + Google.builder().model(GoogleThinkProviderModel.GEMINI25FLASH).build(); ThinkSettingsV1 googleThink = ThinkSettingsV1.builder() .provider(ThinkSettingsV1Provider.google(googleProvider)) .prompt("You are a helpful assistant powered by Google Gemini.") diff --git a/examples/agent/VoiceAgent.java b/examples/agent/VoiceAgent.java index bf3772d..ce93e98 100644 --- a/examples/agent/VoiceAgent.java +++ b/examples/agent/VoiceAgent.java @@ -1,27 +1,26 @@ +import com.deepgram.DeepgramClient; +import com.deepgram.resources.agent.v1.types.AgentV1Settings; +import com.deepgram.resources.agent.v1.types.AgentV1SettingsAgent; +import com.deepgram.resources.agent.v1.types.AgentV1SettingsAgentContext; +import com.deepgram.resources.agent.v1.types.AgentV1SettingsAgentContextThink; +import com.deepgram.resources.agent.v1.types.AgentV1SettingsAudio; +import com.deepgram.resources.agent.v1.websocket.V1WebSocketClient; +import com.deepgram.types.OpenAiThinkProvider; +import com.deepgram.types.OpenAiThinkProviderModel; +import com.deepgram.types.ThinkSettingsV1; +import com.deepgram.types.ThinkSettingsV1Provider; import java.io.InputStream; import java.net.URI; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import okio.ByteString; -import resources.agent.v1.types.AgentV1Settings; -import resources.agent.v1.types.AgentV1SettingsAgent; -import resources.agent.v1.types.AgentV1SettingsAgentContext; -import resources.agent.v1.types.AgentV1SettingsAgentContextThink; -import resources.agent.v1.types.AgentV1SettingsAudio; -import resources.agent.v1.websocket.V1WebSocketClient; -import types.OpenAiThinkProvider; -import types.OpenAiThinkProviderModel; -import types.ThinkSettingsV1; -import types.ThinkSettingsV1Provider; /** - * Voice agent example using the Agent V1 WebSocket. - * Demonstrates connecting to a conversational AI agent, configuring settings, - * sending audio, and handling conversation events. + * Voice agent example using the Agent V1 WebSocket. Demonstrates connecting to a conversational AI agent, configuring + * settings, sending audio, and handling conversation events. * - *

This example downloads a sample audio file and streams it to the agent, - * then listens for the agent's response. + *

This example downloads a sample audio file and streams it to the agent, then listens for the agent's response. * *

Usage: java VoiceAgent [path-to-audio-file] */ @@ -41,9 +40,7 @@ public static void main(String[] args) { System.out.println(); // Create client - DeepgramClient client = DeepgramClient.builder() - .apiKey(apiKey) - .build(); + DeepgramClient client = DeepgramClient.builder().apiKey(apiKey).build(); // Get the Agent WebSocket client V1WebSocketClient wsClient = client.agent().v1().v1WebSocket(); @@ -139,8 +136,8 @@ public static void main(String[] args) { }); wsClient.onDisconnected(reason -> { - System.out.println("\nConnection closed (code: " + reason.getCode() - + ", reason: " + reason.getReason() + ")"); + System.out.println( + "\nConnection closed (code: " + reason.getCode() + ", reason: " + reason.getReason() + ")"); closeLatch.countDown(); }); @@ -162,8 +159,8 @@ public static void main(String[] args) { } /** - * Streams audio data to the agent. Uses a local file if provided as an argument, - * otherwise downloads a sample audio file. + * Streams audio data to the agent. Uses a local file if provided as an argument, otherwise downloads a sample audio + * file. */ private static void streamAudioToAgent(V1WebSocketClient wsClient, String[] args) { try { diff --git a/examples/authentication/AccessToken.java b/examples/authentication/AccessToken.java index b9d3218..c9de380 100644 --- a/examples/authentication/AccessToken.java +++ b/examples/authentication/AccessToken.java @@ -1,8 +1,9 @@ -import types.GrantV1Response; +import com.deepgram.DeepgramClient; +import com.deepgram.types.GrantV1Response; /** - * Demonstrates generating a temporary access token (JWT) from an API key. - * Access tokens are short-lived and suitable for use in client-side applications. + * Demonstrates generating a temporary access token (JWT) from an API key. Access tokens are short-lived and suitable + * for use in client-side applications. * *

Usage: java AccessToken */ @@ -19,9 +20,7 @@ public static void main(String[] args) { System.out.println(); // Create client using API key - DeepgramClient client = DeepgramClient.builder() - .apiKey(apiKey) - .build(); + DeepgramClient client = DeepgramClient.builder().apiKey(apiKey).build(); try { // Generate a temporary access token @@ -31,8 +30,9 @@ public static void main(String[] args) { System.out.println("Access token generated successfully!"); System.out.println("Token: " + token.substring(0, Math.min(20, token.length())) + "..."); - tokenResponse.getExpiresIn().ifPresent(expiresIn -> - System.out.printf("Expires in: %.0f seconds%n", expiresIn)); + tokenResponse + .getExpiresIn() + .ifPresent(expiresIn -> System.out.printf("Expires in: %.0f seconds%n", expiresIn)); System.out.println(); System.out.println("This token can be used for short-lived client-side authentication."); diff --git a/examples/authentication/ApiKey.java b/examples/authentication/ApiKey.java index 0ca7bb5..ec79eeb 100644 --- a/examples/authentication/ApiKey.java +++ b/examples/authentication/ApiKey.java @@ -1,11 +1,12 @@ +import com.deepgram.DeepgramClient; +import com.deepgram.types.ListProjectsV1Response; +import com.deepgram.types.ListProjectsV1ResponseProjectsItem; import java.util.Collections; import java.util.List; -import types.ListProjectsV1Response; -import types.ListProjectsV1ResponseProjectsItem; /** - * Demonstrates authenticating with an API key and making a simple API call. - * The API key is read from the DEEPGRAM_API_KEY environment variable. + * Demonstrates authenticating with an API key and making a simple API call. The API key is read from the + * DEEPGRAM_API_KEY environment variable. * *

Usage: java ApiKey */ @@ -22,9 +23,7 @@ public static void main(String[] args) { System.out.println(); // Create client using API key - DeepgramClient client = DeepgramClient.builder() - .apiKey(apiKey) - .build(); + DeepgramClient client = DeepgramClient.builder().apiKey(apiKey).build(); try { // Verify authentication by listing projects diff --git a/examples/authentication/Proxy.java b/examples/authentication/Proxy.java index f53553d..bb64714 100644 --- a/examples/authentication/Proxy.java +++ b/examples/authentication/Proxy.java @@ -1,12 +1,13 @@ +import com.deepgram.DeepgramClient; +import com.deepgram.core.Environment; +import com.deepgram.types.ListProjectsV1Response; +import com.deepgram.types.ListProjectsV1ResponseProjectsItem; import java.util.Collections; import java.util.List; -import core.Environment; -import types.ListProjectsV1Response; -import types.ListProjectsV1ResponseProjectsItem; /** - * Demonstrates configuring a custom endpoint or proxy using Environment.custom(). - * Useful when routing through a proxy server or using a self-hosted deployment. + * Demonstrates configuring a custom endpoint or proxy using Environment.custom(). Useful when routing through a proxy + * server or using a self-hosted deployment. * *

Usage: java Proxy */ @@ -37,10 +38,8 @@ public static void main(String[] args) { .build(); // Create client with the custom environment - DeepgramClient client = DeepgramClient.builder() - .apiKey(apiKey) - .environment(customEnv) - .build(); + DeepgramClient client = + DeepgramClient.builder().apiKey(apiKey).environment(customEnv).build(); try { // Verify connectivity through the proxy diff --git a/examples/demo/Main.java b/examples/demo/Main.java index 0b2c0de..f2167a2 100644 --- a/examples/demo/Main.java +++ b/examples/demo/Main.java @@ -1,18 +1,18 @@ +import com.deepgram.DeepgramClient; +import com.deepgram.resources.listen.v1.media.requests.ListenV1RequestUrl; +import com.deepgram.resources.listen.v1.media.types.MediaTranscribeRequestModel; +import com.deepgram.resources.listen.v1.media.types.MediaTranscribeResponse; +import com.deepgram.types.ListProjectsV1Response; +import com.deepgram.types.ListProjectsV1ResponseProjectsItem; +import com.deepgram.types.ListenV1Response; +import com.deepgram.types.ListenV1ResponseResults; +import com.deepgram.types.ListenV1ResponseResultsChannelsItem; +import com.deepgram.types.ListenV1ResponseResultsChannelsItemAlternativesItem; import java.util.Collections; import java.util.List; -import resources.listen.v1.media.requests.ListenV1RequestUrl; -import resources.listen.v1.media.types.MediaTranscribeRequestModel; -import resources.listen.v1.media.types.MediaTranscribeResponse; -import types.ListenV1Response; -import types.ListenV1ResponseResults; -import types.ListenV1ResponseResultsChannelsItem; -import types.ListenV1ResponseResultsChannelsItemAlternativesItem; -import types.ListProjectsV1Response; -import types.ListProjectsV1ResponseProjectsItem; /** - * Comprehensive demo of the Deepgram Java SDK. - * Demonstrates multiple API features in a single program: authentication, + * Comprehensive demo of the Deepgram Java SDK. Demonstrates multiple API features in a single program: authentication, * project listing, and speech-to-text transcription. * *

Usage: java Main @@ -32,9 +32,7 @@ public static void main(String[] args) { System.out.println(); // Create client - DeepgramClient client = DeepgramClient.builder() - .apiKey(apiKey) - .build(); + DeepgramClient client = DeepgramClient.builder().apiKey(apiKey).build(); // Step 1: Verify authentication by listing projects handleListProjects(client); @@ -91,12 +89,12 @@ private static void handleTranscription(DeepgramClient client) { public Void visit(ListenV1Response response) { ListenV1ResponseResults results = response.getResults(); if (results != null && !results.getChannels().isEmpty()) { - ListenV1ResponseResultsChannelsItem channel = results.getChannels().get(0); + ListenV1ResponseResultsChannelsItem channel = + results.getChannels().get(0); List alternatives = channel.getAlternatives().orElse(Collections.emptyList()); if (!alternatives.isEmpty()) { - ListenV1ResponseResultsChannelsItemAlternativesItem alt = - alternatives.get(0); + ListenV1ResponseResultsChannelsItemAlternativesItem alt = alternatives.get(0); alt.getTranscript().ifPresent(transcript -> { System.out.println(); @@ -106,15 +104,16 @@ public Void visit(ListenV1Response response) { System.out.println(" " + "-".repeat(38)); }); - alt.getConfidence().ifPresent(confidence -> - System.out.printf(" Confidence: %.2f%%%n", confidence * 100)); + alt.getConfidence() + .ifPresent(confidence -> + System.out.printf(" Confidence: %.2f%%%n", confidence * 100)); } } return null; } @Override - public Void visit(types.ListenV1AcceptedResponse accepted) { + public Void visit(com.deepgram.types.ListenV1AcceptedResponse accepted) { System.out.println(" Request accepted: " + accepted.getRequestId()); return null; } diff --git a/examples/demo/handlers/Handlers.java b/examples/demo/handlers/Handlers.java index c075c89..6d90194 100644 --- a/examples/demo/handlers/Handlers.java +++ b/examples/demo/handlers/Handlers.java @@ -1,26 +1,24 @@ +import com.deepgram.DeepgramClient; +import com.deepgram.resources.listen.v1.media.requests.ListenV1RequestUrl; +import com.deepgram.resources.listen.v1.media.types.MediaTranscribeRequestModel; +import com.deepgram.resources.listen.v1.media.types.MediaTranscribeResponse; +import com.deepgram.types.ListenV1AcceptedResponse; +import com.deepgram.types.ListenV1Response; +import com.deepgram.types.ListenV1ResponseResults; +import com.deepgram.types.ListenV1ResponseResultsChannelsItem; +import com.deepgram.types.ListenV1ResponseResultsChannelsItemAlternativesItem; import java.util.Collections; import java.util.List; -import resources.listen.v1.media.requests.ListenV1RequestUrl; -import resources.listen.v1.media.types.MediaTranscribeRequestModel; -import resources.listen.v1.media.types.MediaTranscribeResponse; -import types.ListenV1AcceptedResponse; -import types.ListenV1Response; -import types.ListenV1ResponseResults; -import types.ListenV1ResponseResultsChannelsItem; -import types.ListenV1ResponseResultsChannelsItemAlternativesItem; /** - * Reusable handler utilities for Deepgram API responses. - * Demonstrates how to structure helper methods for common tasks + * Reusable handler utilities for Deepgram API responses. Demonstrates how to structure helper methods for common tasks * like transcription with formatted output. * *

Usage: java Handlers */ public class Handlers { - /** - * Transcribe audio from a URL and print the result. - */ + /** Transcribe audio from a URL and print the result. */ public static void transcribeAndPrint(DeepgramClient client, String audioUrl) { System.out.printf("Transcribing: %s%n", audioUrl); @@ -53,9 +51,7 @@ public Void visit(ListenV1AcceptedResponse accepted) { } } - /** - * Extract and print the transcription from a ListenV1Response. - */ + /** Extract and print the transcription from a ListenV1Response. */ public static void printTranscription(ListenV1Response response) { ListenV1ResponseResults results = response.getResults(); if (results == null || results.getChannels().isEmpty()) { @@ -83,9 +79,7 @@ public static void printTranscription(ListenV1Response response) { }); } - /** - * Demo entry point showing how to use the handler utilities. - */ + /** Demo entry point showing how to use the handler utilities. */ public static void main(String[] args) { // Get API key from environment String apiKey = System.getenv("DEEPGRAM_API_KEY"); @@ -95,9 +89,7 @@ public static void main(String[] args) { } // Create client - DeepgramClient client = DeepgramClient.builder() - .apiKey(apiKey) - .build(); + DeepgramClient client = DeepgramClient.builder().apiKey(apiKey).build(); System.out.println("Handlers Demo"); System.out.println("=".repeat(50)); @@ -105,8 +97,7 @@ public static void main(String[] args) { // Transcribe multiple audio files using the handler String[] audioUrls = { - "https://static.deepgram.com/examples/Bueller-Life-moves-pretty-fast.wav", - "https://dpgr.am/spacewalk.wav" + "https://static.deepgram.com/examples/Bueller-Life-moves-pretty-fast.wav", "https://dpgr.am/spacewalk.wav" }; for (String url : audioUrls) { diff --git a/examples/listen/AdvancedOptions.java b/examples/listen/AdvancedOptions.java index 78ee0c1..1437792 100644 --- a/examples/listen/AdvancedOptions.java +++ b/examples/listen/AdvancedOptions.java @@ -1,17 +1,18 @@ +import com.deepgram.DeepgramClient; +import com.deepgram.resources.listen.v1.media.requests.ListenV1RequestUrl; +import com.deepgram.resources.listen.v1.media.types.MediaTranscribeRequestModel; +import com.deepgram.resources.listen.v1.media.types.MediaTranscribeResponse; +import com.deepgram.types.ListenV1Response; +import com.deepgram.types.ListenV1ResponseResults; +import com.deepgram.types.ListenV1ResponseResultsChannelsItem; +import com.deepgram.types.ListenV1ResponseResultsChannelsItemAlternativesItem; +import com.deepgram.types.ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem; import java.util.Collections; import java.util.List; -import resources.listen.v1.media.requests.ListenV1RequestUrl; -import resources.listen.v1.media.types.MediaTranscribeRequestModel; -import resources.listen.v1.media.types.MediaTranscribeResponse; -import types.ListenV1Response; -import types.ListenV1ResponseResults; -import types.ListenV1ResponseResultsChannelsItem; -import types.ListenV1ResponseResultsChannelsItemAlternativesItem; -import types.ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem; /** - * Transcribe audio with advanced options: smart formatting, punctuation, - * diarization, model selection, and language specification. + * Transcribe audio with advanced options: smart formatting, punctuation, diarization, model selection, and language + * specification. * *

Usage: java AdvancedOptions */ @@ -25,9 +26,7 @@ public static void main(String[] args) { } // Create client - DeepgramClient client = DeepgramClient.builder() - .apiKey(apiKey) - .build(); + DeepgramClient client = DeepgramClient.builder().apiKey(apiKey).build(); System.out.println("Transcribing with advanced options..."); System.out.println(); @@ -55,7 +54,8 @@ public Void visit(ListenV1Response response) { return null; } - ListenV1ResponseResultsChannelsItem channel = results.getChannels().get(0); + ListenV1ResponseResultsChannelsItem channel = + results.getChannels().get(0); List alternatives = channel.getAlternatives().orElse(Collections.emptyList()); if (alternatives.isEmpty()) { @@ -63,8 +63,7 @@ public Void visit(ListenV1Response response) { return null; } - ListenV1ResponseResultsChannelsItemAlternativesItem alt = - alternatives.get(0); + ListenV1ResponseResultsChannelsItemAlternativesItem alt = alternatives.get(0); // Display transcript alt.getTranscript().ifPresent(transcript -> { @@ -75,8 +74,8 @@ public Void visit(ListenV1Response response) { }); // Display confidence - alt.getConfidence().ifPresent(confidence -> - System.out.printf("%nConfidence: %.2f%%%n", confidence * 100)); + alt.getConfidence() + .ifPresent(confidence -> System.out.printf("%nConfidence: %.2f%%%n", confidence * 100)); // Display word-level details List words = @@ -87,17 +86,15 @@ public Void visit(ListenV1Response response) { int limit = Math.min(words.size(), 10); for (int i = 0; i < limit; i++) { - ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem word = - words.get(i); + ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem word = words.get(i); StringBuilder sb = new StringBuilder(" "); - word.getWord().ifPresent(w -> - sb.append(String.format("%-15s", w))); + word.getWord().ifPresent(w -> sb.append(String.format("%-15s", w))); if (word.getStart().isPresent() && word.getEnd().isPresent()) { - sb.append(String.format(" [%.2fs - %.2fs]", + sb.append(String.format( + " [%.2fs - %.2fs]", word.getStart().get(), word.getEnd().get())); } - word.getConfidence().ifPresent(c -> - sb.append(String.format(" (%.0f%%)", c * 100))); + word.getConfidence().ifPresent(c -> sb.append(String.format(" (%.0f%%)", c * 100))); System.out.println(sb); } if (words.size() > 10) { @@ -108,7 +105,7 @@ public Void visit(ListenV1Response response) { } @Override - public Void visit(types.ListenV1AcceptedResponse accepted) { + public Void visit(com.deepgram.types.ListenV1AcceptedResponse accepted) { System.out.println("Request accepted: " + accepted.getRequestId()); return null; } diff --git a/examples/listen/Captions.java b/examples/listen/Captions.java index 1748730..f9990a4 100644 --- a/examples/listen/Captions.java +++ b/examples/listen/Captions.java @@ -1,20 +1,20 @@ +import com.deepgram.DeepgramClient; +import com.deepgram.resources.listen.v1.media.requests.ListenV1RequestUrl; +import com.deepgram.resources.listen.v1.media.types.MediaTranscribeResponse; +import com.deepgram.types.ListenV1AcceptedResponse; +import com.deepgram.types.ListenV1Response; +import com.deepgram.types.ListenV1ResponseResults; +import com.deepgram.types.ListenV1ResponseResultsChannelsItem; +import com.deepgram.types.ListenV1ResponseResultsChannelsItemAlternativesItem; +import com.deepgram.types.ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItem; +import com.deepgram.types.ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem; +import com.deepgram.types.ListenV1ResponseResultsUtterancesItem; import java.util.Collections; import java.util.List; -import resources.listen.v1.media.requests.ListenV1RequestUrl; -import resources.listen.v1.media.types.MediaTranscribeResponse; -import types.ListenV1Response; -import types.ListenV1ResponseResults; -import types.ListenV1ResponseResultsChannelsItem; -import types.ListenV1ResponseResultsChannelsItemAlternativesItem; -import types.ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs; -import types.ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItem; -import types.ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem; -import types.ListenV1ResponseResultsUtterancesItem; -import types.ListenV1AcceptedResponse; /** - * Demonstrates transcription with paragraphs and utterances enabled, - * producing caption-friendly output with speaker labels and timing. + * Demonstrates transcription with paragraphs and utterances enabled, producing caption-friendly output with speaker + * labels and timing. * *

Usage: java Captions */ @@ -34,9 +34,7 @@ public static void main(String[] args) { System.out.println(); // Create client - DeepgramClient client = DeepgramClient.builder() - .apiKey(apiKey) - .build(); + DeepgramClient client = DeepgramClient.builder().apiKey(apiKey).build(); try { // Build request with paragraphs and utterances enabled @@ -48,8 +46,7 @@ public static void main(String[] args) { .diarize(true) .build(); - MediaTranscribeResponse result = - client.listen().v1().media().transcribeUrl(request); + MediaTranscribeResponse result = client.listen().v1().media().transcribeUrl(request); // Process the response result.visit(new MediaTranscribeResponse.Visitor() { @@ -63,7 +60,8 @@ public Void visit(ListenV1Response response) { // Display paragraphs if (!results.getChannels().isEmpty()) { - ListenV1ResponseResultsChannelsItem channel = results.getChannels().get(0); + ListenV1ResponseResultsChannelsItem channel = + results.getChannels().get(0); List alternatives = channel.getAlternatives().orElse(Collections.emptyList()); @@ -74,18 +72,20 @@ public Void visit(ListenV1Response response) { alt.getParagraphs().ifPresent(paragraphs -> { System.out.println("=== Paragraphs ==="); System.out.println("-".repeat(60)); - List paras = - paragraphs.getParagraphs().orElse(Collections.emptyList()); + List + paras = paragraphs.getParagraphs().orElse(Collections.emptyList()); for (int i = 0; i < paras.size(); i++) { - ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItem para = paras.get(i); + ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItem para = + paras.get(i); float speaker = para.getSpeaker().orElse(0f); System.out.printf("Speaker %.0f:%n", speaker); - List sentences = - para.getSentences().orElse(Collections.emptyList()); - for (ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem sentence : sentences) { - sentence.getText().ifPresent(text -> - System.out.println(" " + text)); + List< + ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem> + sentences = para.getSentences().orElse(Collections.emptyList()); + for (ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem + sentence : sentences) { + sentence.getText().ifPresent(text -> System.out.println(" " + text)); } System.out.println(); } @@ -104,8 +104,7 @@ public Void visit(ListenV1Response response) { float start = utterance.getStart().orElse(0f); float end = utterance.getEnd().orElse(0f); String transcript = utterance.getTranscript().orElse(""); - System.out.printf("[%.2f - %.2f] Speaker %.0f: %s%n", - start, end, speaker, transcript); + System.out.printf("[%.2f - %.2f] Speaker %.0f: %s%n", start, end, speaker, transcript); } } diff --git a/examples/listen/FileUploadTypes.java b/examples/listen/FileUploadTypes.java index 780b7e3..ba32526 100644 --- a/examples/listen/FileUploadTypes.java +++ b/examples/listen/FileUploadTypes.java @@ -1,20 +1,21 @@ +import com.deepgram.DeepgramClient; +import com.deepgram.resources.listen.v1.media.requests.MediaTranscribeRequestOctetStream; +import com.deepgram.resources.listen.v1.media.types.MediaTranscribeRequestModel; +import com.deepgram.resources.listen.v1.media.types.MediaTranscribeResponse; +import com.deepgram.types.ListenV1AcceptedResponse; +import com.deepgram.types.ListenV1Response; +import com.deepgram.types.ListenV1ResponseResults; +import com.deepgram.types.ListenV1ResponseResultsChannelsItem; +import com.deepgram.types.ListenV1ResponseResultsChannelsItemAlternativesItem; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.net.URI; import java.util.Collections; import java.util.List; -import resources.listen.v1.media.requests.MediaTranscribeRequestOctetStream; -import resources.listen.v1.media.types.MediaTranscribeRequestModel; -import resources.listen.v1.media.types.MediaTranscribeResponse; -import types.ListenV1AcceptedResponse; -import types.ListenV1Response; -import types.ListenV1ResponseResults; -import types.ListenV1ResponseResultsChannelsItem; -import types.ListenV1ResponseResultsChannelsItemAlternativesItem; /** - * Demonstrates transcribing audio from downloaded bytes (file upload). - * Downloads an audio file into memory and sends the raw bytes to Deepgram. + * Demonstrates transcribing audio from downloaded bytes (file upload). Downloads an audio file into memory and sends + * the raw bytes to Deepgram. * *

Usage: java FileUploadTypes */ @@ -34,9 +35,7 @@ public static void main(String[] args) { System.out.println(); // Create client - DeepgramClient client = DeepgramClient.builder() - .apiKey(apiKey) - .build(); + DeepgramClient client = DeepgramClient.builder().apiKey(apiKey).build(); try { // Download the audio file into a byte array @@ -71,7 +70,7 @@ public static void main(String[] args) { private static byte[] downloadAudio(String url) throws Exception { try (InputStream in = URI.create(url).toURL().openStream(); - ByteArrayOutputStream out = new ByteArrayOutputStream()) { + ByteArrayOutputStream out = new ByteArrayOutputStream()) { byte[] buffer = new byte[8192]; int bytesRead; while ((bytesRead = in.read(buffer)) != -1) { @@ -87,7 +86,8 @@ private static void printTranscript(MediaTranscribeResponse response) { public Void visit(ListenV1Response resp) { ListenV1ResponseResults results = resp.getResults(); if (results != null && !results.getChannels().isEmpty()) { - ListenV1ResponseResultsChannelsItem channel = results.getChannels().get(0); + ListenV1ResponseResultsChannelsItem channel = + results.getChannels().get(0); List alternatives = channel.getAlternatives().orElse(Collections.emptyList()); if (!alternatives.isEmpty()) { diff --git a/examples/listen/LiveStreaming.java b/examples/listen/LiveStreaming.java index d2ef656..194904c 100644 --- a/examples/listen/LiveStreaming.java +++ b/examples/listen/LiveStreaming.java @@ -1,17 +1,17 @@ +import com.deepgram.DeepgramClient; +import com.deepgram.resources.listen.v1.types.ListenV1CloseStream; +import com.deepgram.resources.listen.v1.types.ListenV1CloseStreamType; +import com.deepgram.resources.listen.v1.types.ListenV1ResultsChannelAlternativesItem; +import com.deepgram.resources.listen.v1.websocket.V1ConnectOptions; +import com.deepgram.resources.listen.v1.websocket.V1WebSocketClient; +import com.deepgram.types.ListenV1Model; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import resources.listen.v1.types.ListenV1CloseStream; -import resources.listen.v1.types.ListenV1CloseStreamType; -import resources.listen.v1.types.ListenV1ResultsChannelAlternativesItem; -import resources.listen.v1.websocket.V1ConnectOptions; -import resources.listen.v1.websocket.V1WebSocketClient; -import types.ListenV1Model; /** - * Real-time live transcription using the Listen V1 WebSocket. - * Connects to Deepgram, registers event handlers, and demonstrates the - * WebSocket-based streaming transcription API. + * Real-time live transcription using the Listen V1 WebSocket. Connects to Deepgram, registers event handlers, and + * demonstrates the WebSocket-based streaming transcription API. * *

Usage: java LiveStreaming */ @@ -28,9 +28,7 @@ public static void main(String[] args) { System.out.println(); // Create client - DeepgramClient client = DeepgramClient.builder() - .apiKey(apiKey) - .build(); + DeepgramClient client = DeepgramClient.builder().apiKey(apiKey).build(); // Get the WebSocket client from the SDK V1WebSocketClient wsClient = client.listen().v1().v1WebSocket(); @@ -75,8 +73,8 @@ public static void main(String[] args) { }); wsClient.onDisconnected(reason -> { - System.out.println("\nConnection closed (code: " + reason.getCode() - + ", reason: " + reason.getReason() + ")"); + System.out.println( + "\nConnection closed (code: " + reason.getCode() + ", reason: " + reason.getReason() + ")"); closeLatch.countDown(); }); @@ -94,10 +92,9 @@ public static void main(String[] args) { // wsClient.sendMedia(audioChunk); // Close the stream - wsClient.sendCloseStream( - ListenV1CloseStream.builder() - .type(ListenV1CloseStreamType.CLOSE_STREAM) - .build()); + wsClient.sendCloseStream(ListenV1CloseStream.builder() + .type(ListenV1CloseStreamType.CLOSE_STREAM) + .build()); // Wait for disconnection closeLatch.await(15, TimeUnit.SECONDS); diff --git a/examples/listen/LiveStreamingV2.java b/examples/listen/LiveStreamingV2.java index 337730f..9af875a 100644 --- a/examples/listen/LiveStreamingV2.java +++ b/examples/listen/LiveStreamingV2.java @@ -1,15 +1,16 @@ +import com.deepgram.DeepgramClient; +import com.deepgram.resources.listen.v2.types.ListenV2CloseStream; +import com.deepgram.resources.listen.v2.types.ListenV2CloseStreamType; +import com.deepgram.resources.listen.v2.types.ListenV2TurnInfoEvent; +import com.deepgram.resources.listen.v2.websocket.V2ConnectOptions; +import com.deepgram.resources.listen.v2.websocket.V2WebSocketClient; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import resources.listen.v2.types.ListenV2CloseStream; -import resources.listen.v2.types.ListenV2CloseStreamType; -import resources.listen.v2.types.ListenV2TurnInfoEvent; -import resources.listen.v2.websocket.V2ConnectOptions; -import resources.listen.v2.websocket.V2WebSocketClient; /** - * Real-time live transcription using the Listen V2 WebSocket. - * V2 provides turn-based transcription with enhanced features. + * Real-time live transcription using the Listen V2 WebSocket. V2 provides turn-based transcription with enhanced + * features. * *

Usage: java LiveStreamingV2 */ @@ -26,9 +27,7 @@ public static void main(String[] args) { System.out.println(); // Create client - DeepgramClient client = DeepgramClient.builder() - .apiKey(apiKey) - .build(); + DeepgramClient client = DeepgramClient.builder().apiKey(apiKey).build(); // Get the V2 WebSocket client V2WebSocketClient wsClient = client.listen().v2().v2WebSocket(); @@ -50,8 +49,7 @@ public static void main(String[] args) { ListenV2TurnInfoEvent event = turnInfo.getEvent(); double turnIndex = turnInfo.getTurnIndex(); - System.out.printf("[%s] turn=%.0f transcript=\"%s\"%n", - event, turnIndex, transcript); + System.out.printf("[%s] turn=%.0f transcript=\"%s\"%n", event, turnIndex, transcript); }); wsClient.onError(error -> { @@ -59,8 +57,8 @@ public static void main(String[] args) { }); wsClient.onDisconnected(reason -> { - System.out.println("\nConnection closed (code: " + reason.getCode() - + ", reason: " + reason.getReason() + ")"); + System.out.println( + "\nConnection closed (code: " + reason.getCode() + ", reason: " + reason.getReason() + ")"); closeLatch.countDown(); }); @@ -78,10 +76,9 @@ public static void main(String[] args) { // wsClient.sendMedia(audioChunk); // Close the stream - wsClient.sendCloseStream( - ListenV2CloseStream.builder() - .type(ListenV2CloseStreamType.CLOSE_STREAM) - .build()); + wsClient.sendCloseStream(ListenV2CloseStream.builder() + .type(ListenV2CloseStreamType.CLOSE_STREAM) + .build()); // Wait for disconnection closeLatch.await(15, TimeUnit.SECONDS); diff --git a/examples/listen/TranscribeCallback.java b/examples/listen/TranscribeCallback.java index 5212337..df5c643 100644 --- a/examples/listen/TranscribeCallback.java +++ b/examples/listen/TranscribeCallback.java @@ -1,12 +1,13 @@ -import resources.listen.v1.media.requests.ListenV1RequestUrl; -import resources.listen.v1.media.types.MediaTranscribeRequestCallbackMethod; -import resources.listen.v1.media.types.MediaTranscribeResponse; -import types.ListenV1AcceptedResponse; -import types.ListenV1Response; +import com.deepgram.DeepgramClient; +import com.deepgram.resources.listen.v1.media.requests.ListenV1RequestUrl; +import com.deepgram.resources.listen.v1.media.types.MediaTranscribeRequestCallbackMethod; +import com.deepgram.resources.listen.v1.media.types.MediaTranscribeResponse; +import com.deepgram.types.ListenV1AcceptedResponse; +import com.deepgram.types.ListenV1Response; /** - * Submit an audio URL for asynchronous transcription with a callback URL. - * Deepgram will POST the results to your callback URL when processing completes. + * Submit an audio URL for asynchronous transcription with a callback URL. Deepgram will POST the results to your + * callback URL when processing completes. * *

Usage: java TranscribeCallback [callback-url] [audio-url] */ @@ -37,9 +38,7 @@ public static void main(String[] args) { System.out.println(); // Create client - DeepgramClient client = DeepgramClient.builder() - .apiKey(apiKey) - .build(); + DeepgramClient client = DeepgramClient.builder().apiKey(apiKey).build(); try { // Submit transcription request with callback diff --git a/examples/listen/TranscribeFile.java b/examples/listen/TranscribeFile.java index 4d7b932..0d530c7 100644 --- a/examples/listen/TranscribeFile.java +++ b/examples/listen/TranscribeFile.java @@ -1,15 +1,16 @@ +import com.deepgram.DeepgramClient; +import com.deepgram.resources.listen.v1.media.requests.MediaTranscribeRequestOctetStream; +import com.deepgram.resources.listen.v1.media.types.MediaTranscribeResponse; +import com.deepgram.types.ListenV1Response; +import com.deepgram.types.ListenV1ResponseResults; +import com.deepgram.types.ListenV1ResponseResultsChannelsItem; +import com.deepgram.types.ListenV1ResponseResultsChannelsItemAlternativesItem; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Collections; import java.util.List; -import resources.listen.v1.media.requests.MediaTranscribeRequestOctetStream; -import resources.listen.v1.media.types.MediaTranscribeResponse; -import types.ListenV1Response; -import types.ListenV1ResponseResults; -import types.ListenV1ResponseResultsChannelsItem; -import types.ListenV1ResponseResultsChannelsItemAlternativesItem; /** * Transcribe a local audio file using Deepgram's speech-to-text REST API. @@ -47,14 +48,11 @@ public static void main(String[] args) { System.out.printf("File size: %d bytes%n%n", audioData.length); // Create client - DeepgramClient client = DeepgramClient.builder() - .apiKey(apiKey) - .build(); + DeepgramClient client = DeepgramClient.builder().apiKey(apiKey).build(); // Transcribe from file data - MediaTranscribeRequestOctetStream request = MediaTranscribeRequestOctetStream.builder() - .body(audioData) - .build(); + MediaTranscribeRequestOctetStream request = + MediaTranscribeRequestOctetStream.builder().body(audioData).build(); MediaTranscribeResponse result = client.listen().v1().media().transcribeFile(request); @@ -64,12 +62,12 @@ public static void main(String[] args) { public Void visit(ListenV1Response response) { ListenV1ResponseResults results = response.getResults(); if (results != null && !results.getChannels().isEmpty()) { - ListenV1ResponseResultsChannelsItem channel = results.getChannels().get(0); + ListenV1ResponseResultsChannelsItem channel = + results.getChannels().get(0); List alternatives = channel.getAlternatives().orElse(Collections.emptyList()); if (!alternatives.isEmpty()) { - ListenV1ResponseResultsChannelsItemAlternativesItem alt = - alternatives.get(0); + ListenV1ResponseResultsChannelsItemAlternativesItem alt = alternatives.get(0); alt.getTranscript().ifPresent(transcript -> { System.out.println("Transcription:"); @@ -78,8 +76,9 @@ public Void visit(ListenV1Response response) { System.out.println("-".repeat(50)); }); - alt.getConfidence().ifPresent(confidence -> - System.out.printf("%nConfidence: %.2f%%%n", confidence * 100)); + alt.getConfidence() + .ifPresent(confidence -> + System.out.printf("%nConfidence: %.2f%%%n", confidence * 100)); } } else { System.out.println("No transcription results found"); @@ -88,7 +87,7 @@ public Void visit(ListenV1Response response) { } @Override - public Void visit(types.ListenV1AcceptedResponse accepted) { + public Void visit(com.deepgram.types.ListenV1AcceptedResponse accepted) { System.out.println("Request accepted: " + accepted.getRequestId()); return null; } diff --git a/examples/listen/TranscribeUrl.java b/examples/listen/TranscribeUrl.java index a3701ba..eb6e4c2 100644 --- a/examples/listen/TranscribeUrl.java +++ b/examples/listen/TranscribeUrl.java @@ -1,12 +1,13 @@ +import com.deepgram.DeepgramClient; +import com.deepgram.resources.listen.v1.media.requests.ListenV1RequestUrl; +import com.deepgram.resources.listen.v1.media.types.MediaTranscribeRequestModel; +import com.deepgram.resources.listen.v1.media.types.MediaTranscribeResponse; +import com.deepgram.types.ListenV1Response; +import com.deepgram.types.ListenV1ResponseResults; +import com.deepgram.types.ListenV1ResponseResultsChannelsItem; +import com.deepgram.types.ListenV1ResponseResultsChannelsItemAlternativesItem; import java.util.Collections; import java.util.List; -import resources.listen.v1.media.requests.ListenV1RequestUrl; -import resources.listen.v1.media.types.MediaTranscribeRequestModel; -import resources.listen.v1.media.types.MediaTranscribeResponse; -import types.ListenV1Response; -import types.ListenV1ResponseResults; -import types.ListenV1ResponseResultsChannelsItem; -import types.ListenV1ResponseResultsChannelsItemAlternativesItem; /** * Transcribe audio from a URL using Deepgram's speech-to-text REST API. @@ -33,9 +34,7 @@ public static void main(String[] args) { System.out.println(); // Create client - DeepgramClient client = DeepgramClient.builder() - .apiKey(apiKey) - .build(); + DeepgramClient client = DeepgramClient.builder().apiKey(apiKey).build(); try { // Transcribe from URL @@ -54,12 +53,12 @@ public static void main(String[] args) { public Void visit(ListenV1Response response) { ListenV1ResponseResults results = response.getResults(); if (results != null && !results.getChannels().isEmpty()) { - ListenV1ResponseResultsChannelsItem channel = results.getChannels().get(0); + ListenV1ResponseResultsChannelsItem channel = + results.getChannels().get(0); List alternatives = channel.getAlternatives().orElse(Collections.emptyList()); if (!alternatives.isEmpty()) { - ListenV1ResponseResultsChannelsItemAlternativesItem alt = - alternatives.get(0); + ListenV1ResponseResultsChannelsItemAlternativesItem alt = alternatives.get(0); // Display transcription alt.getTranscript().ifPresent(transcript -> { @@ -70,8 +69,9 @@ public Void visit(ListenV1Response response) { }); // Display confidence - alt.getConfidence().ifPresent(confidence -> - System.out.printf("%nConfidence: %.2f%%%n", confidence * 100)); + alt.getConfidence() + .ifPresent(confidence -> + System.out.printf("%nConfidence: %.2f%%%n", confidence * 100)); } } else { System.out.println("No transcription results found"); @@ -80,7 +80,7 @@ public Void visit(ListenV1Response response) { } @Override - public Void visit(types.ListenV1AcceptedResponse accepted) { + public Void visit(com.deepgram.types.ListenV1AcceptedResponse accepted) { System.out.println("Request accepted: " + accepted.getRequestId()); return null; } diff --git a/examples/manage/Billing.java b/examples/manage/Billing.java index 22d6417..5907cf3 100644 --- a/examples/manage/Billing.java +++ b/examples/manage/Billing.java @@ -1,9 +1,10 @@ +import com.deepgram.DeepgramClient; +import com.deepgram.types.ListProjectBalancesV1Response; +import com.deepgram.types.ListProjectBalancesV1ResponseBalancesItem; +import com.deepgram.types.ListProjectsV1Response; +import com.deepgram.types.ListProjectsV1ResponseProjectsItem; import java.util.Collections; import java.util.List; -import types.ListProjectBalancesV1Response; -import types.ListProjectBalancesV1ResponseBalancesItem; -import types.ListProjectsV1Response; -import types.ListProjectsV1ResponseProjectsItem; /** * View billing balances for a Deepgram project. @@ -20,16 +21,15 @@ public static void main(String[] args) { } // Create client - DeepgramClient client = DeepgramClient.builder() - .apiKey(apiKey) - .build(); + DeepgramClient client = DeepgramClient.builder().apiKey(apiKey).build(); System.out.println("Billing Information"); System.out.println(); try { // First, get the project ID - ListProjectsV1Response projectsResponse = client.manage().v1().projects().list(); + ListProjectsV1Response projectsResponse = + client.manage().v1().projects().list(); List projects = projectsResponse.getProjects().orElse(Collections.emptyList()); diff --git a/examples/manage/BillingDetailed.java b/examples/manage/BillingDetailed.java index 8d0c844..a54d762 100644 --- a/examples/manage/BillingDetailed.java +++ b/examples/manage/BillingDetailed.java @@ -1,13 +1,14 @@ +import com.deepgram.DeepgramClient; +import com.deepgram.resources.manage.v1.projects.billing.breakdown.requests.BreakdownListRequest; +import com.deepgram.resources.manage.v1.projects.billing.breakdown.types.BreakdownListRequestGroupingItem; +import com.deepgram.types.BillingBreakdownV1Response; +import com.deepgram.types.BillingBreakdownV1ResponseResultsItem; +import com.deepgram.types.BillingBreakdownV1ResponseResultsItemGrouping; +import com.deepgram.types.ListProjectsV1Response; +import com.deepgram.types.ListProjectsV1ResponseProjectsItem; import java.util.Arrays; import java.util.Collections; import java.util.List; -import resources.manage.v1.projects.billing.breakdown.requests.BreakdownListRequest; -import resources.manage.v1.projects.billing.breakdown.types.BreakdownListRequestGroupingItem; -import types.BillingBreakdownV1Response; -import types.BillingBreakdownV1ResponseResultsItem; -import types.BillingBreakdownV1ResponseResultsItemGrouping; -import types.ListProjectsV1Response; -import types.ListProjectsV1ResponseProjectsItem; /** * View detailed billing breakdown by line item and tags for a Deepgram project. @@ -24,16 +25,15 @@ public static void main(String[] args) { } // Create client - DeepgramClient client = DeepgramClient.builder() - .apiKey(apiKey) - .build(); + DeepgramClient client = DeepgramClient.builder().apiKey(apiKey).build(); System.out.println("Detailed Billing Breakdown"); System.out.println(); try { // Get the first project - ListProjectsV1Response projectsResponse = client.manage().v1().projects().list(); + ListProjectsV1Response projectsResponse = + client.manage().v1().projects().list(); List projects = projectsResponse.getProjects().orElse(Collections.emptyList()); @@ -54,8 +54,7 @@ public static void main(String[] args) { .build(); BillingBreakdownV1Response lineItemBreakdown = - client.manage().v1().projects().billing().breakdown().list( - projectId, lineItemRequest); + client.manage().v1().projects().billing().breakdown().list(projectId, lineItemRequest); printBillingResults(lineItemBreakdown); @@ -69,8 +68,7 @@ public static void main(String[] args) { .build(); BillingBreakdownV1Response tagBreakdown = - client.manage().v1().projects().billing().breakdown().list( - projectId, tagRequest); + client.manage().v1().projects().billing().breakdown().list(projectId, tagRequest); printBillingResults(tagBreakdown); diff --git a/examples/manage/GetUsage.java b/examples/manage/GetUsage.java index 3687b98..4aa69ce 100644 --- a/examples/manage/GetUsage.java +++ b/examples/manage/GetUsage.java @@ -1,8 +1,9 @@ +import com.deepgram.DeepgramClient; +import com.deepgram.types.ListProjectsV1Response; +import com.deepgram.types.ListProjectsV1ResponseProjectsItem; +import com.deepgram.types.UsageV1Response; import java.util.Collections; import java.util.List; -import types.ListProjectsV1Response; -import types.ListProjectsV1ResponseProjectsItem; -import types.UsageV1Response; /** * Retrieve usage information for a Deepgram project. @@ -19,16 +20,15 @@ public static void main(String[] args) { } // Create client - DeepgramClient client = DeepgramClient.builder() - .apiKey(apiKey) - .build(); + DeepgramClient client = DeepgramClient.builder().apiKey(apiKey).build(); System.out.println("Project Usage"); System.out.println(); try { // First, get the project ID - ListProjectsV1Response projectsResponse = client.manage().v1().projects().list(); + ListProjectsV1Response projectsResponse = + client.manage().v1().projects().list(); List projects = projectsResponse.getProjects().orElse(Collections.emptyList()); @@ -48,12 +48,9 @@ public static void main(String[] args) { System.out.println("Usage Summary:"); System.out.println("-".repeat(60)); - usageResponse.getStart().ifPresent(start -> - System.out.println(" Start: " + start)); - usageResponse.getEnd().ifPresent(end -> - System.out.println(" End: " + end)); - usageResponse.getResolution().ifPresent(resolution -> - System.out.println(" Resolution: " + resolution)); + usageResponse.getStart().ifPresent(start -> System.out.println(" Start: " + start)); + usageResponse.getEnd().ifPresent(end -> System.out.println(" End: " + end)); + usageResponse.getResolution().ifPresent(resolution -> System.out.println(" Resolution: " + resolution)); System.out.println(); System.out.println("Full response: " + usageResponse); diff --git a/examples/manage/ListModels.java b/examples/manage/ListModels.java index b62207c..258aa39 100644 --- a/examples/manage/ListModels.java +++ b/examples/manage/ListModels.java @@ -1,8 +1,9 @@ +import com.deepgram.DeepgramClient; +import com.deepgram.types.ListModelsV1Response; +import com.deepgram.types.ListModelsV1ResponseSttModels; +import com.deepgram.types.ListModelsV1ResponseTtsModels; import java.util.Collections; import java.util.List; -import types.ListModelsV1Response; -import types.ListModelsV1ResponseSttModels; -import types.ListModelsV1ResponseTtsModels; /** * List all available Deepgram models (speech-to-text and text-to-speech). @@ -19,9 +20,7 @@ public static void main(String[] args) { } // Create client - DeepgramClient client = DeepgramClient.builder() - .apiKey(apiKey) - .build(); + DeepgramClient client = DeepgramClient.builder().apiKey(apiKey).build(); System.out.println("Listing available Deepgram models..."); System.out.println(); @@ -30,8 +29,7 @@ public static void main(String[] args) { ListModelsV1Response response = client.manage().v1().models().list(); // Display STT models - List sttModels = - response.getStt().orElse(Collections.emptyList()); + List sttModels = response.getStt().orElse(Collections.emptyList()); System.out.println("Speech-to-Text Models (" + sttModels.size() + "):"); System.out.println("-".repeat(70)); for (ListModelsV1ResponseSttModels model : sttModels) { @@ -45,8 +43,7 @@ public static void main(String[] args) { System.out.println(); // Display TTS models - List ttsModels = - response.getTts().orElse(Collections.emptyList()); + List ttsModels = response.getTts().orElse(Collections.emptyList()); System.out.println("Text-to-Speech Models (" + ttsModels.size() + "):"); System.out.println("-".repeat(70)); for (ListModelsV1ResponseTtsModels model : ttsModels) { diff --git a/examples/manage/ListProjects.java b/examples/manage/ListProjects.java index c9e3fe9..d99abef 100644 --- a/examples/manage/ListProjects.java +++ b/examples/manage/ListProjects.java @@ -1,7 +1,8 @@ +import com.deepgram.DeepgramClient; +import com.deepgram.types.ListProjectsV1Response; +import com.deepgram.types.ListProjectsV1ResponseProjectsItem; import java.util.Collections; import java.util.List; -import types.ListProjectsV1Response; -import types.ListProjectsV1ResponseProjectsItem; /** * List all projects associated with the authenticated API key. @@ -18,9 +19,7 @@ public static void main(String[] args) { } // Create client - DeepgramClient client = DeepgramClient.builder() - .apiKey(apiKey) - .build(); + DeepgramClient client = DeepgramClient.builder().apiKey(apiKey).build(); System.out.println("Listing projects..."); System.out.println(); diff --git a/examples/manage/ManageInvites.java b/examples/manage/ManageInvites.java index f7ecb00..c9dfed5 100644 --- a/examples/manage/ManageInvites.java +++ b/examples/manage/ManageInvites.java @@ -1,10 +1,10 @@ +import com.deepgram.DeepgramClient; +import com.deepgram.types.ListProjectInvitesV1Response; +import com.deepgram.types.ListProjectInvitesV1ResponseInvitesItem; +import com.deepgram.types.ListProjectsV1Response; +import com.deepgram.types.ListProjectsV1ResponseProjectsItem; import java.util.Collections; import java.util.List; -import resources.manage.v1.projects.members.invites.requests.CreateProjectInviteV1Request; -import types.ListProjectInvitesV1Response; -import types.ListProjectInvitesV1ResponseInvitesItem; -import types.ListProjectsV1Response; -import types.ListProjectsV1ResponseProjectsItem; /** * Manage project invitations: list existing invites and send new ones. @@ -21,16 +21,15 @@ public static void main(String[] args) { } // Create client - DeepgramClient client = DeepgramClient.builder() - .apiKey(apiKey) - .build(); + DeepgramClient client = DeepgramClient.builder().apiKey(apiKey).build(); System.out.println("Manage Project Invites"); System.out.println(); try { // First, get the project ID - ListProjectsV1Response projectsResponse = client.manage().v1().projects().list(); + ListProjectsV1Response projectsResponse = + client.manage().v1().projects().list(); List projects = projectsResponse.getProjects().orElse(Collections.emptyList()); diff --git a/examples/manage/ManageKeys.java b/examples/manage/ManageKeys.java index 8c26e5e..e580fa4 100644 --- a/examples/manage/ManageKeys.java +++ b/examples/manage/ManageKeys.java @@ -1,10 +1,10 @@ +import com.deepgram.DeepgramClient; +import com.deepgram.types.ListProjectKeysV1Response; +import com.deepgram.types.ListProjectKeysV1ResponseApiKeysItem; +import com.deepgram.types.ListProjectsV1Response; +import com.deepgram.types.ListProjectsV1ResponseProjectsItem; import java.util.Collections; import java.util.List; -import types.CreateKeyV1Response; -import types.ListProjectKeysV1Response; -import types.ListProjectKeysV1ResponseApiKeysItem; -import types.ListProjectsV1Response; -import types.ListProjectsV1ResponseProjectsItem; /** * Manage API keys for a project: list existing keys and create a new one. @@ -21,16 +21,15 @@ public static void main(String[] args) { } // Create client - DeepgramClient client = DeepgramClient.builder() - .apiKey(apiKey) - .build(); + DeepgramClient client = DeepgramClient.builder().apiKey(apiKey).build(); System.out.println("Manage API Keys"); System.out.println(); try { // First, get the project ID - ListProjectsV1Response projectsResponse = client.manage().v1().projects().list(); + ListProjectsV1Response projectsResponse = + client.manage().v1().projects().list(); List projects = projectsResponse.getProjects().orElse(Collections.emptyList()); diff --git a/examples/manage/ManageMembers.java b/examples/manage/ManageMembers.java index 130809e..4bffc29 100644 --- a/examples/manage/ManageMembers.java +++ b/examples/manage/ManageMembers.java @@ -1,9 +1,10 @@ +import com.deepgram.DeepgramClient; +import com.deepgram.types.ListProjectMembersV1Response; +import com.deepgram.types.ListProjectMembersV1ResponseMembersItem; +import com.deepgram.types.ListProjectsV1Response; +import com.deepgram.types.ListProjectsV1ResponseProjectsItem; import java.util.Collections; import java.util.List; -import types.ListProjectMembersV1Response; -import types.ListProjectMembersV1ResponseMembersItem; -import types.ListProjectsV1Response; -import types.ListProjectsV1ResponseProjectsItem; /** * List and manage project members. @@ -20,16 +21,15 @@ public static void main(String[] args) { } // Create client - DeepgramClient client = DeepgramClient.builder() - .apiKey(apiKey) - .build(); + DeepgramClient client = DeepgramClient.builder().apiKey(apiKey).build(); System.out.println("Manage Project Members"); System.out.println(); try { // First, get the project ID - ListProjectsV1Response projectsResponse = client.manage().v1().projects().list(); + ListProjectsV1Response projectsResponse = + client.manage().v1().projects().list(); List projects = projectsResponse.getProjects().orElse(Collections.emptyList()); diff --git a/examples/manage/MemberPermissions.java b/examples/manage/MemberPermissions.java index 746b673..a263236 100644 --- a/examples/manage/MemberPermissions.java +++ b/examples/manage/MemberPermissions.java @@ -1,14 +1,14 @@ +import com.deepgram.DeepgramClient; +import com.deepgram.types.ListProjectMemberScopesV1Response; +import com.deepgram.types.ListProjectMembersV1Response; +import com.deepgram.types.ListProjectMembersV1ResponseMembersItem; +import com.deepgram.types.ListProjectsV1Response; +import com.deepgram.types.ListProjectsV1ResponseProjectsItem; import java.util.Collections; import java.util.List; -import types.ListProjectMemberScopesV1Response; -import types.ListProjectMembersV1Response; -import types.ListProjectMembersV1ResponseMembersItem; -import types.ListProjectsV1Response; -import types.ListProjectsV1ResponseProjectsItem; /** - * View and manage member scopes/permissions for a Deepgram project. - * Lists all members and their assigned scopes. + * View and manage member scopes/permissions for a Deepgram project. Lists all members and their assigned scopes. * *

Usage: java MemberPermissions */ @@ -22,16 +22,15 @@ public static void main(String[] args) { } // Create client - DeepgramClient client = DeepgramClient.builder() - .apiKey(apiKey) - .build(); + DeepgramClient client = DeepgramClient.builder().apiKey(apiKey).build(); System.out.println("Member Permissions (Scopes)"); System.out.println(); try { // Get the first project - ListProjectsV1Response projectsResponse = client.manage().v1().projects().list(); + ListProjectsV1Response projectsResponse = + client.manage().v1().projects().list(); List projects = projectsResponse.getProjects().orElse(Collections.emptyList()); @@ -78,10 +77,8 @@ public static void main(String[] args) { // Also fetch detailed scopes via the scopes endpoint try { ListProjectMemberScopesV1Response scopesResponse = - client.manage().v1().projects().members().scopes() - .list(projectId, memberId); - List detailedScopes = - scopesResponse.getScopes().orElse(Collections.emptyList()); + client.manage().v1().projects().members().scopes().list(projectId, memberId); + List detailedScopes = scopesResponse.getScopes().orElse(Collections.emptyList()); if (!detailedScopes.isEmpty()) { System.out.println(" Scopes (detailed):"); diff --git a/examples/manage/ProjectModels.java b/examples/manage/ProjectModels.java index 5709b20..6e0395c 100644 --- a/examples/manage/ProjectModels.java +++ b/examples/manage/ProjectModels.java @@ -1,10 +1,11 @@ +import com.deepgram.DeepgramClient; +import com.deepgram.types.ListModelsV1Response; +import com.deepgram.types.ListModelsV1ResponseSttModels; +import com.deepgram.types.ListModelsV1ResponseTtsModels; +import com.deepgram.types.ListProjectsV1Response; +import com.deepgram.types.ListProjectsV1ResponseProjectsItem; import java.util.Collections; import java.util.List; -import types.ListModelsV1Response; -import types.ListModelsV1ResponseSttModels; -import types.ListModelsV1ResponseTtsModels; -import types.ListProjectsV1Response; -import types.ListProjectsV1ResponseProjectsItem; /** * List available speech-to-text and text-to-speech models for a specific project. @@ -21,16 +22,15 @@ public static void main(String[] args) { } // Create client - DeepgramClient client = DeepgramClient.builder() - .apiKey(apiKey) - .build(); + DeepgramClient client = DeepgramClient.builder().apiKey(apiKey).build(); System.out.println("Project-Specific Models"); System.out.println(); try { // Get the first project - ListProjectsV1Response projectsResponse = client.manage().v1().projects().list(); + ListProjectsV1Response projectsResponse = + client.manage().v1().projects().list(); List projects = projectsResponse.getProjects().orElse(Collections.emptyList()); @@ -62,8 +62,7 @@ public static void main(String[] args) { System.out.printf(" %s%n", name); if (!languages.isEmpty()) { - System.out.printf(" Languages: %s%n", - String.join(", ", languages)); + System.out.printf(" Languages: %s%n", String.join(", ", languages)); } } } @@ -86,8 +85,7 @@ public static void main(String[] args) { } System.out.println(); - System.out.printf("Total: %d STT models, %d TTS models%n", - sttModels.size(), ttsModels.size()); + System.out.printf("Total: %d STT models, %d TTS models%n", sttModels.size(), ttsModels.size()); } catch (Exception e) { System.err.println("Error listing models: " + e.getMessage()); diff --git a/examples/manage/UsageBreakdown.java b/examples/manage/UsageBreakdown.java index 9469a67..c106b0b 100644 --- a/examples/manage/UsageBreakdown.java +++ b/examples/manage/UsageBreakdown.java @@ -1,12 +1,13 @@ +import com.deepgram.DeepgramClient; +import com.deepgram.resources.manage.v1.projects.usage.breakdown.requests.BreakdownGetRequest; +import com.deepgram.resources.manage.v1.projects.usage.breakdown.types.BreakdownGetRequestGrouping; +import com.deepgram.types.ListProjectsV1Response; +import com.deepgram.types.ListProjectsV1ResponseProjectsItem; +import com.deepgram.types.UsageBreakdownV1Response; +import com.deepgram.types.UsageBreakdownV1ResponseResultsItem; +import com.deepgram.types.UsageBreakdownV1ResponseResultsItemGrouping; import java.util.Collections; import java.util.List; -import resources.manage.v1.projects.usage.breakdown.requests.BreakdownGetRequest; -import resources.manage.v1.projects.usage.breakdown.types.BreakdownGetRequestGrouping; -import types.ListProjectsV1Response; -import types.ListProjectsV1ResponseProjectsItem; -import types.UsageBreakdownV1Response; -import types.UsageBreakdownV1ResponseResultsItem; -import types.UsageBreakdownV1ResponseResultsItemGrouping; /** * View usage breakdown grouped by model and tag for a Deepgram project. @@ -23,16 +24,15 @@ public static void main(String[] args) { } // Create client - DeepgramClient client = DeepgramClient.builder() - .apiKey(apiKey) - .build(); + DeepgramClient client = DeepgramClient.builder().apiKey(apiKey).build(); System.out.println("Usage Breakdown"); System.out.println(); try { // Get the first project - ListProjectsV1Response projectsResponse = client.manage().v1().projects().list(); + ListProjectsV1Response projectsResponse = + client.manage().v1().projects().list(); List projects = projectsResponse.getProjects().orElse(Collections.emptyList()); diff --git a/examples/read/AdvancedAnalysis.java b/examples/read/AdvancedAnalysis.java index 044af1a..c94f004 100644 --- a/examples/read/AdvancedAnalysis.java +++ b/examples/read/AdvancedAnalysis.java @@ -1,15 +1,16 @@ +import com.deepgram.DeepgramClient; +import com.deepgram.resources.read.v1.text.requests.TextAnalyzeRequest; +import com.deepgram.resources.read.v1.text.types.TextAnalyzeRequestCustomIntentMode; +import com.deepgram.resources.read.v1.text.types.TextAnalyzeRequestCustomTopicMode; +import com.deepgram.types.ReadV1Request; +import com.deepgram.types.ReadV1RequestText; +import com.deepgram.types.ReadV1Response; +import com.deepgram.types.ReadV1ResponseResults; import java.util.Arrays; -import resources.read.v1.text.requests.TextAnalyzeRequest; -import resources.read.v1.text.types.TextAnalyzeRequestCustomIntentMode; -import resources.read.v1.text.types.TextAnalyzeRequestCustomTopicMode; -import types.ReadV1Request; -import types.ReadV1RequestText; -import types.ReadV1Response; -import types.ReadV1ResponseResults; /** - * Advanced text intelligence analysis with custom topics and intents. - * Demonstrates how to guide Deepgram's analysis using domain-specific categories. + * Advanced text intelligence analysis with custom topics and intents. Demonstrates how to guide Deepgram's analysis + * using domain-specific categories. * *

Usage: java AdvancedAnalysis */ @@ -26,9 +27,7 @@ public static void main(String[] args) { System.out.println(); // Create client - DeepgramClient client = DeepgramClient.builder() - .apiKey(apiKey) - .build(); + DeepgramClient client = DeepgramClient.builder().apiKey(apiKey).build(); try { String sampleText = "I've been a loyal customer for five years, but lately the service " @@ -44,9 +43,8 @@ public static void main(String[] args) { System.out.println(); // Create the request body - ReadV1RequestText textBody = ReadV1RequestText.builder() - .text(sampleText) - .build(); + ReadV1RequestText textBody = + ReadV1RequestText.builder().text(sampleText).build(); // Build request with custom topics and intents TextAnalyzeRequest request = TextAnalyzeRequest.builder() @@ -60,16 +58,10 @@ public static void main(String[] args) { "Product Quality", "Customer Support", "Pricing and Refunds", - "Competitor Comparison" - )) + "Competitor Comparison")) .customTopicMode(TextAnalyzeRequestCustomTopicMode.EXTENDED) .customIntent(Arrays.asList( - "Request Refund", - "Complaint", - "Threat to Leave", - "Request Discount", - "Escalation Request" - )) + "Request Refund", "Complaint", "Threat to Leave", "Request Discount", "Escalation Request")) .customIntentMode(TextAnalyzeRequestCustomIntentMode.EXTENDED) .build(); diff --git a/examples/read/AnalyzeText.java b/examples/read/AnalyzeText.java index 0a8252d..b28a96d 100644 --- a/examples/read/AnalyzeText.java +++ b/examples/read/AnalyzeText.java @@ -1,12 +1,13 @@ -import resources.read.v1.text.requests.TextAnalyzeRequest; -import types.ReadV1Request; -import types.ReadV1RequestText; -import types.ReadV1Response; -import types.ReadV1ResponseResults; +import com.deepgram.DeepgramClient; +import com.deepgram.resources.read.v1.text.requests.TextAnalyzeRequest; +import com.deepgram.types.ReadV1Request; +import com.deepgram.types.ReadV1RequestText; +import com.deepgram.types.ReadV1Response; +import com.deepgram.types.ReadV1ResponseResults; /** - * Analyze text content using Deepgram's text intelligence API. - * Demonstrates sentiment analysis, topic detection, summarization, and intent detection. + * Analyze text content using Deepgram's text intelligence API. Demonstrates sentiment analysis, topic detection, + * summarization, and intent detection. * *

Usage: java AnalyzeText */ @@ -23,14 +24,13 @@ public static void main(String[] args) { System.out.println(); // Create client - DeepgramClient client = DeepgramClient.builder() - .apiKey(apiKey) - .build(); + DeepgramClient client = DeepgramClient.builder().apiKey(apiKey).build(); try { // Create the request body with inline text ReadV1RequestText textBody = ReadV1RequestText.builder() - .text("Life moves pretty fast. If you don't stop and look around once in a while, you could miss it.") + .text( + "Life moves pretty fast. If you don't stop and look around once in a while, you could miss it.") .build(); // Build the analyze request with options diff --git a/examples/selfhosted/Credentials.java b/examples/selfhosted/Credentials.java index 8b4dab8..97b8167 100644 --- a/examples/selfhosted/Credentials.java +++ b/examples/selfhosted/Credentials.java @@ -1,13 +1,14 @@ +import com.deepgram.DeepgramClient; +import com.deepgram.types.ListProjectDistributionCredentialsV1Response; +import com.deepgram.types.ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItem; +import com.deepgram.types.ListProjectsV1Response; +import com.deepgram.types.ListProjectsV1ResponseProjectsItem; import java.util.Collections; import java.util.List; -import types.ListProjectDistributionCredentialsV1Response; -import types.ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItem; -import types.ListProjectsV1Response; -import types.ListProjectsV1ResponseProjectsItem; /** - * Manage self-hosted distribution credentials for on-premises Deepgram deployments. - * Lists existing credentials for a project. + * Manage self-hosted distribution credentials for on-premises Deepgram deployments. Lists existing credentials for a + * project. * *

Usage: java Credentials */ @@ -21,16 +22,15 @@ public static void main(String[] args) { } // Create client - DeepgramClient client = DeepgramClient.builder() - .apiKey(apiKey) - .build(); + DeepgramClient client = DeepgramClient.builder().apiKey(apiKey).build(); System.out.println("Self-Hosted Distribution Credentials"); System.out.println(); try { // First, get the project ID - ListProjectsV1Response projectsResponse = client.manage().v1().projects().list(); + ListProjectsV1Response projectsResponse = + client.manage().v1().projects().list(); List projects = projectsResponse.getProjects().orElse(Collections.emptyList()); diff --git a/examples/speak/StreamingTts.java b/examples/speak/StreamingTts.java index d377700..9015830 100644 --- a/examples/speak/StreamingTts.java +++ b/examples/speak/StreamingTts.java @@ -1,19 +1,20 @@ +import com.deepgram.DeepgramClient; +import com.deepgram.resources.speak.v1.types.SpeakV1Close; +import com.deepgram.resources.speak.v1.types.SpeakV1CloseType; +import com.deepgram.resources.speak.v1.types.SpeakV1Flush; +import com.deepgram.resources.speak.v1.types.SpeakV1FlushType; +import com.deepgram.resources.speak.v1.types.SpeakV1Text; +import com.deepgram.resources.speak.v1.websocket.V1WebSocketClient; import java.io.FileOutputStream; import java.io.OutputStream; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; -import resources.speak.v1.types.SpeakV1Close; -import resources.speak.v1.types.SpeakV1CloseType; -import resources.speak.v1.types.SpeakV1Flush; -import resources.speak.v1.types.SpeakV1FlushType; -import resources.speak.v1.types.SpeakV1Text; -import resources.speak.v1.websocket.V1WebSocketClient; /** - * Streaming text-to-speech using the Speak V1 WebSocket. - * Sends text chunks and receives audio data in real time, saving to a file. + * Streaming text-to-speech using the Speak V1 WebSocket. Sends text chunks and receives audio data in real time, saving + * to a file. * *

Usage: java StreamingTts [output-file] */ @@ -36,9 +37,7 @@ public static void main(String[] args) { System.out.println(); // Create client - DeepgramClient client = DeepgramClient.builder() - .apiKey(apiKey) - .build(); + DeepgramClient client = DeepgramClient.builder().apiKey(apiKey).build(); // Get the Speak WebSocket client V1WebSocketClient wsClient = client.speak().v1().v1WebSocket(); @@ -89,8 +88,8 @@ public static void main(String[] args) { } catch (Exception e) { // ignore } - System.out.println("\nConnection closed (code: " + reason.getCode() - + ", reason: " + reason.getReason() + ")"); + System.out.println( + "\nConnection closed (code: " + reason.getCode() + ", reason: " + reason.getReason() + ")"); closeLatch.countDown(); }); @@ -107,17 +106,12 @@ public static void main(String[] args) { for (String sentence : sentences) { System.out.println("Sending: \"" + sentence + "\""); - wsClient.sendText( - SpeakV1Text.builder() - .text(sentence) - .build()); + wsClient.sendText(SpeakV1Text.builder().text(sentence).build()); } // Flush to ensure all text is processed wsClient.sendFlush( - SpeakV1Flush.builder() - .type(SpeakV1FlushType.FLUSH) - .build()); + SpeakV1Flush.builder().type(SpeakV1FlushType.FLUSH).build()); // Give time for audio to arrive Thread.sleep(5000); @@ -125,9 +119,7 @@ public static void main(String[] args) { // Close the connection System.out.println("\nClosing connection..."); wsClient.sendClose( - SpeakV1Close.builder() - .type(SpeakV1CloseType.CLOSE) - .build()); + SpeakV1Close.builder().type(SpeakV1CloseType.CLOSE).build()); closeLatch.await(10, TimeUnit.SECONDS); diff --git a/examples/speak/TextToSpeech.java b/examples/speak/TextToSpeech.java index d394b56..c067d48 100644 --- a/examples/speak/TextToSpeech.java +++ b/examples/speak/TextToSpeech.java @@ -1,9 +1,10 @@ +import com.deepgram.DeepgramClient; +import com.deepgram.resources.speak.v1.audio.requests.SpeakV1Request; import java.io.InputStream; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.StandardCopyOption; -import resources.speak.v1.audio.requests.SpeakV1Request; /** * Convert text to speech using Deepgram's TTS REST API and save the audio to a file. @@ -33,15 +34,11 @@ public static void main(String[] args) { System.out.println(); // Create client - DeepgramClient client = DeepgramClient.builder() - .apiKey(apiKey) - .build(); + DeepgramClient client = DeepgramClient.builder().apiKey(apiKey).build(); try { // Build the TTS request - SpeakV1Request request = SpeakV1Request.builder() - .text(text) - .build(); + SpeakV1Request request = SpeakV1Request.builder().text(text).build(); // Generate audio InputStream audioStream = client.speak().v1().audio().generate(request); diff --git a/reference.md b/reference.md deleted file mode 100644 index 357d71d..0000000 --- a/reference.md +++ /dev/null @@ -1,4257 +0,0 @@ -# Reference -## Agent V1 Settings Think Models -

client.agent.v1.settings.think.models.list() -> AgentThinkModelsV1Response -
-
- -#### 📝 Description - -
-
- -
-
- -Retrieves the available think models that can be used for AI agent processing -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.agent().v1().settings().think().models().list(); -``` -
-
-
-
- - -
-
-
- -## Auth V1 Tokens -
client.auth.v1.tokens.grant(request) -> GrantV1Response -
-
- -#### 📝 Description - -
-
- -
-
- -Generates a temporary JSON Web Token (JWT) with a 30-second (by default) TTL and usage::write permission for core voice APIs, requiring an API key with Member or higher authorization. Tokens created with this endpoint will not work with the Manage APIs. -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.auth().v1().tokens().grant( - GrantV1Request - .builder() - .build() -); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**ttlSeconds:** `Optional` — Time to live in seconds for the token. Defaults to 30 seconds. - -
-
-
-
- - -
-
-
- -## Listen V1 Media -
client.listen.v1.media.transcribeUrl(request) -> MediaTranscribeResponse -
-
- -#### 📝 Description - -
-
- -
-
- -Transcribe audio and video using Deepgram's speech-to-text REST API -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.listen().v1().media().transcribeUrl( - ListenV1RequestUrl - .builder() - .url("https://dpgr.am/spacewalk.wav") - .extra( - Arrays.asList("extra") - ) - .tag( - Arrays.asList("tag") - ) - .customTopic( - Arrays.asList("custom_topic") - ) - .customIntent( - Arrays.asList("custom_intent") - ) - .keywords( - Arrays.asList("keywords") - ) - .replace( - Arrays.asList("replace") - ) - .search( - Arrays.asList("search") - ) - .callback("callback") - .callbackMethod(MediaTranscribeRequestCallbackMethod.POST) - .sentiment(true) - .summarize(MediaTranscribeRequestSummarize.V2) - .topics(true) - .customTopicMode(MediaTranscribeRequestCustomTopicMode.EXTENDED) - .intents(true) - .customIntentMode(MediaTranscribeRequestCustomIntentMode.EXTENDED) - .detectEntities(true) - .detectLanguage(true) - .diarize(true) - .dictation(true) - .encoding(MediaTranscribeRequestEncoding.LINEAR16) - .fillerWords(true) - .language("language") - .measurements(true) - .model(MediaTranscribeRequestModel.NOVA3) - .multichannel(true) - .numerals(true) - .paragraphs(true) - .profanityFilter(true) - .punctuate(true) - .redact("redact") - .smartFormat(true) - .utterances(true) - .uttSplit(1.1) - .version(MediaTranscribeRequestVersion.LATEST) - .mipOptOut(true) - .build() -); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**callback:** `Optional` — URL to which we'll make the callback request - -
-
- -
-
- -**callbackMethod:** `Optional` — HTTP method by which the callback request will be made - -
-
- -
-
- -**extra:** `Optional` — Arbitrary key-value pairs that are attached to the API response for usage in downstream processing - -
-
- -
-
- -**sentiment:** `Optional` — Recognizes the sentiment throughout a transcript or text - -
-
- -
-
- -**summarize:** `Optional` — Summarize content. For Listen API, supports string version option. For Read API, accepts boolean only. - -
-
- -
-
- -**tag:** `Optional` — Label your requests for the purpose of identification during usage reporting - -
-
- -
-
- -**topics:** `Optional` — Detect topics throughout a transcript or text - -
-
- -
-
- -**customTopic:** `Optional` — Custom topics you want the model to detect within your input audio or text if present Submit up to `100`. - -
-
- -
-
- -**customTopicMode:** `Optional` — Sets how the model will interpret strings submitted to the `custom_topic` param. When `strict`, the model will only return topics submitted using the `custom_topic` param. When `extended`, the model will return its own detected topics in addition to those submitted using the `custom_topic` param - -
-
- -
-
- -**intents:** `Optional` — Recognizes speaker intent throughout a transcript or text - -
-
- -
-
- -**customIntent:** `Optional` — Custom intents you want the model to detect within your input audio if present - -
-
- -
-
- -**customIntentMode:** `Optional` — Sets how the model will interpret intents submitted to the `custom_intent` param. When `strict`, the model will only return intents submitted using the `custom_intent` param. When `extended`, the model will return its own detected intents in the `custom_intent` param. - -
-
- -
-
- -**detectEntities:** `Optional` — Identifies and extracts key entities from content in submitted audio - -
-
- -
-
- -**detectLanguage:** `Optional` — Identifies the dominant language spoken in submitted audio - -
-
- -
-
- -**diarize:** `Optional` — Recognize speaker changes. Each word in the transcript will be assigned a speaker number starting at 0 - -
-
- -
-
- -**dictation:** `Optional` — Dictation mode for controlling formatting with dictated speech - -
-
- -
-
- -**encoding:** `Optional` — Specify the expected encoding of your submitted audio - -
-
- -
-
- -**fillerWords:** `Optional` — Filler Words can help transcribe interruptions in your audio, like "uh" and "um" - -
-
- -
-
- -**keyterm:** `Optional` — Key term prompting can boost or suppress specialized terminology and brands. Only compatible with Nova-3 - -
-
- -
-
- -**keywords:** `Optional` — Keywords can boost or suppress specialized terminology and brands - -
-
- -
-
- -**language:** `Optional` — The [BCP-47 language tag](https://tools.ietf.org/html/bcp47) that hints at the primary spoken language. Depending on the Model and API endpoint you choose only certain languages are available - -
-
- -
-
- -**measurements:** `Optional` — Spoken measurements will be converted to their corresponding abbreviations - -
-
- -
-
- -**model:** `Optional` — AI model used to process submitted audio - -
-
- -
-
- -**multichannel:** `Optional` — Transcribe each audio channel independently - -
-
- -
-
- -**numerals:** `Optional` — Numerals converts numbers from written format to numerical format - -
-
- -
-
- -**paragraphs:** `Optional` — Splits audio into paragraphs to improve transcript readability - -
-
- -
-
- -**profanityFilter:** `Optional` — Profanity Filter looks for recognized profanity and converts it to the nearest recognized non-profane word or removes it from the transcript completely - -
-
- -
-
- -**punctuate:** `Optional` — Add punctuation and capitalization to the transcript - -
-
- -
-
- -**redact:** `Optional` — Redaction removes sensitive information from your transcripts - -
-
- -
-
- -**replace:** `Optional` — Search for terms or phrases in submitted audio and replaces them - -
-
- -
-
- -**search:** `Optional` — Search for terms or phrases in submitted audio - -
-
- -
-
- -**smartFormat:** `Optional` — Apply formatting to transcript output. When set to true, additional formatting will be applied to transcripts to improve readability - -
-
- -
-
- -**utterances:** `Optional` — Segments speech into meaningful semantic units - -
-
- -
-
- -**uttSplit:** `Optional` — Seconds to wait before detecting a pause between words in submitted audio - -
-
- -
-
- -**version:** `Optional` — Version of an AI model to use - -
-
- -
-
- -**mipOptOut:** `Optional` — Opts out requests from the Deepgram Model Improvement Program. Refer to our Docs for pricing impacts before setting this to true. https://dpgr.am/deepgram-mip - -
-
- -
-
- -**url:** `String` - -
-
-
-
- - -
-
-
- -
client.listen.v1.media.transcribeFile(request) -> MediaTranscribeResponse -
-
- -#### 📝 Description - -
-
- -
-
- -Transcribe audio and video using Deepgram's speech-to-text REST API -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.listen().v1().media().transcribeFile( - MediaTranscribeRequestOctetStream - .builder() - .body("".getBytes()) - .build() -); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**callback:** `Optional` — URL to which we'll make the callback request - -
-
- -
-
- -**callbackMethod:** `Optional` — HTTP method by which the callback request will be made - -
-
- -
-
- -**extra:** `Optional` — Arbitrary key-value pairs that are attached to the API response for usage in downstream processing - -
-
- -
-
- -**sentiment:** `Optional` — Recognizes the sentiment throughout a transcript or text - -
-
- -
-
- -**summarize:** `Optional` — Summarize content. For Listen API, supports string version option. For Read API, accepts boolean only. - -
-
- -
-
- -**tag:** `Optional` — Label your requests for the purpose of identification during usage reporting - -
-
- -
-
- -**topics:** `Optional` — Detect topics throughout a transcript or text - -
-
- -
-
- -**customTopic:** `Optional` — Custom topics you want the model to detect within your input audio or text if present Submit up to `100`. - -
-
- -
-
- -**customTopicMode:** `Optional` — Sets how the model will interpret strings submitted to the `custom_topic` param. When `strict`, the model will only return topics submitted using the `custom_topic` param. When `extended`, the model will return its own detected topics in addition to those submitted using the `custom_topic` param - -
-
- -
-
- -**intents:** `Optional` — Recognizes speaker intent throughout a transcript or text - -
-
- -
-
- -**customIntent:** `Optional` — Custom intents you want the model to detect within your input audio if present - -
-
- -
-
- -**customIntentMode:** `Optional` — Sets how the model will interpret intents submitted to the `custom_intent` param. When `strict`, the model will only return intents submitted using the `custom_intent` param. When `extended`, the model will return its own detected intents in the `custom_intent` param. - -
-
- -
-
- -**detectEntities:** `Optional` — Identifies and extracts key entities from content in submitted audio - -
-
- -
-
- -**detectLanguage:** `Optional` — Identifies the dominant language spoken in submitted audio - -
-
- -
-
- -**diarize:** `Optional` — Recognize speaker changes. Each word in the transcript will be assigned a speaker number starting at 0 - -
-
- -
-
- -**dictation:** `Optional` — Dictation mode for controlling formatting with dictated speech - -
-
- -
-
- -**encoding:** `Optional` — Specify the expected encoding of your submitted audio - -
-
- -
-
- -**fillerWords:** `Optional` — Filler Words can help transcribe interruptions in your audio, like "uh" and "um" - -
-
- -
-
- -**keyterm:** `Optional` — Key term prompting can boost or suppress specialized terminology and brands. Only compatible with Nova-3 - -
-
- -
-
- -**keywords:** `Optional` — Keywords can boost or suppress specialized terminology and brands - -
-
- -
-
- -**language:** `Optional` — The [BCP-47 language tag](https://tools.ietf.org/html/bcp47) that hints at the primary spoken language. Depending on the Model and API endpoint you choose only certain languages are available - -
-
- -
-
- -**measurements:** `Optional` — Spoken measurements will be converted to their corresponding abbreviations - -
-
- -
-
- -**model:** `Optional` — AI model used to process submitted audio - -
-
- -
-
- -**multichannel:** `Optional` — Transcribe each audio channel independently - -
-
- -
-
- -**numerals:** `Optional` — Numerals converts numbers from written format to numerical format - -
-
- -
-
- -**paragraphs:** `Optional` — Splits audio into paragraphs to improve transcript readability - -
-
- -
-
- -**profanityFilter:** `Optional` — Profanity Filter looks for recognized profanity and converts it to the nearest recognized non-profane word or removes it from the transcript completely - -
-
- -
-
- -**punctuate:** `Optional` — Add punctuation and capitalization to the transcript - -
-
- -
-
- -**redact:** `Optional` — Redaction removes sensitive information from your transcripts - -
-
- -
-
- -**replace:** `Optional` — Search for terms or phrases in submitted audio and replaces them - -
-
- -
-
- -**search:** `Optional` — Search for terms or phrases in submitted audio - -
-
- -
-
- -**smartFormat:** `Optional` — Apply formatting to transcript output. When set to true, additional formatting will be applied to transcripts to improve readability - -
-
- -
-
- -**utterances:** `Optional` — Segments speech into meaningful semantic units - -
-
- -
-
- -**uttSplit:** `Optional` — Seconds to wait before detecting a pause between words in submitted audio - -
-
- -
-
- -**version:** `Optional` — Version of an AI model to use - -
-
- -
-
- -**mipOptOut:** `Optional` — Opts out requests from the Deepgram Model Improvement Program. Refer to our Docs for pricing impacts before setting this to true. https://dpgr.am/deepgram-mip - -
-
-
-
- - -
-
-
- -## Manage V1 Models -
client.manage.v1.models.list() -> ListModelsV1Response -
-
- -#### 📝 Description - -
-
- -
-
- -Returns metadata on all the latest public models. To retrieve custom models, use Get Project Models. -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.manage().v1().models().list( - ModelsListRequest - .builder() - .includeOutdated(true) - .build() -); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**includeOutdated:** `Optional` — returns non-latest versions of models - -
-
-
-
- - -
-
-
- -
client.manage.v1.models.get(modelId) -> GetModelV1Response -
-
- -#### 📝 Description - -
-
- -
-
- -Returns metadata for a specific public model -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.manage().v1().models().get("af6e9977-99f6-4d8f-b6f5-dfdf6fb6e291"); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**modelId:** `String` — The specific UUID of the model - -
-
-
-
- - -
-
-
- -## Manage V1 Projects -
client.manage.v1.projects.list() -> ListProjectsV1Response -
-
- -#### 📝 Description - -
-
- -
-
- -Retrieves basic information about the projects associated with the API key -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.manage().v1().projects().list(); -``` -
-
-
-
- - -
-
-
- -
client.manage.v1.projects.get(projectId) -> GetProjectV1Response -
-
- -#### 📝 Description - -
-
- -
-
- -Retrieves information about the specified project -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.manage().v1().projects().get( - "123456-7890-1234-5678-901234", - ProjectsGetRequest - .builder() - .limit(1.1) - .page(1.1) - .build() -); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**projectId:** `String` — The unique identifier of the project - -
-
- -
-
- -**limit:** `Optional` — Number of results to return per page. Default 10. Range [1,1000] - -
-
- -
-
- -**page:** `Optional` — Navigate and return the results to retrieve specific portions of information of the response - -
-
-
-
- - -
-
-
- -
client.manage.v1.projects.delete(projectId) -> DeleteProjectV1Response -
-
- -#### 📝 Description - -
-
- -
-
- -Deletes the specified project -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.manage().v1().projects().delete("123456-7890-1234-5678-901234"); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**projectId:** `String` — The unique identifier of the project - -
-
-
-
- - -
-
-
- -
client.manage.v1.projects.update(projectId, request) -> UpdateProjectV1Response -
-
- -#### 📝 Description - -
-
- -
-
- -Updates the name or other properties of an existing project -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.manage().v1().projects().update( - "123456-7890-1234-5678-901234", - UpdateProjectV1Request - .builder() - .build() -); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**projectId:** `String` — The unique identifier of the project - -
-
- -
-
- -**name:** `Optional` — The name of the project - -
-
-
-
- - -
-
-
- -
client.manage.v1.projects.leave(projectId) -> LeaveProjectV1Response -
-
- -#### 📝 Description - -
-
- -
-
- -Removes the authenticated account from the specific project -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.manage().v1().projects().leave("123456-7890-1234-5678-901234"); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**projectId:** `String` — The unique identifier of the project - -
-
-
-
- - -
-
-
- -## Manage V1 Projects Keys -
client.manage.v1.projects.keys.list(projectId) -> ListProjectKeysV1Response -
-
- -#### 📝 Description - -
-
- -
-
- -Retrieves all API keys associated with the specified project -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.manage().v1().projects().keys().list( - "123456-7890-1234-5678-901234", - KeysListRequest - .builder() - .status(KeysListRequestStatus.ACTIVE) - .build() -); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**projectId:** `String` — The unique identifier of the project - -
-
- -
-
- -**status:** `Optional` — Only return keys with a specific status - -
-
-
-
- - -
-
-
- -
client.manage.v1.projects.keys.create(projectId, request) -> CreateKeyV1Response -
-
- -#### 📝 Description - -
-
- -
-
- -Creates a new API key with specified settings for the project -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.manage().v1().projects().keys().create( - "project_id", - CreateKeyV1RequestOne.of(new - HashMap() {{put("key", "value"); - }}) -); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**projectId:** `String` — The unique identifier of the project - -
-
- -
-
- -**request:** `Object` - -
-
-
-
- - -
-
-
- -
client.manage.v1.projects.keys.get(projectId, keyId) -> GetProjectKeyV1Response -
-
- -#### 📝 Description - -
-
- -
-
- -Retrieves information about a specified API key -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.manage().v1().projects().keys().get("123456-7890-1234-5678-901234", "123456789012345678901234"); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**projectId:** `String` — The unique identifier of the project - -
-
- -
-
- -**keyId:** `String` — The unique identifier of the API key - -
-
-
-
- - -
-
-
- -
client.manage.v1.projects.keys.delete(projectId, keyId) -> DeleteProjectKeyV1Response -
-
- -#### 📝 Description - -
-
- -
-
- -Deletes an API key for a specific project -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.manage().v1().projects().keys().delete("123456-7890-1234-5678-901234", "123456789012345678901234"); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**projectId:** `String` — The unique identifier of the project - -
-
- -
-
- -**keyId:** `String` — The unique identifier of the API key - -
-
-
-
- - -
-
-
- -## Manage V1 Projects Members -
client.manage.v1.projects.members.list(projectId) -> ListProjectMembersV1Response -
-
- -#### 📝 Description - -
-
- -
-
- -Retrieves a list of members for a given project -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.manage().v1().projects().members().list("123456-7890-1234-5678-901234"); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**projectId:** `String` — The unique identifier of the project - -
-
-
-
- - -
-
-
- -
client.manage.v1.projects.members.delete(projectId, memberId) -> DeleteProjectMemberV1Response -
-
- -#### 📝 Description - -
-
- -
-
- -Removes a member from the project using their unique member ID -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.manage().v1().projects().members().delete("123456-7890-1234-5678-901234", "123456789012345678901234"); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**projectId:** `String` — The unique identifier of the project - -
-
- -
-
- -**memberId:** `String` — The unique identifier of the Member - -
-
-
-
- - -
-
-
- -## Manage V1 Projects Models -
client.manage.v1.projects.models.list(projectId) -> ListModelsV1Response -
-
- -#### 📝 Description - -
-
- -
-
- -Returns metadata on all the latest models that a specific project has access to, including non-public models -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.manage().v1().projects().models().list( - "123456-7890-1234-5678-901234", - ModelsListRequest - .builder() - .includeOutdated(true) - .build() -); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**projectId:** `String` — The unique identifier of the project - -
-
- -
-
- -**includeOutdated:** `Optional` — returns non-latest versions of models - -
-
-
-
- - -
-
-
- -
client.manage.v1.projects.models.get(projectId, modelId) -> GetModelV1Response -
-
- -#### 📝 Description - -
-
- -
-
- -Returns metadata for a specific model -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.manage().v1().projects().models().get("123456-7890-1234-5678-901234", "af6e9977-99f6-4d8f-b6f5-dfdf6fb6e291"); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**projectId:** `String` — The unique identifier of the project - -
-
- -
-
- -**modelId:** `String` — The specific UUID of the model - -
-
-
-
- - -
-
-
- -## Manage V1 Projects Requests -
client.manage.v1.projects.requests.list(projectId) -> ListProjectRequestsV1Response -
-
- -#### 📝 Description - -
-
- -
-
- -Generates a list of requests for a specific project -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.manage().v1().projects().requests().list( - "123456-7890-1234-5678-901234", - RequestsListRequest - .builder() - .start(OffsetDateTime.parse("2024-01-15T09:30:00Z")) - .end(OffsetDateTime.parse("2024-01-15T09:30:00Z")) - .limit(1.1) - .page(1.1) - .accessor("12345678-1234-1234-1234-123456789012") - .requestId("12345678-1234-1234-1234-123456789012") - .deployment(RequestsListRequestDeployment.HOSTED) - .endpoint(RequestsListRequestEndpoint.LISTEN) - .method(RequestsListRequestMethod.SYNC) - .status(RequestsListRequestStatus.SUCCEEDED) - .build() -); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**projectId:** `String` — The unique identifier of the project - -
-
- -
-
- -**start:** `Optional` — Start date of the requested date range. Formats accepted are YYYY-MM-DD, YYYY-MM-DDTHH:MM:SS, or YYYY-MM-DDTHH:MM:SS+HH:MM - -
-
- -
-
- -**end:** `Optional` — End date of the requested date range. Formats accepted are YYYY-MM-DD, YYYY-MM-DDTHH:MM:SS, or YYYY-MM-DDTHH:MM:SS+HH:MM - -
-
- -
-
- -**limit:** `Optional` — Number of results to return per page. Default 10. Range [1,1000] - -
-
- -
-
- -**page:** `Optional` — Navigate and return the results to retrieve specific portions of information of the response - -
-
- -
-
- -**accessor:** `Optional` — Filter for requests where a specific accessor was used - -
-
- -
-
- -**requestId:** `Optional` — Filter for a specific request id - -
-
- -
-
- -**deployment:** `Optional` — Filter for requests where a specific deployment was used - -
-
- -
-
- -**endpoint:** `Optional` — Filter for requests where a specific endpoint was used - -
-
- -
-
- -**method:** `Optional` — Filter for requests where a specific method was used - -
-
- -
-
- -**status:** `Optional` — Filter for requests that succeeded (status code < 300) or failed (status code >=400) - -
-
-
-
- - -
-
-
- -
client.manage.v1.projects.requests.get(projectId, requestId) -> GetProjectRequestV1Response -
-
- -#### 📝 Description - -
-
- -
-
- -Retrieves a specific request for a specific project -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.manage().v1().projects().requests().get("123456-7890-1234-5678-901234", "123456-7890-1234-5678-901234"); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**projectId:** `String` — The unique identifier of the project - -
-
- -
-
- -**requestId:** `String` — The unique identifier of the request - -
-
-
-
- - -
-
-
- -## Manage V1 Projects Usage -
client.manage.v1.projects.usage.get(projectId) -> UsageV1Response -
-
- -#### 📝 Description - -
-
- -
-
- -Retrieves the usage for a specific project. Use Get Project Usage Breakdown for a more comprehensive usage summary. -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.manage().v1().projects().usage().get( - "123456-7890-1234-5678-901234", - UsageGetRequest - .builder() - .start("start") - .end("end") - .accessor("12345678-1234-1234-1234-123456789012") - .alternatives(true) - .callbackMethod(true) - .callback(true) - .channels(true) - .customIntentMode(true) - .customIntent(true) - .customTopicMode(true) - .customTopic(true) - .deployment(UsageGetRequestDeployment.HOSTED) - .detectEntities(true) - .detectLanguage(true) - .diarize(true) - .dictation(true) - .encoding(true) - .endpoint(UsageGetRequestEndpoint.LISTEN) - .extra(true) - .fillerWords(true) - .intents(true) - .keyterm(true) - .keywords(true) - .language(true) - .measurements(true) - .method(UsageGetRequestMethod.SYNC) - .model("6f548761-c9c0-429a-9315-11a1d28499c8") - .multichannel(true) - .numerals(true) - .paragraphs(true) - .profanityFilter(true) - .punctuate(true) - .redact(true) - .replace(true) - .sampleRate(true) - .search(true) - .sentiment(true) - .smartFormat(true) - .summarize(true) - .tag("tag1") - .topics(true) - .uttSplit(true) - .utterances(true) - .version(true) - .build() -); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**projectId:** `String` — The unique identifier of the project - -
-
- -
-
- -**start:** `Optional` — Start date of the requested date range. Format accepted is YYYY-MM-DD - -
-
- -
-
- -**end:** `Optional` — End date of the requested date range. Format accepted is YYYY-MM-DD - -
-
- -
-
- -**accessor:** `Optional` — Filter for requests where a specific accessor was used - -
-
- -
-
- -**alternatives:** `Optional` — Filter for requests where alternatives were used - -
-
- -
-
- -**callbackMethod:** `Optional` — Filter for requests where callback method was used - -
-
- -
-
- -**callback:** `Optional` — Filter for requests where callback was used - -
-
- -
-
- -**channels:** `Optional` — Filter for requests where channels were used - -
-
- -
-
- -**customIntentMode:** `Optional` — Filter for requests where custom intent mode was used - -
-
- -
-
- -**customIntent:** `Optional` — Filter for requests where custom intent was used - -
-
- -
-
- -**customTopicMode:** `Optional` — Filter for requests where custom topic mode was used - -
-
- -
-
- -**customTopic:** `Optional` — Filter for requests where custom topic was used - -
-
- -
-
- -**deployment:** `Optional` — Filter for requests where a specific deployment was used - -
-
- -
-
- -**detectEntities:** `Optional` — Filter for requests where detect entities was used - -
-
- -
-
- -**detectLanguage:** `Optional` — Filter for requests where detect language was used - -
-
- -
-
- -**diarize:** `Optional` — Filter for requests where diarize was used - -
-
- -
-
- -**dictation:** `Optional` — Filter for requests where dictation was used - -
-
- -
-
- -**encoding:** `Optional` — Filter for requests where encoding was used - -
-
- -
-
- -**endpoint:** `Optional` — Filter for requests where a specific endpoint was used - -
-
- -
-
- -**extra:** `Optional` — Filter for requests where extra was used - -
-
- -
-
- -**fillerWords:** `Optional` — Filter for requests where filler words was used - -
-
- -
-
- -**intents:** `Optional` — Filter for requests where intents was used - -
-
- -
-
- -**keyterm:** `Optional` — Filter for requests where keyterm was used - -
-
- -
-
- -**keywords:** `Optional` — Filter for requests where keywords was used - -
-
- -
-
- -**language:** `Optional` — Filter for requests where language was used - -
-
- -
-
- -**measurements:** `Optional` — Filter for requests where measurements were used - -
-
- -
-
- -**method:** `Optional` — Filter for requests where a specific method was used - -
-
- -
-
- -**model:** `Optional` — Filter for requests where a specific model uuid was used - -
-
- -
-
- -**multichannel:** `Optional` — Filter for requests where multichannel was used - -
-
- -
-
- -**numerals:** `Optional` — Filter for requests where numerals were used - -
-
- -
-
- -**paragraphs:** `Optional` — Filter for requests where paragraphs were used - -
-
- -
-
- -**profanityFilter:** `Optional` — Filter for requests where profanity filter was used - -
-
- -
-
- -**punctuate:** `Optional` — Filter for requests where punctuate was used - -
-
- -
-
- -**redact:** `Optional` — Filter for requests where redact was used - -
-
- -
-
- -**replace:** `Optional` — Filter for requests where replace was used - -
-
- -
-
- -**sampleRate:** `Optional` — Filter for requests where sample rate was used - -
-
- -
-
- -**search:** `Optional` — Filter for requests where search was used - -
-
- -
-
- -**sentiment:** `Optional` — Filter for requests where sentiment was used - -
-
- -
-
- -**smartFormat:** `Optional` — Filter for requests where smart format was used - -
-
- -
-
- -**summarize:** `Optional` — Filter for requests where summarize was used - -
-
- -
-
- -**tag:** `Optional` — Filter for requests where a specific tag was used - -
-
- -
-
- -**topics:** `Optional` — Filter for requests where topics was used - -
-
- -
-
- -**uttSplit:** `Optional` — Filter for requests where utt split was used - -
-
- -
-
- -**utterances:** `Optional` — Filter for requests where utterances was used - -
-
- -
-
- -**version:** `Optional` — Filter for requests where version was used - -
-
-
-
- - -
-
-
- -## Manage V1 Projects Billing Balances -
client.manage.v1.projects.billing.balances.list(projectId) -> ListProjectBalancesV1Response -
-
- -#### 📝 Description - -
-
- -
-
- -Generates a list of outstanding balances for the specified project -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.manage().v1().projects().billing().balances().list("123456-7890-1234-5678-901234"); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**projectId:** `String` — The unique identifier of the project - -
-
-
-
- - -
-
-
- -
client.manage.v1.projects.billing.balances.get(projectId, balanceId) -> GetProjectBalanceV1Response -
-
- -#### 📝 Description - -
-
- -
-
- -Retrieves details about the specified balance -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.manage().v1().projects().billing().balances().get("123456-7890-1234-5678-901234", "123456-7890-1234-5678-901234"); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**projectId:** `String` — The unique identifier of the project - -
-
- -
-
- -**balanceId:** `String` — The unique identifier of the balance - -
-
-
-
- - -
-
-
- -## Manage V1 Projects Billing Breakdown -
client.manage.v1.projects.billing.breakdown.list(projectId) -> BillingBreakdownV1Response -
-
- -#### 📝 Description - -
-
- -
-
- -Retrieves the billing summary for a specific project, with various filter options or by grouping options. -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.manage().v1().projects().billing().breakdown().list( - "123456-7890-1234-5678-901234", - BreakdownListRequest - .builder() - .start("start") - .end("end") - .accessor("12345678-1234-1234-1234-123456789012") - .deployment(BreakdownListRequestDeployment.HOSTED) - .tag("tag1") - .lineItem("streaming::nova-3") - .build() -); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**projectId:** `String` — The unique identifier of the project - -
-
- -
-
- -**start:** `Optional` — Start date of the requested date range. Format accepted is YYYY-MM-DD - -
-
- -
-
- -**end:** `Optional` — End date of the requested date range. Format accepted is YYYY-MM-DD - -
-
- -
-
- -**accessor:** `Optional` — Filter for requests where a specific accessor was used - -
-
- -
-
- -**deployment:** `Optional` — Filter for requests where a specific deployment was used - -
-
- -
-
- -**tag:** `Optional` — Filter for requests where a specific tag was used - -
-
- -
-
- -**lineItem:** `Optional` — Filter requests by line item (e.g. streaming::nova-3) - -
-
- -
-
- -**grouping:** `Optional` — Group billing breakdown by one or more dimensions (accessor, deployment, line_item, tags) - -
-
-
-
- - -
-
-
- -## Manage V1 Projects Billing Fields -
client.manage.v1.projects.billing.fields.list(projectId) -> ListBillingFieldsV1Response -
-
- -#### 📝 Description - -
-
- -
-
- -Lists the accessors, deployment types, tags, and line items used for billing data in the specified time period. Use this endpoint if you want to filter your results from the Billing Breakdown endpoint and want to know what filters are available. -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.manage().v1().projects().billing().fields().list( - "123456-7890-1234-5678-901234", - FieldsListRequest - .builder() - .start("start") - .end("end") - .build() -); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**projectId:** `String` — The unique identifier of the project - -
-
- -
-
- -**start:** `Optional` — Start date of the requested date range. Format accepted is YYYY-MM-DD - -
-
- -
-
- -**end:** `Optional` — End date of the requested date range. Format accepted is YYYY-MM-DD - -
-
-
-
- - -
-
-
- -## Manage V1 Projects Billing Purchases -
client.manage.v1.projects.billing.purchases.list(projectId) -> ListProjectPurchasesV1Response -
-
- -#### 📝 Description - -
-
- -
-
- -Returns the original purchased amount on an order transaction -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.manage().v1().projects().billing().purchases().list( - "123456-7890-1234-5678-901234", - PurchasesListRequest - .builder() - .limit(1.1) - .build() -); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**projectId:** `String` — The unique identifier of the project - -
-
- -
-
- -**limit:** `Optional` — Number of results to return per page. Default 10. Range [1,1000] - -
-
-
-
- - -
-
-
- -## Manage V1 Projects Members Invites -
client.manage.v1.projects.members.invites.list(projectId) -> ListProjectInvitesV1Response -
-
- -#### 📝 Description - -
-
- -
-
- -Generates a list of invites for a specific project -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.manage().v1().projects().members().invites().list("123456-7890-1234-5678-901234"); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**projectId:** `String` — The unique identifier of the project - -
-
-
-
- - -
-
-
- -
client.manage.v1.projects.members.invites.create(projectId, request) -> CreateProjectInviteV1Response -
-
- -#### 📝 Description - -
-
- -
-
- -Generates an invite for a specific project -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.manage().v1().projects().members().invites().create( - "123456-7890-1234-5678-901234", - CreateProjectInviteV1Request - .builder() - .email("email") - .scope("scope") - .build() -); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**projectId:** `String` — The unique identifier of the project - -
-
- -
-
- -**email:** `String` — The email address of the invitee - -
-
- -
-
- -**scope:** `String` — The scope of the invitee - -
-
-
-
- - -
-
-
- -
client.manage.v1.projects.members.invites.delete(projectId, email) -> DeleteProjectInviteV1Response -
-
- -#### 📝 Description - -
-
- -
-
- -Deletes an invite for a specific project -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.manage().v1().projects().members().invites().delete("123456-7890-1234-5678-901234", "john.doe@example.com"); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**projectId:** `String` — The unique identifier of the project - -
-
- -
-
- -**email:** `String` — The email address of the member - -
-
-
-
- - -
-
-
- -## Manage V1 Projects Members Scopes -
client.manage.v1.projects.members.scopes.list(projectId, memberId) -> ListProjectMemberScopesV1Response -
-
- -#### 📝 Description - -
-
- -
-
- -Retrieves a list of scopes for a specific member -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.manage().v1().projects().members().scopes().list("123456-7890-1234-5678-901234", "123456789012345678901234"); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**projectId:** `String` — The unique identifier of the project - -
-
- -
-
- -**memberId:** `String` — The unique identifier of the Member - -
-
-
-
- - -
-
-
- -
client.manage.v1.projects.members.scopes.update(projectId, memberId, request) -> UpdateProjectMemberScopesV1Response -
-
- -#### 📝 Description - -
-
- -
-
- -Updates the scopes for a specific member -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.manage().v1().projects().members().scopes().update( - "123456-7890-1234-5678-901234", - "123456789012345678901234", - UpdateProjectMemberScopesV1Request - .builder() - .scope("admin") - .build() -); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**projectId:** `String` — The unique identifier of the project - -
-
- -
-
- -**memberId:** `String` — The unique identifier of the Member - -
-
- -
-
- -**scope:** `String` — A scope to update - -
-
-
-
- - -
-
-
- -## Manage V1 Projects Usage Breakdown -
client.manage.v1.projects.usage.breakdown.get(projectId) -> UsageBreakdownV1Response -
-
- -#### 📝 Description - -
-
- -
-
- -Retrieves the usage breakdown for a specific project, with various filter options by API feature or by groupings. Setting a feature (e.g. diarize) to true includes requests that used that feature, while false excludes requests that used it. Multiple true filters are combined with OR logic, while false filters use AND logic. -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.manage().v1().projects().usage().breakdown().get( - "123456-7890-1234-5678-901234", - BreakdownGetRequest - .builder() - .start("start") - .end("end") - .grouping(BreakdownGetRequestGrouping.ACCESSOR) - .accessor("12345678-1234-1234-1234-123456789012") - .alternatives(true) - .callbackMethod(true) - .callback(true) - .channels(true) - .customIntentMode(true) - .customIntent(true) - .customTopicMode(true) - .customTopic(true) - .deployment(BreakdownGetRequestDeployment.HOSTED) - .detectEntities(true) - .detectLanguage(true) - .diarize(true) - .dictation(true) - .encoding(true) - .endpoint(BreakdownGetRequestEndpoint.LISTEN) - .extra(true) - .fillerWords(true) - .intents(true) - .keyterm(true) - .keywords(true) - .language(true) - .measurements(true) - .method(BreakdownGetRequestMethod.SYNC) - .model("6f548761-c9c0-429a-9315-11a1d28499c8") - .multichannel(true) - .numerals(true) - .paragraphs(true) - .profanityFilter(true) - .punctuate(true) - .redact(true) - .replace(true) - .sampleRate(true) - .search(true) - .sentiment(true) - .smartFormat(true) - .summarize(true) - .tag("tag1") - .topics(true) - .uttSplit(true) - .utterances(true) - .version(true) - .build() -); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**projectId:** `String` — The unique identifier of the project - -
-
- -
-
- -**start:** `Optional` — Start date of the requested date range. Format accepted is YYYY-MM-DD - -
-
- -
-
- -**end:** `Optional` — End date of the requested date range. Format accepted is YYYY-MM-DD - -
-
- -
-
- -**grouping:** `Optional` — Common usage grouping parameters - -
-
- -
-
- -**accessor:** `Optional` — Filter for requests where a specific accessor was used - -
-
- -
-
- -**alternatives:** `Optional` — Filter for requests where alternatives were used - -
-
- -
-
- -**callbackMethod:** `Optional` — Filter for requests where callback method was used - -
-
- -
-
- -**callback:** `Optional` — Filter for requests where callback was used - -
-
- -
-
- -**channels:** `Optional` — Filter for requests where channels were used - -
-
- -
-
- -**customIntentMode:** `Optional` — Filter for requests where custom intent mode was used - -
-
- -
-
- -**customIntent:** `Optional` — Filter for requests where custom intent was used - -
-
- -
-
- -**customTopicMode:** `Optional` — Filter for requests where custom topic mode was used - -
-
- -
-
- -**customTopic:** `Optional` — Filter for requests where custom topic was used - -
-
- -
-
- -**deployment:** `Optional` — Filter for requests where a specific deployment was used - -
-
- -
-
- -**detectEntities:** `Optional` — Filter for requests where detect entities was used - -
-
- -
-
- -**detectLanguage:** `Optional` — Filter for requests where detect language was used - -
-
- -
-
- -**diarize:** `Optional` — Filter for requests where diarize was used - -
-
- -
-
- -**dictation:** `Optional` — Filter for requests where dictation was used - -
-
- -
-
- -**encoding:** `Optional` — Filter for requests where encoding was used - -
-
- -
-
- -**endpoint:** `Optional` — Filter for requests where a specific endpoint was used - -
-
- -
-
- -**extra:** `Optional` — Filter for requests where extra was used - -
-
- -
-
- -**fillerWords:** `Optional` — Filter for requests where filler words was used - -
-
- -
-
- -**intents:** `Optional` — Filter for requests where intents was used - -
-
- -
-
- -**keyterm:** `Optional` — Filter for requests where keyterm was used - -
-
- -
-
- -**keywords:** `Optional` — Filter for requests where keywords was used - -
-
- -
-
- -**language:** `Optional` — Filter for requests where language was used - -
-
- -
-
- -**measurements:** `Optional` — Filter for requests where measurements were used - -
-
- -
-
- -**method:** `Optional` — Filter for requests where a specific method was used - -
-
- -
-
- -**model:** `Optional` — Filter for requests where a specific model uuid was used - -
-
- -
-
- -**multichannel:** `Optional` — Filter for requests where multichannel was used - -
-
- -
-
- -**numerals:** `Optional` — Filter for requests where numerals were used - -
-
- -
-
- -**paragraphs:** `Optional` — Filter for requests where paragraphs were used - -
-
- -
-
- -**profanityFilter:** `Optional` — Filter for requests where profanity filter was used - -
-
- -
-
- -**punctuate:** `Optional` — Filter for requests where punctuate was used - -
-
- -
-
- -**redact:** `Optional` — Filter for requests where redact was used - -
-
- -
-
- -**replace:** `Optional` — Filter for requests where replace was used - -
-
- -
-
- -**sampleRate:** `Optional` — Filter for requests where sample rate was used - -
-
- -
-
- -**search:** `Optional` — Filter for requests where search was used - -
-
- -
-
- -**sentiment:** `Optional` — Filter for requests where sentiment was used - -
-
- -
-
- -**smartFormat:** `Optional` — Filter for requests where smart format was used - -
-
- -
-
- -**summarize:** `Optional` — Filter for requests where summarize was used - -
-
- -
-
- -**tag:** `Optional` — Filter for requests where a specific tag was used - -
-
- -
-
- -**topics:** `Optional` — Filter for requests where topics was used - -
-
- -
-
- -**uttSplit:** `Optional` — Filter for requests where utt split was used - -
-
- -
-
- -**utterances:** `Optional` — Filter for requests where utterances was used - -
-
- -
-
- -**version:** `Optional` — Filter for requests where version was used - -
-
-
-
- - -
-
-
- -## Manage V1 Projects Usage Fields -
client.manage.v1.projects.usage.fields.list(projectId) -> UsageFieldsV1Response -
-
- -#### 📝 Description - -
-
- -
-
- -Lists the features, models, tags, languages, and processing method used for requests in the specified project -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.manage().v1().projects().usage().fields().list( - "123456-7890-1234-5678-901234", - FieldsListRequest - .builder() - .start("start") - .end("end") - .build() -); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**projectId:** `String` — The unique identifier of the project - -
-
- -
-
- -**start:** `Optional` — Start date of the requested date range. Format accepted is YYYY-MM-DD - -
-
- -
-
- -**end:** `Optional` — End date of the requested date range. Format accepted is YYYY-MM-DD - -
-
-
-
- - -
-
-
- -## Read V1 Text -
client.read.v1.text.analyze(request) -> ReadV1Response -
-
- -#### 📝 Description - -
-
- -
-
- -Analyze text content using Deepgrams text analysis API -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.read().v1().text().analyze( - TextAnalyzeRequest - .builder() - .body( - ReadV1Request.of( - ReadV1RequestUrl - .builder() - .url("url") - .build() - ) - ) - .tag( - Arrays.asList("tag") - ) - .customTopic( - Arrays.asList("custom_topic") - ) - .customIntent( - Arrays.asList("custom_intent") - ) - .callback("callback") - .callbackMethod(TextAnalyzeRequestCallbackMethod.POST) - .sentiment(true) - .summarize(TextAnalyzeRequestSummarize.V2) - .topics(true) - .customTopicMode(TextAnalyzeRequestCustomTopicMode.EXTENDED) - .intents(true) - .customIntentMode(TextAnalyzeRequestCustomIntentMode.EXTENDED) - .language("language") - .build() -); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**callback:** `Optional` — URL to which we'll make the callback request - -
-
- -
-
- -**callbackMethod:** `Optional` — HTTP method by which the callback request will be made - -
-
- -
-
- -**sentiment:** `Optional` — Recognizes the sentiment throughout a transcript or text - -
-
- -
-
- -**summarize:** `Optional` — Summarize content. For Listen API, supports string version option. For Read API, accepts boolean only. - -
-
- -
-
- -**tag:** `Optional` — Label your requests for the purpose of identification during usage reporting - -
-
- -
-
- -**topics:** `Optional` — Detect topics throughout a transcript or text - -
-
- -
-
- -**customTopic:** `Optional` — Custom topics you want the model to detect within your input audio or text if present Submit up to `100`. - -
-
- -
-
- -**customTopicMode:** `Optional` — Sets how the model will interpret strings submitted to the `custom_topic` param. When `strict`, the model will only return topics submitted using the `custom_topic` param. When `extended`, the model will return its own detected topics in addition to those submitted using the `custom_topic` param - -
-
- -
-
- -**intents:** `Optional` — Recognizes speaker intent throughout a transcript or text - -
-
- -
-
- -**customIntent:** `Optional` — Custom intents you want the model to detect within your input audio if present - -
-
- -
-
- -**customIntentMode:** `Optional` — Sets how the model will interpret intents submitted to the `custom_intent` param. When `strict`, the model will only return intents submitted using the `custom_intent` param. When `extended`, the model will return its own detected intents in the `custom_intent` param. - -
-
- -
-
- -**language:** `Optional` — The [BCP-47 language tag](https://tools.ietf.org/html/bcp47) that hints at the primary spoken language. Depending on the Model and API endpoint you choose only certain languages are available - -
-
- -
-
- -**request:** `ReadV1Request` - -
-
-
-
- - -
-
-
- -## SelfHosted V1 DistributionCredentials -
client.selfHosted.v1.distributionCredentials.list(projectId) -> ListProjectDistributionCredentialsV1Response -
-
- -#### 📝 Description - -
-
- -
-
- -Lists sets of distribution credentials for the specified project -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.selfHosted().v1().distributionCredentials().list("123456-7890-1234-5678-901234"); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**projectId:** `String` — The unique identifier of the project - -
-
-
-
- - -
-
-
- -
client.selfHosted.v1.distributionCredentials.create(projectId, request) -> CreateProjectDistributionCredentialsV1Response -
-
- -#### 📝 Description - -
-
- -
-
- -Creates a set of distribution credentials for the specified project -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.selfHosted().v1().distributionCredentials().create( - "123456-7890-1234-5678-901234", - CreateProjectDistributionCredentialsV1Request - .builder() - .provider("quay") - .build() -); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**projectId:** `String` — The unique identifier of the project - -
-
- -
-
- -**scopes:** `Optional` — List of permission scopes for the credentials - -
-
- -
-
- -**provider:** `Optional` — The provider of the distribution service - -
-
- -
-
- -**comment:** `Optional` — Optional comment about the credentials - -
-
-
-
- - -
-
-
- -
client.selfHosted.v1.distributionCredentials.get(projectId, distributionCredentialsId) -> GetProjectDistributionCredentialsV1Response -
-
- -#### 📝 Description - -
-
- -
-
- -Returns a set of distribution credentials for the specified project -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.selfHosted().v1().distributionCredentials().get("123456-7890-1234-5678-901234", "8b36cfd0-472f-4a21-833f-2d6343c3a2f3"); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**projectId:** `String` — The unique identifier of the project - -
-
- -
-
- -**distributionCredentialsId:** `String` — The UUID of the distribution credentials - -
-
-
-
- - -
-
-
- -
client.selfHosted.v1.distributionCredentials.delete(projectId, distributionCredentialsId) -> GetProjectDistributionCredentialsV1Response -
-
- -#### 📝 Description - -
-
- -
-
- -Deletes a set of distribution credentials for the specified project -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.selfHosted().v1().distributionCredentials().delete("123456-7890-1234-5678-901234", "8b36cfd0-472f-4a21-833f-2d6343c3a2f3"); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**projectId:** `String` — The unique identifier of the project - -
-
- -
-
- -**distributionCredentialsId:** `String` — The UUID of the distribution credentials - -
-
-
-
- - -
-
-
- -## Speak V1 Audio -
client.speak.v1.audio.generate(request) -> InputStream -
-
- -#### 📝 Description - -
-
- -
-
- -Convert text into natural-sounding speech using Deepgram's TTS REST API -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```java -client.speak().v1().audio().generate( - SpeakV1Request - .builder() - .text("text") - .build() -); -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**callback:** `Optional` — URL to which we'll make the callback request - -
-
- -
-
- -**callbackMethod:** `Optional` — HTTP method by which the callback request will be made - -
-
- -
-
- -**mipOptOut:** `Optional` — Opts out requests from the Deepgram Model Improvement Program. Refer to our Docs for pricing impacts before setting this to true. https://dpgr.am/deepgram-mip - -
-
- -
-
- -**tag:** `Optional` — Label your requests for the purpose of identification during usage reporting - -
-
- -
-
- -**bitRate:** `Optional` — The bitrate of the audio in bits per second. Choose from predefined ranges or specific values based on the encoding type. - -
-
- -
-
- -**container:** `Optional` — Container specifies the file format wrapper for the output audio. The available options depend on the encoding type. - -
-
- -
-
- -**encoding:** `Optional` — Encoding allows you to specify the expected encoding of your audio output - -
-
- -
-
- -**model:** `Optional` — AI model used to process submitted text - -
-
- -
-
- -**sampleRate:** `Optional` — Sample Rate specifies the sample rate for the output audio. Based on the encoding, different sample rates are supported. For some encodings, the sample rate is not configurable - -
-
- -
-
- -**text:** `String` — The text content to be converted to speech - -
-
-
-
- - -
-
-
- 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..be5c4ee --- /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.deepgram.AsyncDeepgramApiClient + } +} diff --git a/src/main/java/AsyncDeepgramApiClient.java b/src/main/java/AsyncDeepgramApiClient.java deleted file mode 100644 index 40f0583..0000000 --- a/src/main/java/AsyncDeepgramApiClient.java +++ /dev/null @@ -1,72 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -import core.ClientOptions; -import core.Suppliers; -import java.util.function.Supplier; -import resources.agent.AsyncAgentClient; -import resources.auth.AsyncAuthClient; -import resources.listen.AsyncListenClient; -import resources.manage.AsyncManageClient; -import resources.read.AsyncReadClient; -import resources.selfhosted.AsyncSelfHostedClient; -import resources.speak.AsyncSpeakClient; - -public class AsyncDeepgramApiClient { - protected final ClientOptions clientOptions; - - protected final Supplier agentClient; - - protected final Supplier authClient; - - protected final Supplier listenClient; - - protected final Supplier manageClient; - - protected final Supplier readClient; - - protected final Supplier selfHostedClient; - - protected final Supplier speakClient; - - public AsyncDeepgramApiClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.agentClient = Suppliers.memoize(() -> new AsyncAgentClient(clientOptions)); - this.authClient = Suppliers.memoize(() -> new AsyncAuthClient(clientOptions)); - this.listenClient = Suppliers.memoize(() -> new AsyncListenClient(clientOptions)); - this.manageClient = Suppliers.memoize(() -> new AsyncManageClient(clientOptions)); - this.readClient = Suppliers.memoize(() -> new AsyncReadClient(clientOptions)); - this.selfHostedClient = Suppliers.memoize(() -> new AsyncSelfHostedClient(clientOptions)); - this.speakClient = Suppliers.memoize(() -> new AsyncSpeakClient(clientOptions)); - } - - public AsyncAgentClient agent() { - return this.agentClient.get(); - } - - public AsyncAuthClient auth() { - return this.authClient.get(); - } - - public AsyncListenClient listen() { - return this.listenClient.get(); - } - - public AsyncManageClient manage() { - return this.manageClient.get(); - } - - public AsyncReadClient read() { - return this.readClient.get(); - } - - public AsyncSelfHostedClient selfHosted() { - return this.selfHostedClient.get(); - } - - public AsyncSpeakClient speak() { - return this.speakClient.get(); - } - - public static AsyncDeepgramApiClientBuilder builder() { - return new AsyncDeepgramApiClientBuilder(); - } -} diff --git a/src/main/java/AsyncDeepgramApiClientBuilder.java b/src/main/java/AsyncDeepgramApiClientBuilder.java deleted file mode 100644 index e582020..0000000 --- a/src/main/java/AsyncDeepgramApiClientBuilder.java +++ /dev/null @@ -1,208 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -import core.ClientOptions; -import core.Environment; -import core.LogConfig; -import java.util.HashMap; -import java.util.Map; -import java.util.Optional; -import okhttp3.OkHttpClient; - -public class AsyncDeepgramApiClientBuilder { - private Optional timeout = Optional.empty(); - - private Optional maxRetries = Optional.empty(); - - private final Map customHeaders = new HashMap<>(); - - private String apiKey = System.getenv("DEEPGRAM_API_KEY"); - - private Environment environment = Environment.PRODUCTION; - - private OkHttpClient httpClient; - - private Optional logging = Optional.empty(); - - /** Sets apiKey. Defaults to the DEEPGRAM_API_KEY environment variable. */ - public AsyncDeepgramApiClientBuilder apiKey(String apiKey) { - this.apiKey = apiKey; - return this; - } - - public AsyncDeepgramApiClientBuilder environment(Environment environment) { - this.environment = environment; - return this; - } - - /** Sets the timeout (in seconds) for the client. Defaults to 60 seconds. */ - public AsyncDeepgramApiClientBuilder timeout(int timeout) { - this.timeout = Optional.of(timeout); - return this; - } - - /** Sets the maximum number of retries for the client. Defaults to 2 retries. */ - public AsyncDeepgramApiClientBuilder maxRetries(int maxRetries) { - this.maxRetries = Optional.of(maxRetries); - return this; - } - - /** Sets the underlying OkHttp client */ - public AsyncDeepgramApiClientBuilder httpClient(OkHttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /** - * Configure logging for the SDK. Silent by default — no log output unless explicitly configured. - */ - public AsyncDeepgramApiClientBuilder logging(LogConfig logging) { - this.logging = Optional.of(logging); - return this; - } - - /** - * Add a custom header to be sent with all requests. For headers that need to be computed - * dynamically or conditionally, use the setAdditional() method override instead. - * - * @param name The header name - * @param value The header value - * @return This builder for method chaining - */ - public AsyncDeepgramApiClientBuilder addHeader(String name, String value) { - this.customHeaders.put(name, value); - return this; - } - - protected ClientOptions buildClientOptions() { - ClientOptions.Builder builder = ClientOptions.builder(); - setEnvironment(builder); - setAuthentication(builder); - setHttpClient(builder); - setTimeouts(builder); - setRetries(builder); - setLogging(builder); - for (Map.Entry header : this.customHeaders.entrySet()) { - builder.addHeader(header.getKey(), header.getValue()); - } - setAdditional(builder); - return builder.build(); - } - - /** - * Sets the environment configuration for the client. Override this method to modify URLs or add - * environment-specific logic. - * - * @param builder The ClientOptions.Builder to configure - */ - protected void setEnvironment(ClientOptions.Builder builder) { - builder.environment(this.environment); - } - - /** - * Override this method to customize authentication. This method is called during client options - * construction to set up authentication headers. - * - * @param builder The ClientOptions.Builder to configure - *

Example: - *

{@code
-   * @Override
-   * protected void setAuthentication(ClientOptions.Builder builder) {
-   *     super.setAuthentication(builder); // Keep existing auth
-   *     builder.addHeader("X-API-Key", this.apiKey);
-   * }
-   * }
- */ - protected void setAuthentication(ClientOptions.Builder builder) { - builder.addHeader("Authorization", "Token " + this.apiKey); - } - - /** - * Sets the request timeout configuration. Override this method to customize timeout behavior. - * - * @param builder The ClientOptions.Builder to configure - */ - protected void setTimeouts(ClientOptions.Builder builder) { - if (this.timeout.isPresent()) { - builder.timeout(this.timeout.get()); - } - } - - /** - * Sets the retry configuration for failed requests. Override this method to implement custom - * retry strategies. - * - * @param builder The ClientOptions.Builder to configure - */ - protected void setRetries(ClientOptions.Builder builder) { - if (this.maxRetries.isPresent()) { - builder.maxRetries(this.maxRetries.get()); - } - } - - /** - * Sets the OkHttp client configuration. Override this method to customize HTTP client behavior - * (interceptors, connection pools, etc). - * - * @param builder The ClientOptions.Builder to configure - */ - protected void setHttpClient(ClientOptions.Builder builder) { - if (this.httpClient != null) { - builder.httpClient(this.httpClient); - } - } - - /** - * Sets the logging configuration for the SDK. Override this method to customize logging behavior. - * - * @param builder The ClientOptions.Builder to configure - */ - protected void setLogging(ClientOptions.Builder builder) { - if (this.logging.isPresent()) { - builder.logging(this.logging.get()); - } - } - - /** - * Override this method to add any additional configuration to the client. This method is called - * at the end of the configuration chain, allowing you to add custom headers, modify settings, or - * perform any other client customization. - * - * @param builder The ClientOptions.Builder to configure - *

Example: - *

{@code
-   * @Override
-   * protected void setAdditional(ClientOptions.Builder builder) {
-   *     builder.addHeader("X-Request-ID", () -> UUID.randomUUID().toString());
-   *     builder.addHeader("X-Client-Version", "1.0.0");
-   * }
-   * }
- */ - protected void setAdditional(ClientOptions.Builder builder) {} - - /** - * Override this method to add custom validation logic before the client is built. This method is - * called at the beginning of the build() method to ensure the configuration is valid. Throw an - * exception to prevent client creation if validation fails. - * - *

Example: - * - *

{@code
-   * @Override
-   * protected void validateConfiguration() {
-   *     super.validateConfiguration(); // Run parent validations
-   *     if (tenantId == null || tenantId.isEmpty()) {
-   *         throw new IllegalStateException("tenantId is required");
-   *     }
-   * }
-   * }
- */ - protected void validateConfiguration() {} - - public AsyncDeepgramApiClient build() { - if (apiKey == null) { - throw new RuntimeException( - "Please provide apiKey or set the DEEPGRAM_API_KEY environment variable."); - } - validateConfiguration(); - return new AsyncDeepgramApiClient(buildClientOptions()); - } -} diff --git a/src/main/java/AsyncDeepgramClient.java b/src/main/java/AsyncDeepgramClient.java deleted file mode 100644 index b279dd7..0000000 --- a/src/main/java/AsyncDeepgramClient.java +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Async version of {@link DeepgramClient}. Extends the generated AsyncDeepgramApiClient with the - * same custom features. - */ -import core.ClientOptions; - -public class AsyncDeepgramClient extends AsyncDeepgramApiClient { - public AsyncDeepgramClient(ClientOptions clientOptions) { - super(clientOptions); - } - - public static AsyncDeepgramClientBuilder builder() { - return new AsyncDeepgramClientBuilder(); - } -} diff --git a/src/main/java/AsyncDeepgramClientBuilder.java b/src/main/java/AsyncDeepgramClientBuilder.java deleted file mode 100644 index 9e828cf..0000000 --- a/src/main/java/AsyncDeepgramClientBuilder.java +++ /dev/null @@ -1,117 +0,0 @@ -/** - * Async version of {@link DeepgramClientBuilder}. Extends the generated - * AsyncDeepgramApiClientBuilder with the same custom features. - * - *

Adds support for: - * - *

    - *
  • {@code accessToken} — Alternative to {@code apiKey}. Uses Bearer token authentication. If - * provided, takes precedence over apiKey for the Authorization header. - *
  • {@code sessionId} — Session identifier sent as {@code x-deepgram-session-id} header. If not - * provided, a UUID is auto-generated. - *
- */ -import core.ClientOptions; -import core.Environment; -import core.LogConfig; -import java.util.UUID; -import okhttp3.OkHttpClient; - -public class AsyncDeepgramClientBuilder extends AsyncDeepgramApiClientBuilder { - private String accessToken; - - private String sessionId; - - private String apiKeyValue = System.getenv("DEEPGRAM_API_KEY"); - - /** - * Sets an access token (JWT) for Bearer authentication. If provided, this takes precedence over - * apiKey and sets the Authorization header to {@code Bearer }. - */ - public AsyncDeepgramClientBuilder accessToken(String accessToken) { - this.accessToken = accessToken; - return this; - } - - /** - * Sets a session identifier sent as the {@code x-deepgram-session-id} header with every request - * and WebSocket connection. If not provided, a UUID is auto-generated. - */ - public AsyncDeepgramClientBuilder sessionId(String sessionId) { - this.sessionId = sessionId; - return this; - } - - // Override parent methods to return AsyncDeepgramClientBuilder for fluent chaining - - @Override - public AsyncDeepgramClientBuilder apiKey(String apiKey) { - this.apiKeyValue = apiKey; - super.apiKey(apiKey); - return this; - } - - @Override - public AsyncDeepgramClientBuilder environment(Environment environment) { - super.environment(environment); - return this; - } - - @Override - public AsyncDeepgramClientBuilder timeout(int timeout) { - super.timeout(timeout); - return this; - } - - @Override - public AsyncDeepgramClientBuilder maxRetries(int maxRetries) { - super.maxRetries(maxRetries); - return this; - } - - @Override - public AsyncDeepgramClientBuilder httpClient(OkHttpClient httpClient) { - super.httpClient(httpClient); - return this; - } - - @Override - public AsyncDeepgramClientBuilder logging(LogConfig logging) { - super.logging(logging); - return this; - } - - @Override - public AsyncDeepgramClientBuilder addHeader(String name, String value) { - super.addHeader(name, value); - return this; - } - - @Override - protected void setAuthentication(ClientOptions.Builder builder) { - if (accessToken != null) { - builder.addHeader("Authorization", "Bearer " + accessToken); - } else { - super.setAuthentication(builder); - } - } - - @Override - protected void setAdditional(ClientOptions.Builder builder) { - String sid = (sessionId != null) ? sessionId : UUID.randomUUID().toString(); - builder.addHeader("x-deepgram-session-id", sid); - } - - @Override - public AsyncDeepgramClient build() { - if (accessToken != null) { - // accessToken flow — set placeholder apiKey so parent doesn't NPE - super.apiKey("token"); - } else if (apiKeyValue == null) { - throw new RuntimeException( - "Please provide apiKey, accessToken, or set the DEEPGRAM_API_KEY environment variable."); - } - validateConfiguration(); - return new AsyncDeepgramClient(buildClientOptions()); - } -} diff --git a/src/main/java/DeepgramApiClient.java b/src/main/java/DeepgramApiClient.java deleted file mode 100644 index 03e0ac1..0000000 --- a/src/main/java/DeepgramApiClient.java +++ /dev/null @@ -1,72 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -import core.ClientOptions; -import core.Suppliers; -import java.util.function.Supplier; -import resources.agent.AgentClient; -import resources.auth.AuthClient; -import resources.listen.ListenClient; -import resources.manage.ManageClient; -import resources.read.ReadClient; -import resources.selfhosted.SelfHostedClient; -import resources.speak.SpeakClient; - -public class DeepgramApiClient { - protected final ClientOptions clientOptions; - - protected final Supplier agentClient; - - protected final Supplier authClient; - - protected final Supplier listenClient; - - protected final Supplier manageClient; - - protected final Supplier readClient; - - protected final Supplier selfHostedClient; - - protected final Supplier speakClient; - - public DeepgramApiClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.agentClient = Suppliers.memoize(() -> new AgentClient(clientOptions)); - this.authClient = Suppliers.memoize(() -> new AuthClient(clientOptions)); - this.listenClient = Suppliers.memoize(() -> new ListenClient(clientOptions)); - this.manageClient = Suppliers.memoize(() -> new ManageClient(clientOptions)); - this.readClient = Suppliers.memoize(() -> new ReadClient(clientOptions)); - this.selfHostedClient = Suppliers.memoize(() -> new SelfHostedClient(clientOptions)); - this.speakClient = Suppliers.memoize(() -> new SpeakClient(clientOptions)); - } - - public AgentClient agent() { - return this.agentClient.get(); - } - - public AuthClient auth() { - return this.authClient.get(); - } - - public ListenClient listen() { - return this.listenClient.get(); - } - - public ManageClient manage() { - return this.manageClient.get(); - } - - public ReadClient read() { - return this.readClient.get(); - } - - public SelfHostedClient selfHosted() { - return this.selfHostedClient.get(); - } - - public SpeakClient speak() { - return this.speakClient.get(); - } - - public static DeepgramApiClientBuilder builder() { - return new DeepgramApiClientBuilder(); - } -} diff --git a/src/main/java/DeepgramApiClientBuilder.java b/src/main/java/DeepgramApiClientBuilder.java deleted file mode 100644 index 9c2aedd..0000000 --- a/src/main/java/DeepgramApiClientBuilder.java +++ /dev/null @@ -1,208 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -import core.ClientOptions; -import core.Environment; -import core.LogConfig; -import java.util.HashMap; -import java.util.Map; -import java.util.Optional; -import okhttp3.OkHttpClient; - -public class DeepgramApiClientBuilder { - private Optional timeout = Optional.empty(); - - private Optional maxRetries = Optional.empty(); - - private final Map customHeaders = new HashMap<>(); - - private String apiKey = System.getenv("DEEPGRAM_API_KEY"); - - private Environment environment = Environment.PRODUCTION; - - private OkHttpClient httpClient; - - private Optional logging = Optional.empty(); - - /** Sets apiKey. Defaults to the DEEPGRAM_API_KEY environment variable. */ - public DeepgramApiClientBuilder apiKey(String apiKey) { - this.apiKey = apiKey; - return this; - } - - public DeepgramApiClientBuilder environment(Environment environment) { - this.environment = environment; - return this; - } - - /** Sets the timeout (in seconds) for the client. Defaults to 60 seconds. */ - public DeepgramApiClientBuilder timeout(int timeout) { - this.timeout = Optional.of(timeout); - return this; - } - - /** Sets the maximum number of retries for the client. Defaults to 2 retries. */ - public DeepgramApiClientBuilder maxRetries(int maxRetries) { - this.maxRetries = Optional.of(maxRetries); - return this; - } - - /** Sets the underlying OkHttp client */ - public DeepgramApiClientBuilder httpClient(OkHttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /** - * Configure logging for the SDK. Silent by default — no log output unless explicitly configured. - */ - public DeepgramApiClientBuilder logging(LogConfig logging) { - this.logging = Optional.of(logging); - return this; - } - - /** - * Add a custom header to be sent with all requests. For headers that need to be computed - * dynamically or conditionally, use the setAdditional() method override instead. - * - * @param name The header name - * @param value The header value - * @return This builder for method chaining - */ - public DeepgramApiClientBuilder addHeader(String name, String value) { - this.customHeaders.put(name, value); - return this; - } - - protected ClientOptions buildClientOptions() { - ClientOptions.Builder builder = ClientOptions.builder(); - setEnvironment(builder); - setAuthentication(builder); - setHttpClient(builder); - setTimeouts(builder); - setRetries(builder); - setLogging(builder); - for (Map.Entry header : this.customHeaders.entrySet()) { - builder.addHeader(header.getKey(), header.getValue()); - } - setAdditional(builder); - return builder.build(); - } - - /** - * Sets the environment configuration for the client. Override this method to modify URLs or add - * environment-specific logic. - * - * @param builder The ClientOptions.Builder to configure - */ - protected void setEnvironment(ClientOptions.Builder builder) { - builder.environment(this.environment); - } - - /** - * Override this method to customize authentication. This method is called during client options - * construction to set up authentication headers. - * - * @param builder The ClientOptions.Builder to configure - *

Example: - *

{@code
-   * @Override
-   * protected void setAuthentication(ClientOptions.Builder builder) {
-   *     super.setAuthentication(builder); // Keep existing auth
-   *     builder.addHeader("X-API-Key", this.apiKey);
-   * }
-   * }
- */ - protected void setAuthentication(ClientOptions.Builder builder) { - builder.addHeader("Authorization", "Token " + this.apiKey); - } - - /** - * Sets the request timeout configuration. Override this method to customize timeout behavior. - * - * @param builder The ClientOptions.Builder to configure - */ - protected void setTimeouts(ClientOptions.Builder builder) { - if (this.timeout.isPresent()) { - builder.timeout(this.timeout.get()); - } - } - - /** - * Sets the retry configuration for failed requests. Override this method to implement custom - * retry strategies. - * - * @param builder The ClientOptions.Builder to configure - */ - protected void setRetries(ClientOptions.Builder builder) { - if (this.maxRetries.isPresent()) { - builder.maxRetries(this.maxRetries.get()); - } - } - - /** - * Sets the OkHttp client configuration. Override this method to customize HTTP client behavior - * (interceptors, connection pools, etc). - * - * @param builder The ClientOptions.Builder to configure - */ - protected void setHttpClient(ClientOptions.Builder builder) { - if (this.httpClient != null) { - builder.httpClient(this.httpClient); - } - } - - /** - * Sets the logging configuration for the SDK. Override this method to customize logging behavior. - * - * @param builder The ClientOptions.Builder to configure - */ - protected void setLogging(ClientOptions.Builder builder) { - if (this.logging.isPresent()) { - builder.logging(this.logging.get()); - } - } - - /** - * Override this method to add any additional configuration to the client. This method is called - * at the end of the configuration chain, allowing you to add custom headers, modify settings, or - * perform any other client customization. - * - * @param builder The ClientOptions.Builder to configure - *

Example: - *

{@code
-   * @Override
-   * protected void setAdditional(ClientOptions.Builder builder) {
-   *     builder.addHeader("X-Request-ID", () -> UUID.randomUUID().toString());
-   *     builder.addHeader("X-Client-Version", "1.0.0");
-   * }
-   * }
- */ - protected void setAdditional(ClientOptions.Builder builder) {} - - /** - * Override this method to add custom validation logic before the client is built. This method is - * called at the beginning of the build() method to ensure the configuration is valid. Throw an - * exception to prevent client creation if validation fails. - * - *

Example: - * - *

{@code
-   * @Override
-   * protected void validateConfiguration() {
-   *     super.validateConfiguration(); // Run parent validations
-   *     if (tenantId == null || tenantId.isEmpty()) {
-   *         throw new IllegalStateException("tenantId is required");
-   *     }
-   * }
-   * }
- */ - protected void validateConfiguration() {} - - public DeepgramApiClient build() { - if (apiKey == null) { - throw new RuntimeException( - "Please provide apiKey or set the DEEPGRAM_API_KEY environment variable."); - } - validateConfiguration(); - return new DeepgramApiClient(buildClientOptions()); - } -} diff --git a/src/main/java/DeepgramClient.java b/src/main/java/DeepgramClient.java deleted file mode 100644 index a3e4ea2..0000000 --- a/src/main/java/DeepgramClient.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Custom Deepgram client extending the generated DeepgramApiClient. - * - *

This is the primary entry point for using the Deepgram Java SDK. It extends the generated - * client with additional features matching the Python and JavaScript SDKs: - * - *

    - *
  • Bearer token authentication via {@code accessToken()} - *
  • Automatic session ID header via {@code sessionId()} - *
  • Renamed from DeepgramApiClient to match JS/Python naming - *
- * - *

Usage with API key (default): - * - *

{@code
- * DeepgramClient client = DeepgramClient.builder()
- *     .apiKey("your-api-key")
- *     .build();
- * }
- * - *

Usage with access token (Bearer auth): - * - *

{@code
- * DeepgramClient client = DeepgramClient.builder()
- *     .accessToken("your-jwt-token")
- *     .build();
- * }
- */ -import core.ClientOptions; - -public class DeepgramClient extends DeepgramApiClient { - public DeepgramClient(ClientOptions clientOptions) { - super(clientOptions); - } - - public static DeepgramClientBuilder builder() { - return new DeepgramClientBuilder(); - } -} diff --git a/src/main/java/DeepgramClientBuilder.java b/src/main/java/DeepgramClientBuilder.java deleted file mode 100644 index d39d048..0000000 --- a/src/main/java/DeepgramClientBuilder.java +++ /dev/null @@ -1,116 +0,0 @@ -/** - * Custom client builder extending the generated DeepgramApiClientBuilder. - * - *

Adds support for: - * - *

    - *
  • {@code accessToken} — Alternative to {@code apiKey}. Uses Bearer token authentication. If - * provided, takes precedence over apiKey for the Authorization header. - *
  • {@code sessionId} — Session identifier sent as {@code x-deepgram-session-id} header. If not - * provided, a UUID is auto-generated. - *
- */ -import core.ClientOptions; -import core.Environment; -import core.LogConfig; -import java.util.UUID; -import okhttp3.OkHttpClient; - -public class DeepgramClientBuilder extends DeepgramApiClientBuilder { - private String accessToken; - - private String sessionId; - - private String apiKeyValue = System.getenv("DEEPGRAM_API_KEY"); - - /** - * Sets an access token (JWT) for Bearer authentication. If provided, this takes precedence over - * apiKey and sets the Authorization header to {@code Bearer }. - */ - public DeepgramClientBuilder accessToken(String accessToken) { - this.accessToken = accessToken; - return this; - } - - /** - * Sets a session identifier sent as the {@code x-deepgram-session-id} header with every request - * and WebSocket connection. If not provided, a UUID is auto-generated. - */ - public DeepgramClientBuilder sessionId(String sessionId) { - this.sessionId = sessionId; - return this; - } - - // Override parent methods to return DeepgramClientBuilder for fluent chaining - - @Override - public DeepgramClientBuilder apiKey(String apiKey) { - this.apiKeyValue = apiKey; - super.apiKey(apiKey); - return this; - } - - @Override - public DeepgramClientBuilder environment(Environment environment) { - super.environment(environment); - return this; - } - - @Override - public DeepgramClientBuilder timeout(int timeout) { - super.timeout(timeout); - return this; - } - - @Override - public DeepgramClientBuilder maxRetries(int maxRetries) { - super.maxRetries(maxRetries); - return this; - } - - @Override - public DeepgramClientBuilder httpClient(OkHttpClient httpClient) { - super.httpClient(httpClient); - return this; - } - - @Override - public DeepgramClientBuilder logging(LogConfig logging) { - super.logging(logging); - return this; - } - - @Override - public DeepgramClientBuilder addHeader(String name, String value) { - super.addHeader(name, value); - return this; - } - - @Override - protected void setAuthentication(ClientOptions.Builder builder) { - if (accessToken != null) { - builder.addHeader("Authorization", "Bearer " + accessToken); - } else { - super.setAuthentication(builder); - } - } - - @Override - protected void setAdditional(ClientOptions.Builder builder) { - String sid = (sessionId != null) ? sessionId : UUID.randomUUID().toString(); - builder.addHeader("x-deepgram-session-id", sid); - } - - @Override - public DeepgramClient build() { - if (accessToken != null) { - // accessToken flow — set placeholder apiKey so parent doesn't NPE - super.apiKey("token"); - } else if (apiKeyValue == null) { - throw new RuntimeException( - "Please provide apiKey, accessToken, or set the DEEPGRAM_API_KEY environment variable."); - } - validateConfiguration(); - return new DeepgramClient(buildClientOptions()); - } -} diff --git a/src/main/java/com/deepgram/AsyncDeepgramApiClient.java b/src/main/java/com/deepgram/AsyncDeepgramApiClient.java new file mode 100644 index 0000000..d504345 --- /dev/null +++ b/src/main/java/com/deepgram/AsyncDeepgramApiClient.java @@ -0,0 +1,76 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.Suppliers; +import com.deepgram.resources.agent.AsyncAgentClient; +import com.deepgram.resources.auth.AsyncAuthClient; +import com.deepgram.resources.listen.AsyncListenClient; +import com.deepgram.resources.manage.AsyncManageClient; +import com.deepgram.resources.read.AsyncReadClient; +import com.deepgram.resources.selfhosted.AsyncSelfHostedClient; +import com.deepgram.resources.speak.AsyncSpeakClient; +import java.util.function.Supplier; + +public class AsyncDeepgramApiClient { + protected final ClientOptions clientOptions; + + protected final Supplier agentClient; + + protected final Supplier authClient; + + protected final Supplier listenClient; + + protected final Supplier manageClient; + + protected final Supplier readClient; + + protected final Supplier selfHostedClient; + + protected final Supplier speakClient; + + public AsyncDeepgramApiClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.agentClient = Suppliers.memoize(() -> new AsyncAgentClient(clientOptions)); + this.authClient = Suppliers.memoize(() -> new AsyncAuthClient(clientOptions)); + this.listenClient = Suppliers.memoize(() -> new AsyncListenClient(clientOptions)); + this.manageClient = Suppliers.memoize(() -> new AsyncManageClient(clientOptions)); + this.readClient = Suppliers.memoize(() -> new AsyncReadClient(clientOptions)); + this.selfHostedClient = Suppliers.memoize(() -> new AsyncSelfHostedClient(clientOptions)); + this.speakClient = Suppliers.memoize(() -> new AsyncSpeakClient(clientOptions)); + } + + public AsyncAgentClient agent() { + return this.agentClient.get(); + } + + public AsyncAuthClient auth() { + return this.authClient.get(); + } + + public AsyncListenClient listen() { + return this.listenClient.get(); + } + + public AsyncManageClient manage() { + return this.manageClient.get(); + } + + public AsyncReadClient read() { + return this.readClient.get(); + } + + public AsyncSelfHostedClient selfHosted() { + return this.selfHostedClient.get(); + } + + public AsyncSpeakClient speak() { + return this.speakClient.get(); + } + + public static AsyncDeepgramApiClientBuilder builder() { + return new AsyncDeepgramApiClientBuilder(); + } +} diff --git a/src/main/java/com/deepgram/AsyncDeepgramApiClientBuilder.java b/src/main/java/com/deepgram/AsyncDeepgramApiClientBuilder.java new file mode 100644 index 0000000..35f7792 --- /dev/null +++ b/src/main/java/com/deepgram/AsyncDeepgramApiClientBuilder.java @@ -0,0 +1,223 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.Environment; +import com.deepgram.core.LogConfig; +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; +import okhttp3.OkHttpClient; + +public class AsyncDeepgramApiClientBuilder { + private Optional timeout = Optional.empty(); + + private Optional maxRetries = Optional.empty(); + + private final Map customHeaders = new HashMap<>(); + + private String apiKey = System.getenv("DEEPGRAM_API_KEY"); + + private Environment environment = Environment.PRODUCTION; + + private OkHttpClient httpClient; + + private Optional logging = Optional.empty(); + + /** + * Sets apiKey. + * Defaults to the DEEPGRAM_API_KEY environment variable. + */ + public AsyncDeepgramApiClientBuilder apiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + public AsyncDeepgramApiClientBuilder environment(Environment environment) { + this.environment = environment; + return this; + } + + /** + * Sets the timeout (in seconds) for the client. Defaults to 60 seconds. + */ + public AsyncDeepgramApiClientBuilder timeout(int timeout) { + this.timeout = Optional.of(timeout); + return this; + } + + /** + * Sets the maximum number of retries for the client. Defaults to 2 retries. + */ + public AsyncDeepgramApiClientBuilder maxRetries(int maxRetries) { + this.maxRetries = Optional.of(maxRetries); + return this; + } + + /** + * Sets the underlying OkHttp client + */ + public AsyncDeepgramApiClientBuilder httpClient(OkHttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /** + * Configure logging for the SDK. Silent by default — no log output unless explicitly configured. + */ + public AsyncDeepgramApiClientBuilder logging(LogConfig logging) { + this.logging = Optional.of(logging); + return this; + } + + /** + * Add a custom header to be sent with all requests. + * For headers that need to be computed dynamically or conditionally, use the setAdditional() method override instead. + * + * @param name The header name + * @param value The header value + * @return This builder for method chaining + */ + public AsyncDeepgramApiClientBuilder addHeader(String name, String value) { + this.customHeaders.put(name, value); + return this; + } + + protected ClientOptions buildClientOptions() { + ClientOptions.Builder builder = ClientOptions.builder(); + setEnvironment(builder); + setAuthentication(builder); + setHttpClient(builder); + setTimeouts(builder); + setRetries(builder); + setLogging(builder); + for (Map.Entry header : this.customHeaders.entrySet()) { + builder.addHeader(header.getKey(), header.getValue()); + } + setAdditional(builder); + return builder.build(); + } + + /** + * Sets the environment configuration for the client. + * Override this method to modify URLs or add environment-specific logic. + * + * @param builder The ClientOptions.Builder to configure + */ + protected void setEnvironment(ClientOptions.Builder builder) { + builder.environment(this.environment); + } + + /** + * Override this method to customize authentication. + * This method is called during client options construction to set up authentication headers. + * + * @param builder The ClientOptions.Builder to configure + * + * Example: + *
{@code
+     * @Override
+     * protected void setAuthentication(ClientOptions.Builder builder) {
+     *     super.setAuthentication(builder); // Keep existing auth
+     *     builder.addHeader("X-API-Key", this.apiKey);
+     * }
+     * }
+ */ + protected void setAuthentication(ClientOptions.Builder builder) { + builder.addHeader("Authorization", "Token " + this.apiKey); + } + + /** + * Sets the request timeout configuration. + * Override this method to customize timeout behavior. + * + * @param builder The ClientOptions.Builder to configure + */ + protected void setTimeouts(ClientOptions.Builder builder) { + if (this.timeout.isPresent()) { + builder.timeout(this.timeout.get()); + } + } + + /** + * Sets the retry configuration for failed requests. + * Override this method to implement custom retry strategies. + * + * @param builder The ClientOptions.Builder to configure + */ + protected void setRetries(ClientOptions.Builder builder) { + if (this.maxRetries.isPresent()) { + builder.maxRetries(this.maxRetries.get()); + } + } + + /** + * Sets the OkHttp client configuration. + * Override this method to customize HTTP client behavior (interceptors, connection pools, etc). + * + * @param builder The ClientOptions.Builder to configure + */ + protected void setHttpClient(ClientOptions.Builder builder) { + if (this.httpClient != null) { + builder.httpClient(this.httpClient); + } + } + + /** + * Sets the logging configuration for the SDK. + * Override this method to customize logging behavior. + * + * @param builder The ClientOptions.Builder to configure + */ + protected void setLogging(ClientOptions.Builder builder) { + if (this.logging.isPresent()) { + builder.logging(this.logging.get()); + } + } + + /** + * Override this method to add any additional configuration to the client. + * This method is called at the end of the configuration chain, allowing you to add + * custom headers, modify settings, or perform any other client customization. + * + * @param builder The ClientOptions.Builder to configure + * + * Example: + *
{@code
+     * @Override
+     * protected void setAdditional(ClientOptions.Builder builder) {
+     *     builder.addHeader("X-Request-ID", () -> UUID.randomUUID().toString());
+     *     builder.addHeader("X-Client-Version", "1.0.0");
+     * }
+     * }
+ */ + protected void setAdditional(ClientOptions.Builder builder) {} + + /** + * Override this method to add custom validation logic before the client is built. + * This method is called at the beginning of the build() method to ensure the configuration is valid. + * Throw an exception to prevent client creation if validation fails. + * + * Example: + *
{@code
+     * @Override
+     * protected void validateConfiguration() {
+     *     super.validateConfiguration(); // Run parent validations
+     *     if (tenantId == null || tenantId.isEmpty()) {
+     *         throw new IllegalStateException("tenantId is required");
+     *     }
+     * }
+     * }
+ */ + protected void validateConfiguration() {} + + public AsyncDeepgramApiClient build() { + if (apiKey == null) { + throw new RuntimeException("Please provide apiKey or set the DEEPGRAM_API_KEY environment variable."); + } + validateConfiguration(); + return new AsyncDeepgramApiClient(buildClientOptions()); + } +} diff --git a/src/main/java/com/deepgram/AsyncDeepgramClient.java b/src/main/java/com/deepgram/AsyncDeepgramClient.java new file mode 100644 index 0000000..185c556 --- /dev/null +++ b/src/main/java/com/deepgram/AsyncDeepgramClient.java @@ -0,0 +1,16 @@ +package com.deepgram; + +/** + * Async version of {@link DeepgramClient}. Extends the generated AsyncDeepgramApiClient with the same custom features. + */ +import com.deepgram.core.ClientOptions; + +public class AsyncDeepgramClient extends AsyncDeepgramApiClient { + public AsyncDeepgramClient(ClientOptions clientOptions) { + super(clientOptions); + } + + public static AsyncDeepgramClientBuilder builder() { + return new AsyncDeepgramClientBuilder(); + } +} diff --git a/src/main/java/com/deepgram/AsyncDeepgramClientBuilder.java b/src/main/java/com/deepgram/AsyncDeepgramClientBuilder.java new file mode 100644 index 0000000..e318624 --- /dev/null +++ b/src/main/java/com/deepgram/AsyncDeepgramClientBuilder.java @@ -0,0 +1,119 @@ +package com.deepgram; + +/** + * Async version of {@link DeepgramClientBuilder}. Extends the generated AsyncDeepgramApiClientBuilder with the same + * custom features. + * + *

Adds support for: + * + *

    + *
  • {@code accessToken} — Alternative to {@code apiKey}. Uses Bearer token authentication. If provided, takes + * precedence over apiKey for the Authorization header. + *
  • {@code sessionId} — Session identifier sent as {@code x-deepgram-session-id} header. If not provided, a UUID is + * auto-generated. + *
+ */ +import com.deepgram.core.ClientOptions; +import com.deepgram.core.Environment; +import com.deepgram.core.LogConfig; +import java.util.UUID; +import okhttp3.OkHttpClient; + +public class AsyncDeepgramClientBuilder extends AsyncDeepgramApiClientBuilder { + private String accessToken; + + private String sessionId; + + private String apiKeyValue = System.getenv("DEEPGRAM_API_KEY"); + + /** + * Sets an access token (JWT) for Bearer authentication. If provided, this takes precedence over apiKey and sets the + * Authorization header to {@code Bearer }. + */ + public AsyncDeepgramClientBuilder accessToken(String accessToken) { + this.accessToken = accessToken; + return this; + } + + /** + * Sets a session identifier sent as the {@code x-deepgram-session-id} header with every request and WebSocket + * connection. If not provided, a UUID is auto-generated. + */ + public AsyncDeepgramClientBuilder sessionId(String sessionId) { + this.sessionId = sessionId; + return this; + } + + // Override parent methods to return AsyncDeepgramClientBuilder for fluent chaining + + @Override + public AsyncDeepgramClientBuilder apiKey(String apiKey) { + this.apiKeyValue = apiKey; + super.apiKey(apiKey); + return this; + } + + @Override + public AsyncDeepgramClientBuilder environment(Environment environment) { + super.environment(environment); + return this; + } + + @Override + public AsyncDeepgramClientBuilder timeout(int timeout) { + super.timeout(timeout); + return this; + } + + @Override + public AsyncDeepgramClientBuilder maxRetries(int maxRetries) { + super.maxRetries(maxRetries); + return this; + } + + @Override + public AsyncDeepgramClientBuilder httpClient(OkHttpClient httpClient) { + super.httpClient(httpClient); + return this; + } + + @Override + public AsyncDeepgramClientBuilder logging(LogConfig logging) { + super.logging(logging); + return this; + } + + @Override + public AsyncDeepgramClientBuilder addHeader(String name, String value) { + super.addHeader(name, value); + return this; + } + + @Override + protected void setAuthentication(ClientOptions.Builder builder) { + if (accessToken != null) { + builder.addHeader("Authorization", "Bearer " + accessToken); + } else { + super.setAuthentication(builder); + } + } + + @Override + protected void setAdditional(ClientOptions.Builder builder) { + String sid = (sessionId != null) ? sessionId : UUID.randomUUID().toString(); + builder.addHeader("x-deepgram-session-id", sid); + } + + @Override + public AsyncDeepgramClient build() { + if (accessToken != null) { + // accessToken flow — set placeholder apiKey so parent doesn't NPE + super.apiKey("token"); + } else if (apiKeyValue == null) { + throw new RuntimeException( + "Please provide apiKey, accessToken, or set the DEEPGRAM_API_KEY environment variable."); + } + validateConfiguration(); + return new AsyncDeepgramClient(buildClientOptions()); + } +} diff --git a/src/main/java/com/deepgram/DeepgramApiClient.java b/src/main/java/com/deepgram/DeepgramApiClient.java new file mode 100644 index 0000000..b62f6a7 --- /dev/null +++ b/src/main/java/com/deepgram/DeepgramApiClient.java @@ -0,0 +1,76 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.Suppliers; +import com.deepgram.resources.agent.AgentClient; +import com.deepgram.resources.auth.AuthClient; +import com.deepgram.resources.listen.ListenClient; +import com.deepgram.resources.manage.ManageClient; +import com.deepgram.resources.read.ReadClient; +import com.deepgram.resources.selfhosted.SelfHostedClient; +import com.deepgram.resources.speak.SpeakClient; +import java.util.function.Supplier; + +public class DeepgramApiClient { + protected final ClientOptions clientOptions; + + protected final Supplier agentClient; + + protected final Supplier authClient; + + protected final Supplier listenClient; + + protected final Supplier manageClient; + + protected final Supplier readClient; + + protected final Supplier selfHostedClient; + + protected final Supplier speakClient; + + public DeepgramApiClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.agentClient = Suppliers.memoize(() -> new AgentClient(clientOptions)); + this.authClient = Suppliers.memoize(() -> new AuthClient(clientOptions)); + this.listenClient = Suppliers.memoize(() -> new ListenClient(clientOptions)); + this.manageClient = Suppliers.memoize(() -> new ManageClient(clientOptions)); + this.readClient = Suppliers.memoize(() -> new ReadClient(clientOptions)); + this.selfHostedClient = Suppliers.memoize(() -> new SelfHostedClient(clientOptions)); + this.speakClient = Suppliers.memoize(() -> new SpeakClient(clientOptions)); + } + + public AgentClient agent() { + return this.agentClient.get(); + } + + public AuthClient auth() { + return this.authClient.get(); + } + + public ListenClient listen() { + return this.listenClient.get(); + } + + public ManageClient manage() { + return this.manageClient.get(); + } + + public ReadClient read() { + return this.readClient.get(); + } + + public SelfHostedClient selfHosted() { + return this.selfHostedClient.get(); + } + + public SpeakClient speak() { + return this.speakClient.get(); + } + + public static DeepgramApiClientBuilder builder() { + return new DeepgramApiClientBuilder(); + } +} diff --git a/src/main/java/com/deepgram/DeepgramApiClientBuilder.java b/src/main/java/com/deepgram/DeepgramApiClientBuilder.java new file mode 100644 index 0000000..b6060d1 --- /dev/null +++ b/src/main/java/com/deepgram/DeepgramApiClientBuilder.java @@ -0,0 +1,223 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.Environment; +import com.deepgram.core.LogConfig; +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; +import okhttp3.OkHttpClient; + +public class DeepgramApiClientBuilder { + private Optional timeout = Optional.empty(); + + private Optional maxRetries = Optional.empty(); + + private final Map customHeaders = new HashMap<>(); + + private String apiKey = System.getenv("DEEPGRAM_API_KEY"); + + private Environment environment = Environment.PRODUCTION; + + private OkHttpClient httpClient; + + private Optional logging = Optional.empty(); + + /** + * Sets apiKey. + * Defaults to the DEEPGRAM_API_KEY environment variable. + */ + public DeepgramApiClientBuilder apiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + public DeepgramApiClientBuilder environment(Environment environment) { + this.environment = environment; + return this; + } + + /** + * Sets the timeout (in seconds) for the client. Defaults to 60 seconds. + */ + public DeepgramApiClientBuilder timeout(int timeout) { + this.timeout = Optional.of(timeout); + return this; + } + + /** + * Sets the maximum number of retries for the client. Defaults to 2 retries. + */ + public DeepgramApiClientBuilder maxRetries(int maxRetries) { + this.maxRetries = Optional.of(maxRetries); + return this; + } + + /** + * Sets the underlying OkHttp client + */ + public DeepgramApiClientBuilder httpClient(OkHttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /** + * Configure logging for the SDK. Silent by default — no log output unless explicitly configured. + */ + public DeepgramApiClientBuilder logging(LogConfig logging) { + this.logging = Optional.of(logging); + return this; + } + + /** + * Add a custom header to be sent with all requests. + * For headers that need to be computed dynamically or conditionally, use the setAdditional() method override instead. + * + * @param name The header name + * @param value The header value + * @return This builder for method chaining + */ + public DeepgramApiClientBuilder addHeader(String name, String value) { + this.customHeaders.put(name, value); + return this; + } + + protected ClientOptions buildClientOptions() { + ClientOptions.Builder builder = ClientOptions.builder(); + setEnvironment(builder); + setAuthentication(builder); + setHttpClient(builder); + setTimeouts(builder); + setRetries(builder); + setLogging(builder); + for (Map.Entry header : this.customHeaders.entrySet()) { + builder.addHeader(header.getKey(), header.getValue()); + } + setAdditional(builder); + return builder.build(); + } + + /** + * Sets the environment configuration for the client. + * Override this method to modify URLs or add environment-specific logic. + * + * @param builder The ClientOptions.Builder to configure + */ + protected void setEnvironment(ClientOptions.Builder builder) { + builder.environment(this.environment); + } + + /** + * Override this method to customize authentication. + * This method is called during client options construction to set up authentication headers. + * + * @param builder The ClientOptions.Builder to configure + * + * Example: + *
{@code
+     * @Override
+     * protected void setAuthentication(ClientOptions.Builder builder) {
+     *     super.setAuthentication(builder); // Keep existing auth
+     *     builder.addHeader("X-API-Key", this.apiKey);
+     * }
+     * }
+ */ + protected void setAuthentication(ClientOptions.Builder builder) { + builder.addHeader("Authorization", "Token " + this.apiKey); + } + + /** + * Sets the request timeout configuration. + * Override this method to customize timeout behavior. + * + * @param builder The ClientOptions.Builder to configure + */ + protected void setTimeouts(ClientOptions.Builder builder) { + if (this.timeout.isPresent()) { + builder.timeout(this.timeout.get()); + } + } + + /** + * Sets the retry configuration for failed requests. + * Override this method to implement custom retry strategies. + * + * @param builder The ClientOptions.Builder to configure + */ + protected void setRetries(ClientOptions.Builder builder) { + if (this.maxRetries.isPresent()) { + builder.maxRetries(this.maxRetries.get()); + } + } + + /** + * Sets the OkHttp client configuration. + * Override this method to customize HTTP client behavior (interceptors, connection pools, etc). + * + * @param builder The ClientOptions.Builder to configure + */ + protected void setHttpClient(ClientOptions.Builder builder) { + if (this.httpClient != null) { + builder.httpClient(this.httpClient); + } + } + + /** + * Sets the logging configuration for the SDK. + * Override this method to customize logging behavior. + * + * @param builder The ClientOptions.Builder to configure + */ + protected void setLogging(ClientOptions.Builder builder) { + if (this.logging.isPresent()) { + builder.logging(this.logging.get()); + } + } + + /** + * Override this method to add any additional configuration to the client. + * This method is called at the end of the configuration chain, allowing you to add + * custom headers, modify settings, or perform any other client customization. + * + * @param builder The ClientOptions.Builder to configure + * + * Example: + *
{@code
+     * @Override
+     * protected void setAdditional(ClientOptions.Builder builder) {
+     *     builder.addHeader("X-Request-ID", () -> UUID.randomUUID().toString());
+     *     builder.addHeader("X-Client-Version", "1.0.0");
+     * }
+     * }
+ */ + protected void setAdditional(ClientOptions.Builder builder) {} + + /** + * Override this method to add custom validation logic before the client is built. + * This method is called at the beginning of the build() method to ensure the configuration is valid. + * Throw an exception to prevent client creation if validation fails. + * + * Example: + *
{@code
+     * @Override
+     * protected void validateConfiguration() {
+     *     super.validateConfiguration(); // Run parent validations
+     *     if (tenantId == null || tenantId.isEmpty()) {
+     *         throw new IllegalStateException("tenantId is required");
+     *     }
+     * }
+     * }
+ */ + protected void validateConfiguration() {} + + public DeepgramApiClient build() { + if (apiKey == null) { + throw new RuntimeException("Please provide apiKey or set the DEEPGRAM_API_KEY environment variable."); + } + validateConfiguration(); + return new DeepgramApiClient(buildClientOptions()); + } +} diff --git a/src/main/java/com/deepgram/DeepgramClient.java b/src/main/java/com/deepgram/DeepgramClient.java new file mode 100644 index 0000000..96b08c0 --- /dev/null +++ b/src/main/java/com/deepgram/DeepgramClient.java @@ -0,0 +1,41 @@ +package com.deepgram; + +/** + * Custom Deepgram client extending the generated DeepgramApiClient. + * + *

This is the primary entry point for using the Deepgram Java SDK. It extends the generated client with additional + * features matching the Python and JavaScript SDKs: + * + *

    + *
  • Bearer token authentication via {@code accessToken()} + *
  • Automatic session ID header via {@code sessionId()} + *
  • Renamed from DeepgramApiClient to match JS/Python naming + *
+ * + *

Usage with API key (default): + * + *

{@code
+ * DeepgramClient client = DeepgramClient.builder()
+ *     .apiKey("your-api-key")
+ *     .build();
+ * }
+ * + *

Usage with access token (Bearer auth): + * + *

{@code
+ * DeepgramClient client = DeepgramClient.builder()
+ *     .accessToken("your-jwt-token")
+ *     .build();
+ * }
+ */ +import com.deepgram.core.ClientOptions; + +public class DeepgramClient extends DeepgramApiClient { + public DeepgramClient(ClientOptions clientOptions) { + super(clientOptions); + } + + public static DeepgramClientBuilder builder() { + return new DeepgramClientBuilder(); + } +} diff --git a/src/main/java/com/deepgram/DeepgramClientBuilder.java b/src/main/java/com/deepgram/DeepgramClientBuilder.java new file mode 100644 index 0000000..bf803db --- /dev/null +++ b/src/main/java/com/deepgram/DeepgramClientBuilder.java @@ -0,0 +1,118 @@ +package com.deepgram; + +/** + * Custom client builder extending the generated DeepgramApiClientBuilder. + * + *

Adds support for: + * + *

    + *
  • {@code accessToken} — Alternative to {@code apiKey}. Uses Bearer token authentication. If provided, takes + * precedence over apiKey for the Authorization header. + *
  • {@code sessionId} — Session identifier sent as {@code x-deepgram-session-id} header. If not provided, a UUID is + * auto-generated. + *
+ */ +import com.deepgram.core.ClientOptions; +import com.deepgram.core.Environment; +import com.deepgram.core.LogConfig; +import java.util.UUID; +import okhttp3.OkHttpClient; + +public class DeepgramClientBuilder extends DeepgramApiClientBuilder { + private String accessToken; + + private String sessionId; + + private String apiKeyValue = System.getenv("DEEPGRAM_API_KEY"); + + /** + * Sets an access token (JWT) for Bearer authentication. If provided, this takes precedence over apiKey and sets the + * Authorization header to {@code Bearer }. + */ + public DeepgramClientBuilder accessToken(String accessToken) { + this.accessToken = accessToken; + return this; + } + + /** + * Sets a session identifier sent as the {@code x-deepgram-session-id} header with every request and WebSocket + * connection. If not provided, a UUID is auto-generated. + */ + public DeepgramClientBuilder sessionId(String sessionId) { + this.sessionId = sessionId; + return this; + } + + // Override parent methods to return DeepgramClientBuilder for fluent chaining + + @Override + public DeepgramClientBuilder apiKey(String apiKey) { + this.apiKeyValue = apiKey; + super.apiKey(apiKey); + return this; + } + + @Override + public DeepgramClientBuilder environment(Environment environment) { + super.environment(environment); + return this; + } + + @Override + public DeepgramClientBuilder timeout(int timeout) { + super.timeout(timeout); + return this; + } + + @Override + public DeepgramClientBuilder maxRetries(int maxRetries) { + super.maxRetries(maxRetries); + return this; + } + + @Override + public DeepgramClientBuilder httpClient(OkHttpClient httpClient) { + super.httpClient(httpClient); + return this; + } + + @Override + public DeepgramClientBuilder logging(LogConfig logging) { + super.logging(logging); + return this; + } + + @Override + public DeepgramClientBuilder addHeader(String name, String value) { + super.addHeader(name, value); + return this; + } + + @Override + protected void setAuthentication(ClientOptions.Builder builder) { + if (accessToken != null) { + builder.addHeader("Authorization", "Bearer " + accessToken); + } else { + super.setAuthentication(builder); + } + } + + @Override + protected void setAdditional(ClientOptions.Builder builder) { + String sid = (sessionId != null) ? sessionId : UUID.randomUUID().toString(); + builder.addHeader("x-deepgram-session-id", sid); + } + + @Override + public DeepgramClient build() { + if (accessToken != null) { + // accessToken flow — set placeholder apiKey so parent doesn't NPE + super.apiKey("token"); + } else if (apiKeyValue == null) { + throw new RuntimeException( + "Please provide apiKey, accessToken, or set the DEEPGRAM_API_KEY environment variable."); + } + validateConfiguration(); + return new DeepgramClient(buildClientOptions()); + } +} diff --git a/src/main/java/com/deepgram/core/ClientOptions.java b/src/main/java/com/deepgram/core/ClientOptions.java new file mode 100644 index 0000000..101d92a --- /dev/null +++ b/src/main/java/com/deepgram/core/ClientOptions.java @@ -0,0 +1,241 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.core; + +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; +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 final int timeout; + + private final int maxRetries; + + private final Optional webSocketFactory; + + private final Optional logging; + + private ClientOptions( + Environment environment, + Map headers, + Map> headerSuppliers, + OkHttpClient httpClient, + int timeout, + int maxRetries, + Optional webSocketFactory, + Optional logging) { + this.environment = environment; + this.headers = new HashMap<>(); + this.headers.putAll(headers); + this.headers.putAll(new HashMap() { + { + put("User-Agent", "com.deepgram:deepgram-java-sdk/0.1.0"); + put("X-Fern-Language", "JAVA"); + put("X-Fern-SDK-Name", "com.deepgram:deepgram-java-sdk"); + put("X-Fern-SDK-Version", "0.1.0"); + } + }); + this.headerSuppliers = headerSuppliers; + this.httpClient = httpClient; + this.timeout = timeout; + this.maxRetries = maxRetries; + this.webSocketFactory = webSocketFactory; + this.logging = logging; + } + + 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 int timeout(RequestOptions requestOptions) { + if (requestOptions == null) { + return this.timeout; + } + return requestOptions.getTimeout().orElse(this.timeout); + } + + 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 int maxRetries() { + return this.maxRetries; + } + + public Optional webSocketFactory() { + return this.webSocketFactory; + } + + public Optional logging() { + return this.logging; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private Environment environment; + + private final Map headers = new HashMap<>(); + + private final Map> headerSuppliers = new HashMap<>(); + + private int maxRetries = 2; + + private Optional timeout = Optional.empty(); + + private OkHttpClient httpClient = null; + + private Optional logging = Optional.empty(); + + private Optional webSocketFactory = Optional.empty(); + + 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; + } + + /** + * Override the timeout in seconds. Defaults to 60 seconds. + */ + public Builder timeout(int timeout) { + this.timeout = Optional.of(timeout); + return this; + } + + /** + * Override the timeout in seconds. Defaults to 60 seconds. + */ + public Builder timeout(Optional timeout) { + this.timeout = timeout; + return this; + } + + /** + * Override the maximum number of retries. Defaults to 2 retries. + */ + public Builder maxRetries(int maxRetries) { + this.maxRetries = maxRetries; + return this; + } + + public Builder httpClient(OkHttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /** + * Set a custom WebSocketFactory for creating WebSocket connections. + */ + public Builder webSocketFactory(WebSocketFactory webSocketFactory) { + this.webSocketFactory = Optional.of(webSocketFactory); + return this; + } + + /** + * Configure logging for the SDK. Silent by default — no log output unless explicitly configured. + */ + public Builder logging(LogConfig logging) { + this.logging = Optional.of(logging); + return this; + } + + public ClientOptions build() { + OkHttpClient.Builder httpClientBuilder = + this.httpClient != null ? this.httpClient.newBuilder() : new OkHttpClient.Builder(); + + if (this.httpClient != null) { + timeout.ifPresent(timeout -> httpClientBuilder + .callTimeout(timeout, TimeUnit.SECONDS) + .connectTimeout(0, TimeUnit.SECONDS) + .writeTimeout(0, TimeUnit.SECONDS) + .readTimeout(0, TimeUnit.SECONDS)); + } else { + httpClientBuilder + .callTimeout(this.timeout.orElse(60), TimeUnit.SECONDS) + .connectTimeout(0, TimeUnit.SECONDS) + .writeTimeout(0, TimeUnit.SECONDS) + .readTimeout(0, TimeUnit.SECONDS) + .addInterceptor(new RetryInterceptor(this.maxRetries)); + } + + Logger logger = Logger.from(this.logging); + httpClientBuilder.addInterceptor(new LoggingInterceptor(logger)); + + this.httpClient = httpClientBuilder.build(); + this.timeout = Optional.of(httpClient.callTimeoutMillis() / 1000); + + return new ClientOptions( + environment, + headers, + headerSuppliers, + httpClient, + this.timeout.get(), + this.maxRetries, + this.webSocketFactory, + this.logging); + } + + /** + * Create a new Builder initialized with values from an existing ClientOptions + */ + public static Builder from(ClientOptions clientOptions) { + Builder builder = new Builder(); + builder.environment = clientOptions.environment(); + builder.timeout = Optional.of(clientOptions.timeout(null)); + builder.httpClient = clientOptions.httpClient(); + builder.headers.putAll(clientOptions.headers); + builder.headerSuppliers.putAll(clientOptions.headerSuppliers); + builder.maxRetries = clientOptions.maxRetries(); + builder.logging = clientOptions.logging(); + return builder; + } + } +} diff --git a/src/main/java/com/deepgram/core/ConsoleLogger.java b/src/main/java/com/deepgram/core/ConsoleLogger.java new file mode 100644 index 0000000..a0b46a9 --- /dev/null +++ b/src/main/java/com/deepgram/core/ConsoleLogger.java @@ -0,0 +1,51 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.core; + +import java.util.logging.Level; + +/** + * Default logger implementation that writes to the console using {@link java.util.logging.Logger}. + * + *

Uses the "fern" logger name with a simple format of "LEVEL - message". + */ +public final class ConsoleLogger implements ILogger { + + private static final java.util.logging.Logger logger = java.util.logging.Logger.getLogger("fern"); + + static { + if (logger.getHandlers().length == 0) { + java.util.logging.ConsoleHandler handler = new java.util.logging.ConsoleHandler(); + handler.setFormatter(new java.util.logging.SimpleFormatter() { + @Override + public String format(java.util.logging.LogRecord record) { + return record.getLevel() + " - " + record.getMessage() + System.lineSeparator(); + } + }); + logger.addHandler(handler); + logger.setUseParentHandlers(false); + logger.setLevel(Level.ALL); + } + } + + @Override + public void debug(String message) { + logger.log(Level.FINE, message); + } + + @Override + public void info(String message) { + logger.log(Level.INFO, message); + } + + @Override + public void warn(String message) { + logger.log(Level.WARNING, message); + } + + @Override + public void error(String message) { + logger.log(Level.SEVERE, message); + } +} diff --git a/src/main/java/com/deepgram/core/DateTimeDeserializer.java b/src/main/java/com/deepgram/core/DateTimeDeserializer.java new file mode 100644 index 0000000..6eccd67 --- /dev/null +++ b/src/main/java/com/deepgram/core/DateTimeDeserializer.java @@ -0,0 +1,55 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.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/deepgram/core/DeepgramApiApiException.java b/src/main/java/com/deepgram/core/DeepgramApiApiException.java new file mode 100644 index 0000000..1948db1 --- /dev/null +++ b/src/main/java/com/deepgram/core/DeepgramApiApiException.java @@ -0,0 +1,73 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.core; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import okhttp3.Response; + +/** + * This exception type will be thrown for any non-2XX API responses. + */ +public class DeepgramApiApiException extends DeepgramApiException { + /** + * 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; + + private final Map> headers; + + public DeepgramApiApiException(String message, int statusCode, Object body) { + super(message); + this.statusCode = statusCode; + this.body = body; + this.headers = new HashMap<>(); + } + + public DeepgramApiApiException(String message, int statusCode, Object body, Response rawResponse) { + super(message); + this.statusCode = statusCode; + this.body = body; + this.headers = new HashMap<>(); + rawResponse.headers().forEach(header -> { + String key = header.component1(); + String value = header.component2(); + this.headers.computeIfAbsent(key, _str -> new ArrayList<>()).add(value); + }); + } + + /** + * @return the statusCode + */ + public int statusCode() { + return this.statusCode; + } + + /** + * @return the body + */ + public Object body() { + return this.body; + } + + /** + * @return the headers + */ + public Map> headers() { + return this.headers; + } + + @Override + public String toString() { + return "DeepgramApiApiException{" + "message: " + getMessage() + ", statusCode: " + statusCode + ", body: " + + ObjectMappers.stringify(body) + "}"; + } +} diff --git a/src/main/java/com/deepgram/core/DeepgramApiException.java b/src/main/java/com/deepgram/core/DeepgramApiException.java new file mode 100644 index 0000000..c18833e --- /dev/null +++ b/src/main/java/com/deepgram/core/DeepgramApiException.java @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.core; + +/** + * This class serves as the base exception for all errors in the SDK. + */ +public class DeepgramApiException extends RuntimeException { + public DeepgramApiException(String message) { + super(message); + } + + public DeepgramApiException(String message, Exception e) { + super(message, e); + } +} diff --git a/src/main/java/com/deepgram/core/DeepgramApiHttpResponse.java b/src/main/java/com/deepgram/core/DeepgramApiHttpResponse.java new file mode 100644 index 0000000..1c177c9 --- /dev/null +++ b/src/main/java/com/deepgram/core/DeepgramApiHttpResponse.java @@ -0,0 +1,37 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.core; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import okhttp3.Response; + +public final class DeepgramApiHttpResponse { + + private final T body; + + private final Map> headers; + + public DeepgramApiHttpResponse(T body, Response rawResponse) { + this.body = body; + + Map> headers = new HashMap<>(); + rawResponse.headers().forEach(header -> { + String key = header.component1(); + String value = header.component2(); + headers.computeIfAbsent(key, _str -> new ArrayList<>()).add(value); + }); + this.headers = headers; + } + + public T body() { + return this.body; + } + + public Map> headers() { + return headers; + } +} diff --git a/src/main/java/com/deepgram/core/DisconnectReason.java b/src/main/java/com/deepgram/core/DisconnectReason.java new file mode 100644 index 0000000..2a0a005 --- /dev/null +++ b/src/main/java/com/deepgram/core/DisconnectReason.java @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.core; + +/** + * Reason for WebSocket disconnection. + */ +public class DisconnectReason { + private final int code; + + private final String reason; + + public DisconnectReason(int code, String reason) { + this.code = code; + this.reason = reason; + } + + public int getCode() { + return code; + } + + public String getReason() { + return reason; + } +} diff --git a/src/main/java/com/deepgram/core/DoubleSerializer.java b/src/main/java/com/deepgram/core/DoubleSerializer.java new file mode 100644 index 0000000..7f902f8 --- /dev/null +++ b/src/main/java/com/deepgram/core/DoubleSerializer.java @@ -0,0 +1,43 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.core; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.module.SimpleModule; +import java.io.IOException; + +/** + * Custom serializer that writes integer-valued doubles without a decimal point. + * For example, {@code 24000.0} is serialized as {@code 24000} instead of {@code 24000.0}. + * Non-integer values like {@code 3.14} are serialized normally. + */ +class DoubleSerializer extends JsonSerializer { + private static final SimpleModule MODULE; + + static { + MODULE = new SimpleModule() + .addSerializer(Double.class, new DoubleSerializer()) + .addSerializer(double.class, new DoubleSerializer()); + } + + /** + * Gets a module wrapping this serializer 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 void serialize(Double value, JsonGenerator gen, SerializerProvider serializers) throws IOException { + if (value != null && value == Math.floor(value) && !Double.isInfinite(value) && !Double.isNaN(value)) { + gen.writeNumber(value.longValue()); + } else { + gen.writeNumber(value); + } + } +} diff --git a/src/main/java/com/deepgram/core/Environment.java b/src/main/java/com/deepgram/core/Environment.java new file mode 100644 index 0000000..681ef6c --- /dev/null +++ b/src/main/java/com/deepgram/core/Environment.java @@ -0,0 +1,67 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.core; + +public final class Environment { + public static final Environment PRODUCTION = + new Environment("https://api.deepgram.com", "wss://agent.deepgram.com", "wss://api.deepgram.com"); + + public static final Environment AGENT = + new Environment("https://agent.deepgram.com", "wss://agent.deepgram.com", "wss://api.deepgram.com"); + + private final String base; + + private final String agent; + + private final String production; + + Environment(String base, String agent, String production) { + this.base = base; + this.agent = agent; + this.production = production; + } + + public String getBaseURL() { + return this.base; + } + + public String getAgentURL() { + return this.agent; + } + + public String getProductionURL() { + return this.production; + } + + public static Builder custom() { + return new Builder(); + } + + public static class Builder { + private String base; + + private String agent; + + private String production; + + public Builder base(String base) { + this.base = base; + return this; + } + + public Builder agent(String agent) { + this.agent = agent; + return this; + } + + public Builder production(String production) { + this.production = production; + return this; + } + + public Environment build() { + return new Environment(base, agent, production); + } + } +} diff --git a/src/main/java/com/deepgram/core/FileStream.java b/src/main/java/com/deepgram/core/FileStream.java new file mode 100644 index 0000000..a476df6 --- /dev/null +++ b/src/main/java/com/deepgram/core/FileStream.java @@ -0,0 +1,60 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.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/deepgram/core/ILogger.java b/src/main/java/com/deepgram/core/ILogger.java new file mode 100644 index 0000000..4708b93 --- /dev/null +++ b/src/main/java/com/deepgram/core/ILogger.java @@ -0,0 +1,38 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.core; + +/** + * Interface for custom logger implementations. + * + *

Implement this interface to provide a custom logging backend for the SDK. + * The SDK will call the appropriate method based on the log level. + * + *

Example: + *

{@code
+ * public class MyCustomLogger implements ILogger {
+ *     public void debug(String message) {
+ *         System.out.println("[DBG] " + message);
+ *     }
+ *     public void info(String message) {
+ *         System.out.println("[INF] " + message);
+ *     }
+ *     public void warn(String message) {
+ *         System.out.println("[WRN] " + message);
+ *     }
+ *     public void error(String message) {
+ *         System.out.println("[ERR] " + message);
+ *     }
+ * }
+ * }
+ */ +public interface ILogger { + void debug(String message); + + void info(String message); + + void warn(String message); + + void error(String message); +} diff --git a/src/main/java/com/deepgram/core/InputStreamRequestBody.java b/src/main/java/com/deepgram/core/InputStreamRequestBody.java new file mode 100644 index 0000000..9c218c0 --- /dev/null +++ b/src/main/java/com/deepgram/core/InputStreamRequestBody.java @@ -0,0 +1,74 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.core; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Objects; +import okhttp3.MediaType; +import okhttp3.RequestBody; +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 { + try (Source source = Okio.source(inputStream)) { + sink.writeAll(source); + } + } +} diff --git a/src/main/java/com/deepgram/core/LogConfig.java b/src/main/java/com/deepgram/core/LogConfig.java new file mode 100644 index 0000000..fc3678f --- /dev/null +++ b/src/main/java/com/deepgram/core/LogConfig.java @@ -0,0 +1,98 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.core; + +/** + * Configuration for SDK logging. + * + *

Use the builder to configure logging behavior: + *

{@code
+ * LogConfig config = LogConfig.builder()
+ *     .level(LogLevel.DEBUG)
+ *     .silent(false)
+ *     .build();
+ * }
+ * + *

Or with a custom logger: + *

{@code
+ * LogConfig config = LogConfig.builder()
+ *     .level(LogLevel.DEBUG)
+ *     .logger(new MyCustomLogger())
+ *     .silent(false)
+ *     .build();
+ * }
+ * + *

Defaults: + *

    + *
  • {@code level} — {@link LogLevel#INFO}
  • + *
  • {@code logger} — {@link ConsoleLogger} (writes to stderr via java.util.logging)
  • + *
  • {@code silent} — {@code true} (no output unless explicitly enabled)
  • + *
+ */ +public final class LogConfig { + + private final LogLevel level; + private final ILogger logger; + private final boolean silent; + + private LogConfig(LogLevel level, ILogger logger, boolean silent) { + this.level = level; + this.logger = logger; + this.silent = silent; + } + + public LogLevel level() { + return level; + } + + public ILogger logger() { + return logger; + } + + public boolean silent() { + return silent; + } + + public static Builder builder() { + return new Builder(); + } + + public static final class Builder { + private LogLevel level = LogLevel.INFO; + private ILogger logger = new ConsoleLogger(); + private boolean silent = true; + + private Builder() {} + + /** + * Set the minimum log level. Only messages at this level or above will be logged. + * Defaults to {@link LogLevel#INFO}. + */ + public Builder level(LogLevel level) { + this.level = level; + return this; + } + + /** + * Set a custom logger implementation. Defaults to {@link ConsoleLogger}. + */ + public Builder logger(ILogger logger) { + this.logger = logger; + return this; + } + + /** + * Set whether logging is silent (disabled). Defaults to {@code true}. + * Set to {@code false} to enable log output. + */ + public Builder silent(boolean silent) { + this.silent = silent; + return this; + } + + public LogConfig build() { + return new LogConfig(level, logger, silent); + } + } +} diff --git a/src/main/java/com/deepgram/core/LogLevel.java b/src/main/java/com/deepgram/core/LogLevel.java new file mode 100644 index 0000000..48738a4 --- /dev/null +++ b/src/main/java/com/deepgram/core/LogLevel.java @@ -0,0 +1,36 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.core; + +/** + * Log levels for SDK logging configuration. + * Silent by default — no log output unless explicitly configured. + */ +public enum LogLevel { + DEBUG(1), + INFO(2), + WARN(3), + ERROR(4); + + private final int value; + + LogLevel(int value) { + this.value = value; + } + + public int getValue() { + return value; + } + + /** + * Parse a log level from a string (case-insensitive). + * + * @param level the level string (debug, info, warn, error) + * @return the corresponding LogLevel + * @throws IllegalArgumentException if the string does not match any level + */ + public static LogLevel fromString(String level) { + return LogLevel.valueOf(level.toUpperCase()); + } +} diff --git a/src/main/java/com/deepgram/core/Logger.java b/src/main/java/com/deepgram/core/Logger.java new file mode 100644 index 0000000..b0d95dc --- /dev/null +++ b/src/main/java/com/deepgram/core/Logger.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.core; + +/** + * SDK logger that filters messages based on level and silent mode. + * + *

Silent by default — no log output unless explicitly configured. + * Create via {@link LogConfig} or directly: + *

{@code
+ * Logger logger = new Logger(LogLevel.DEBUG, new ConsoleLogger(), false);
+ * logger.debug("request sent");
+ * }
+ */ +public final class Logger { + + private static final Logger DEFAULT = new Logger(LogLevel.INFO, new ConsoleLogger(), true); + + private final LogLevel level; + private final ILogger logger; + private final boolean silent; + + public Logger(LogLevel level, ILogger logger, boolean silent) { + this.level = level; + this.logger = logger; + this.silent = silent; + } + + /** + * Returns a default silent logger (no output). + */ + public static Logger getDefault() { + return DEFAULT; + } + + /** + * Creates a Logger from a {@link LogConfig}. If config is {@code null}, returns the default silent logger. + */ + public static Logger from(LogConfig config) { + if (config == null) { + return DEFAULT; + } + return new Logger(config.level(), config.logger(), config.silent()); + } + + /** + * Creates a Logger from an {@code Optional}. If empty, returns the default silent logger. + */ + public static Logger from(java.util.Optional config) { + return config.map(Logger::from).orElse(DEFAULT); + } + + private boolean shouldLog(LogLevel messageLevel) { + return !silent && level.getValue() <= messageLevel.getValue(); + } + + public boolean isDebug() { + return shouldLog(LogLevel.DEBUG); + } + + public boolean isInfo() { + return shouldLog(LogLevel.INFO); + } + + public boolean isWarn() { + return shouldLog(LogLevel.WARN); + } + + public boolean isError() { + return shouldLog(LogLevel.ERROR); + } + + public void debug(String message) { + if (isDebug()) { + logger.debug(message); + } + } + + public void info(String message) { + if (isInfo()) { + logger.info(message); + } + } + + public void warn(String message) { + if (isWarn()) { + logger.warn(message); + } + } + + public void error(String message) { + if (isError()) { + logger.error(message); + } + } +} diff --git a/src/main/java/com/deepgram/core/LoggingInterceptor.java b/src/main/java/com/deepgram/core/LoggingInterceptor.java new file mode 100644 index 0000000..ea3c5ea --- /dev/null +++ b/src/main/java/com/deepgram/core/LoggingInterceptor.java @@ -0,0 +1,104 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.core; + +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; +import okhttp3.Interceptor; +import okhttp3.Request; +import okhttp3.Response; + +/** + * OkHttp interceptor that logs HTTP requests and responses. + * + *

Logs request method, URL, and headers (with sensitive values redacted) at debug level. + * Logs response status at debug level, and 4xx/5xx responses at error level. + * Does nothing if the logger is silent. + */ +public final class LoggingInterceptor implements Interceptor { + + private static final Set SENSITIVE_HEADERS = new HashSet<>(Arrays.asList( + "authorization", + "www-authenticate", + "x-api-key", + "api-key", + "apikey", + "x-api-token", + "x-auth-token", + "auth-token", + "proxy-authenticate", + "proxy-authorization", + "cookie", + "set-cookie", + "x-csrf-token", + "x-xsrf-token", + "x-session-token", + "x-access-token")); + + private final Logger logger; + + public LoggingInterceptor(Logger logger) { + this.logger = logger; + } + + @Override + public Response intercept(Chain chain) throws IOException { + Request request = chain.request(); + + if (logger.isDebug()) { + StringBuilder sb = new StringBuilder(); + sb.append("HTTP Request: ").append(request.method()).append(" ").append(request.url()); + sb.append(" headers={"); + boolean first = true; + for (String name : request.headers().names()) { + if (!first) { + sb.append(", "); + } + sb.append(name).append("="); + if (SENSITIVE_HEADERS.contains(name.toLowerCase())) { + sb.append("[REDACTED]"); + } else { + sb.append(request.header(name)); + } + first = false; + } + sb.append("}"); + sb.append(" has_body=").append(request.body() != null); + logger.debug(sb.toString()); + } + + Response response = chain.proceed(request); + + if (logger.isDebug()) { + StringBuilder sb = new StringBuilder(); + sb.append("HTTP Response: status=").append(response.code()); + sb.append(" url=").append(response.request().url()); + sb.append(" headers={"); + boolean first = true; + for (String name : response.headers().names()) { + if (!first) { + sb.append(", "); + } + sb.append(name).append("="); + if (SENSITIVE_HEADERS.contains(name.toLowerCase())) { + sb.append("[REDACTED]"); + } else { + sb.append(response.header(name)); + } + first = false; + } + sb.append("}"); + logger.debug(sb.toString()); + } + + if (response.code() >= 400 && logger.isError()) { + logger.error("HTTP Error: status=" + response.code() + " url=" + + response.request().url()); + } + + return response; + } +} diff --git a/src/main/java/com/deepgram/core/MediaTypes.java b/src/main/java/com/deepgram/core/MediaTypes.java new file mode 100644 index 0000000..320f0e0 --- /dev/null +++ b/src/main/java/com/deepgram/core/MediaTypes.java @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.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/deepgram/core/Nullable.java b/src/main/java/com/deepgram/core/Nullable.java new file mode 100644 index 0000000..044fe7d --- /dev/null +++ b/src/main/java/com/deepgram/core/Nullable.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.core; + +import java.util.Optional; +import java.util.function.Function; + +public final class Nullable { + + private final Either, Null> value; + + private Nullable() { + this.value = Either.left(Optional.empty()); + } + + private Nullable(T value) { + if (value == null) { + this.value = Either.right(Null.INSTANCE); + } else { + this.value = Either.left(Optional.of(value)); + } + } + + public static Nullable ofNull() { + return new Nullable<>(null); + } + + public static Nullable of(T value) { + return new Nullable<>(value); + } + + public static Nullable empty() { + return new Nullable<>(); + } + + public static Nullable ofOptional(Optional value) { + if (value.isPresent()) { + return of(value.get()); + } else { + return empty(); + } + } + + public boolean isNull() { + return this.value.isRight(); + } + + public boolean isEmpty() { + return this.value.isLeft() && !this.value.getLeft().isPresent(); + } + + public T get() { + if (this.isNull()) { + return null; + } + + return this.value.getLeft().get(); + } + + public Nullable map(Function mapper) { + if (this.isNull()) { + return Nullable.ofNull(); + } + + return Nullable.ofOptional(this.value.getLeft().map(mapper)); + } + + @Override + public boolean equals(Object other) { + if (!(other instanceof Nullable)) { + return false; + } + + if (((Nullable) other).isNull() && this.isNull()) { + return true; + } + + return this.value.getLeft().equals(((Nullable) other).value.getLeft()); + } + + private static final class Either { + private L left = null; + private R right = null; + + private Either(L left, R right) { + if (left != null && right != null) { + throw new IllegalArgumentException("Left and right argument cannot both be non-null."); + } + + if (left == null && right == null) { + throw new IllegalArgumentException("Left and right argument cannot both be null."); + } + + if (left != null) { + this.left = left; + } + + if (right != null) { + this.right = right; + } + } + + public static Either left(L left) { + return new Either<>(left, null); + } + + public static Either right(R right) { + return new Either<>(null, right); + } + + public boolean isLeft() { + return this.left != null; + } + + public boolean isRight() { + return this.right != null; + } + + public L getLeft() { + if (!this.isLeft()) { + throw new IllegalArgumentException("Cannot get left from right Either."); + } + return this.left; + } + + public R getRight() { + if (!this.isRight()) { + throw new IllegalArgumentException("Cannot get right from left Either."); + } + return this.right; + } + } + + private static final class Null { + private static final Null INSTANCE = new Null(); + + private Null() {} + } +} diff --git a/src/main/java/com/deepgram/core/NullableNonemptyFilter.java b/src/main/java/com/deepgram/core/NullableNonemptyFilter.java new file mode 100644 index 0000000..3eb1740 --- /dev/null +++ b/src/main/java/com/deepgram/core/NullableNonemptyFilter.java @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.core; + +import java.util.Optional; + +public final class NullableNonemptyFilter { + @Override + public boolean equals(Object o) { + boolean isOptionalEmpty = isOptionalEmpty(o); + + return isOptionalEmpty; + } + + private boolean isOptionalEmpty(Object o) { + if (o instanceof Optional) { + return !((Optional) o).isPresent(); + } + return false; + } +} diff --git a/src/main/java/com/deepgram/core/ObjectMappers.java b/src/main/java/com/deepgram/core/ObjectMappers.java new file mode 100644 index 0000000..e79a331 --- /dev/null +++ b/src/main/java/com/deepgram/core/ObjectMappers.java @@ -0,0 +1,46 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.core; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.core.JsonProcessingException; +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()) + .addModule(DoubleSerializer.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()); + } + } + + public static Object parseErrorBody(String responseBodyString) { + try { + return JSON_MAPPER.readValue(responseBodyString, Object.class); + } catch (JsonProcessingException ignored) { + return responseBodyString; + } + } +} diff --git a/src/main/java/com/deepgram/core/OkHttpWebSocketFactory.java b/src/main/java/com/deepgram/core/OkHttpWebSocketFactory.java new file mode 100644 index 0000000..70e6c86 --- /dev/null +++ b/src/main/java/com/deepgram/core/OkHttpWebSocketFactory.java @@ -0,0 +1,31 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.core; + +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.WebSocket; +import okhttp3.WebSocketListener; + +/** + * Default WebSocketFactory implementation using OkHttpClient. + * This factory delegates WebSocket creation to the provided OkHttpClient instance. + */ +public final class OkHttpWebSocketFactory implements WebSocketFactory { + private final OkHttpClient okHttpClient; + + /** + * Creates a new OkHttpWebSocketFactory with the specified OkHttpClient. + * + * @param okHttpClient The OkHttpClient instance to use for creating WebSockets + */ + public OkHttpWebSocketFactory(OkHttpClient okHttpClient) { + this.okHttpClient = okHttpClient; + } + + @Override + public WebSocket create(Request request, WebSocketListener listener) { + return okHttpClient.newWebSocket(request, listener); + } +} diff --git a/src/main/java/com/deepgram/core/QueryStringMapper.java b/src/main/java/com/deepgram/core/QueryStringMapper.java new file mode 100644 index 0000000..d0e0361 --- /dev/null +++ b/src/main/java/com/deepgram/core/QueryStringMapper.java @@ -0,0 +1,142 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.core; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ArrayNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.AbstractMap; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import okhttp3.HttpUrl; +import okhttp3.MultipartBody; + +public class QueryStringMapper { + + private static final ObjectMapper MAPPER = ObjectMappers.JSON_MAPPER; + + public static void addQueryParameter(HttpUrl.Builder httpUrl, String key, Object value, boolean arraysAsRepeats) { + JsonNode valueNode = MAPPER.valueToTree(value); + + List> flat; + if (valueNode.isObject()) { + flat = flattenObject((ObjectNode) valueNode, arraysAsRepeats); + } else if (valueNode.isArray()) { + flat = flattenArray((ArrayNode) valueNode, "", arraysAsRepeats); + } else { + if (valueNode.isTextual()) { + httpUrl.addQueryParameter(key, valueNode.textValue()); + } else { + httpUrl.addQueryParameter(key, valueNode.toString()); + } + return; + } + + for (Map.Entry field : flat) { + if (field.getValue().isTextual()) { + httpUrl.addQueryParameter(key + field.getKey(), field.getValue().textValue()); + } else { + httpUrl.addQueryParameter(key + field.getKey(), field.getValue().toString()); + } + } + } + + public static void addFormDataPart( + MultipartBody.Builder multipartBody, String key, Object value, boolean arraysAsRepeats) { + JsonNode valueNode = MAPPER.valueToTree(value); + + List> flat; + if (valueNode.isObject()) { + flat = flattenObject((ObjectNode) valueNode, arraysAsRepeats); + } else if (valueNode.isArray()) { + flat = flattenArray((ArrayNode) valueNode, "", arraysAsRepeats); + } else { + if (valueNode.isTextual()) { + multipartBody.addFormDataPart(key, valueNode.textValue()); + } else { + multipartBody.addFormDataPart(key, valueNode.toString()); + } + return; + } + + for (Map.Entry field : flat) { + if (field.getValue().isTextual()) { + multipartBody.addFormDataPart( + key + field.getKey(), field.getValue().textValue()); + } else { + multipartBody.addFormDataPart( + key + field.getKey(), field.getValue().toString()); + } + } + } + + public static List> flattenObject(ObjectNode object, boolean arraysAsRepeats) { + List> flat = new ArrayList<>(); + + Iterator> fields = object.fields(); + while (fields.hasNext()) { + Map.Entry field = fields.next(); + + String key = "[" + field.getKey() + "]"; + + if (field.getValue().isObject()) { + List> flatField = + flattenObject((ObjectNode) field.getValue(), arraysAsRepeats); + addAll(flat, flatField, key); + } else if (field.getValue().isArray()) { + List> flatField = + flattenArray((ArrayNode) field.getValue(), key, arraysAsRepeats); + addAll(flat, flatField, ""); + } else { + flat.add(new AbstractMap.SimpleEntry<>(key, field.getValue())); + } + } + + return flat; + } + + private static List> flattenArray( + ArrayNode array, String key, boolean arraysAsRepeats) { + List> flat = new ArrayList<>(); + + Iterator elements = array.elements(); + + int index = 0; + while (elements.hasNext()) { + JsonNode element = elements.next(); + + String indexKey = key + "[" + index + "]"; + + if (arraysAsRepeats) { + indexKey = key; + } + + if (element.isObject()) { + List> flatField = flattenObject((ObjectNode) element, arraysAsRepeats); + addAll(flat, flatField, indexKey); + } else if (element.isArray()) { + List> flatField = flattenArray((ArrayNode) element, "", arraysAsRepeats); + addAll(flat, flatField, indexKey); + } else { + flat.add(new AbstractMap.SimpleEntry<>(indexKey, element)); + } + + index++; + } + + return flat; + } + + private static void addAll( + List> target, List> source, String prefix) { + for (Map.Entry entry : source) { + Map.Entry entryToAdd = + new AbstractMap.SimpleEntry<>(prefix + entry.getKey(), entry.getValue()); + target.add(entryToAdd); + } + } +} diff --git a/src/main/java/com/deepgram/core/ReconnectingWebSocketListener.java b/src/main/java/com/deepgram/core/ReconnectingWebSocketListener.java new file mode 100644 index 0000000..0ca455a --- /dev/null +++ b/src/main/java/com/deepgram/core/ReconnectingWebSocketListener.java @@ -0,0 +1,494 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.core; + +import static java.util.concurrent.TimeUnit.*; + +import java.util.ArrayList; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ConcurrentLinkedQueue; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeoutException; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Supplier; +import okhttp3.Response; +import okhttp3.WebSocket; +import okhttp3.WebSocketListener; +import okio.ByteString; + +/** + * WebSocketListener with automatic reconnection, exponential backoff, and message queuing. + * Provides production-ready resilience for WebSocket connections. + */ +public abstract class ReconnectingWebSocketListener extends WebSocketListener { + private final long minReconnectionDelayMs; + + private final long maxReconnectionDelayMs; + + private final double reconnectionDelayGrowFactor; + + private final int maxRetries; + + private final int maxEnqueuedMessages; + + private final AtomicInteger retryCount = new AtomicInteger(0); + + private final AtomicBoolean connectLock = new AtomicBoolean(false); + + private final AtomicBoolean shouldReconnect = new AtomicBoolean(true); + + protected volatile WebSocket webSocket; + + private volatile long connectionEstablishedTime = 0L; + + private final ConcurrentLinkedQueue messageQueue = new ConcurrentLinkedQueue<>(); + + private final ConcurrentLinkedQueue binaryMessageQueue = new ConcurrentLinkedQueue<>(); + + private final ScheduledExecutorService reconnectExecutor = Executors.newSingleThreadScheduledExecutor(); + + private final Supplier connectionSupplier; + + /** + * Creates a new reconnecting WebSocket listener. + * + * @param options Reconnection configuration options + * @param connectionSupplier Supplier that creates new WebSocket connections + */ + public ReconnectingWebSocketListener( + ReconnectingWebSocketListener.ReconnectOptions options, Supplier connectionSupplier) { + this.minReconnectionDelayMs = options.minReconnectionDelayMs; + this.maxReconnectionDelayMs = options.maxReconnectionDelayMs; + this.reconnectionDelayGrowFactor = options.reconnectionDelayGrowFactor; + this.maxRetries = options.maxRetries; + this.maxEnqueuedMessages = options.maxEnqueuedMessages; + this.connectionSupplier = connectionSupplier; + } + + /** + * Initiates a WebSocket connection with automatic reconnection enabled. + * + * Connection behavior: + * - Times out after 4000 milliseconds + * - Thread-safe via atomic lock (returns immediately if connection in progress) + * - Retry count not incremented for initial connection attempt + * + * Error handling: + * - TimeoutException: Includes retry attempt context + * - InterruptedException: Preserves thread interruption status + * - ExecutionException: Extracts actual cause and adds context + */ + public void connect() { + if (!connectLock.compareAndSet(false, true)) { + return; + } + if (retryCount.get() >= maxRetries) { + connectLock.set(false); + return; + } + try { + CompletableFuture connectionFuture = CompletableFuture.supplyAsync(connectionSupplier); + try { + webSocket = connectionFuture.get(4000, MILLISECONDS); + } catch (TimeoutException e) { + connectionFuture.cancel(true); + TimeoutException timeoutError = + new TimeoutException("WebSocket connection timeout after " + 4000 + " milliseconds" + + (retryCount.get() > 0 + ? " (retry attempt #" + retryCount.get() + : " (initial connection attempt)")); + onWebSocketFailure(null, timeoutError, null); + if (shouldReconnect.get()) { + scheduleReconnect(); + } + } catch (InterruptedException e) { + connectionFuture.cancel(true); + Thread.currentThread().interrupt(); + InterruptedException interruptError = new InterruptedException("WebSocket connection interrupted" + + (retryCount.get() > 0 + ? " during retry attempt #" + retryCount.get() + : " during initial connection")); + interruptError.initCause(e); + onWebSocketFailure(null, interruptError, null); + } catch (ExecutionException e) { + Throwable cause = e.getCause() != null ? e.getCause() : e; + String context = retryCount.get() > 0 + ? "WebSocket connection failed during retry attempt #" + retryCount.get() + : "WebSocket connection failed during initial attempt"; + RuntimeException wrappedException = new RuntimeException( + context + ": " + cause.getClass().getSimpleName() + ": " + cause.getMessage()); + wrappedException.initCause(cause); + onWebSocketFailure(null, wrappedException, null); + if (shouldReconnect.get()) { + scheduleReconnect(); + } + } + } finally { + connectLock.set(false); + } + } + + /** + * Disconnects the WebSocket and disables automatic reconnection. + * + * This method: + * - Disables automatic reconnection + * - Clears queued messages to prevent stale data + * - Closes the WebSocket with standard close code 1000 + * - Properly shuts down the reconnect executor to prevent thread leaks + * - Waits up to 5 seconds for executor termination + */ + public void disconnect() { + shouldReconnect.set(false); + messageQueue.clear(); + binaryMessageQueue.clear(); + if (webSocket != null) { + webSocket.close(1000, "Client disconnecting"); + } + reconnectExecutor.shutdown(); + try { + if (!reconnectExecutor.awaitTermination(5, SECONDS)) { + reconnectExecutor.shutdownNow(); + } + } catch (InterruptedException e) { + reconnectExecutor.shutdownNow(); + Thread.currentThread().interrupt(); + } + } + + /** + * Sends a message or queues it if not connected. + * + * Thread-safe: Synchronized to prevent race conditions with flushMessageQueue(). + * + * Behavior: + * - If connected: Attempts direct send, queues if buffer full + * - If disconnected: Queues message up to maxEnqueuedMessages limit + * - If queue full: Message is dropped + * + * @param message The message to send + * @return true if sent immediately, false if queued or dropped + */ + public synchronized boolean send(String message) { + WebSocket ws = webSocket; + if (ws != null) { + boolean sent = ws.send(message); + if (!sent && messageQueue.size() < maxEnqueuedMessages) { + messageQueue.offer(message); + return false; + } + return sent; + } else { + if (messageQueue.size() < maxEnqueuedMessages) { + messageQueue.offer(message); + return false; + } + return false; + } + } + + /** + * Sends binary data or queues it if not connected. + * + * Thread-safe: Synchronized to prevent race conditions with flushMessageQueue(). + * + * Behavior: + * - If connected: Attempts direct send, queues if buffer full + * - If disconnected: Queues data up to maxEnqueuedMessages limit + * - If queue full: Data is dropped + * + * @param data The binary data to send + * @return true if sent immediately, false if queued or dropped + */ + public synchronized boolean sendBinary(ByteString data) { + WebSocket ws = webSocket; + if (ws != null) { + boolean sent = ws.send(data); + if (!sent && binaryMessageQueue.size() < maxEnqueuedMessages) { + binaryMessageQueue.offer(data); + return false; + } + return sent; + } else { + if (binaryMessageQueue.size() < maxEnqueuedMessages) { + binaryMessageQueue.offer(data); + return false; + } + return false; + } + } + + /** + * Gets the current WebSocket instance. + * Thread-safe method to access the WebSocket connection. + * @return the WebSocket or null if not connected + */ + public WebSocket getWebSocket() { + return webSocket; + } + + /** + * @hidden + */ + @Override + public void onOpen(WebSocket webSocket, Response response) { + this.webSocket = webSocket; + connectionEstablishedTime = System.currentTimeMillis(); + retryCount.set(0); + flushMessageQueue(); + onWebSocketOpen(webSocket, response); + } + + @Override + public void onMessage(WebSocket webSocket, String text) { + onWebSocketMessage(webSocket, text); + } + + @Override + public void onMessage(WebSocket webSocket, ByteString bytes) { + onWebSocketBinaryMessage(webSocket, bytes); + } + + /** + * @hidden + */ + @Override + public void onFailure(WebSocket webSocket, Throwable t, Response response) { + this.webSocket = null; + long uptime = 0L; + if (connectionEstablishedTime > 0) { + uptime = System.currentTimeMillis() - connectionEstablishedTime; + if (uptime >= 5000) { + retryCount.set(0); + } + } + connectionEstablishedTime = 0L; + Throwable enhancedError = t; + if (t != null) { + String errorContext = "WebSocket connection failed"; + if (uptime > 0) { + errorContext += " after " + (uptime / 1000) + " seconds"; + } + if (response != null) { + errorContext += " with HTTP " + response.code() + " " + response.message(); + } + enhancedError = + new RuntimeException(errorContext + ": " + t.getClass().getSimpleName() + ": " + t.getMessage()); + enhancedError.initCause(t); + } + onWebSocketFailure(webSocket, enhancedError, response); + if (shouldReconnect.get()) { + scheduleReconnect(); + } + } + + /** + * @hidden + */ + @Override + public void onClosed(WebSocket webSocket, int code, String reason) { + this.webSocket = null; + if (connectionEstablishedTime > 0) { + long uptime = System.currentTimeMillis() - connectionEstablishedTime; + if (uptime >= 5000) { + retryCount.set(0); + } + } + connectionEstablishedTime = 0L; + onWebSocketClosed(webSocket, code, reason); + if (code != 1000 && shouldReconnect.get()) { + scheduleReconnect(); + } + } + + /** + * Calculates the next reconnection delay using exponential backoff. + * + * Uses 0-based retry count where: + * - 0 = initial connection (not used by this method) + * - 1 = first retry (returns minReconnectionDelayMs) + * - 2+ = exponential backoff up to maxReconnectionDelayMs + */ + private long getNextDelay() { + if (retryCount.get() == 1) { + return minReconnectionDelayMs; + } + long delay = (long) (minReconnectionDelayMs * Math.pow(reconnectionDelayGrowFactor, retryCount.get() - 1)); + return Math.min(delay, maxReconnectionDelayMs); + } + + /** + * Schedules a reconnection attempt with appropriate delay. + * Increments retry count and uses exponential backoff. + */ + private void scheduleReconnect() { + retryCount.incrementAndGet(); + long delay = getNextDelay(); + reconnectExecutor.schedule(this::connect, delay, MILLISECONDS); + } + + /** + * Sends all queued messages after reconnection. + * + * Thread-safe: Synchronized to prevent race conditions with send() method. + * + * Algorithm: + * 1. Drains queue into temporary list to avoid holding lock during sends + * 2. Attempts to send each message in order + * 3. If any send fails, re-queues that message and all subsequent messages + * 4. Preserves message ordering during re-queueing + * 5. Repeats for binary message queue + */ + private synchronized void flushMessageQueue() { + WebSocket ws = webSocket; + if (ws != null) { + ArrayList tempQueue = new ArrayList<>(); + String message; + while ((message = messageQueue.poll()) != null) { + tempQueue.add(message); + } + for (int i = 0; i < tempQueue.size(); i++) { + if (!ws.send(tempQueue.get(i))) { + for (int j = i; j < tempQueue.size(); j++) { + messageQueue.offer(tempQueue.get(j)); + } + break; + } + } + ArrayList tempBinaryQueue = new ArrayList<>(); + ByteString binaryMsg; + while ((binaryMsg = binaryMessageQueue.poll()) != null) { + tempBinaryQueue.add(binaryMsg); + } + for (int i = 0; i < tempBinaryQueue.size(); i++) { + if (!ws.send(tempBinaryQueue.get(i))) { + for (int j = i; j < tempBinaryQueue.size(); j++) { + binaryMessageQueue.offer(tempBinaryQueue.get(j)); + } + break; + } + } + } + } + + protected abstract void onWebSocketOpen(WebSocket webSocket, Response response); + + protected abstract void onWebSocketMessage(WebSocket webSocket, String text); + + protected abstract void onWebSocketBinaryMessage(WebSocket webSocket, ByteString bytes); + + protected abstract void onWebSocketFailure(WebSocket webSocket, Throwable t, Response response); + + protected abstract void onWebSocketClosed(WebSocket webSocket, int code, String reason); + + /** + * Configuration options for automatic reconnection. + */ + public static final class ReconnectOptions { + public final long minReconnectionDelayMs; + + public final long maxReconnectionDelayMs; + + public final double reconnectionDelayGrowFactor; + + public final int maxRetries; + + public final int maxEnqueuedMessages; + + private ReconnectOptions(Builder builder) { + this.minReconnectionDelayMs = builder.minReconnectionDelayMs; + this.maxReconnectionDelayMs = builder.maxReconnectionDelayMs; + this.reconnectionDelayGrowFactor = builder.reconnectionDelayGrowFactor; + this.maxRetries = builder.maxRetries; + this.maxEnqueuedMessages = builder.maxEnqueuedMessages; + } + + public static Builder builder() { + return new Builder(); + } + + public static final class Builder { + private long minReconnectionDelayMs; + + private long maxReconnectionDelayMs; + + private double reconnectionDelayGrowFactor; + + private int maxRetries; + + private int maxEnqueuedMessages; + + public Builder() { + this.minReconnectionDelayMs = 1000; + this.maxReconnectionDelayMs = 10000; + this.reconnectionDelayGrowFactor = 1.3; + this.maxRetries = 2147483647; + this.maxEnqueuedMessages = 1000; + } + + public Builder minReconnectionDelayMs(long minReconnectionDelayMs) { + this.minReconnectionDelayMs = minReconnectionDelayMs; + return this; + } + + public Builder maxReconnectionDelayMs(long maxReconnectionDelayMs) { + this.maxReconnectionDelayMs = maxReconnectionDelayMs; + return this; + } + + public Builder reconnectionDelayGrowFactor(double reconnectionDelayGrowFactor) { + this.reconnectionDelayGrowFactor = reconnectionDelayGrowFactor; + return this; + } + + public Builder maxRetries(int maxRetries) { + this.maxRetries = maxRetries; + return this; + } + + public Builder maxEnqueuedMessages(int maxEnqueuedMessages) { + this.maxEnqueuedMessages = maxEnqueuedMessages; + return this; + } + + /** + * Builds the ReconnectOptions with validation. + * + * Validates that: + * - All delay values are positive + * - minReconnectionDelayMs <= maxReconnectionDelayMs + * - reconnectionDelayGrowFactor >= 1.0 + * - maxRetries and maxEnqueuedMessages are non-negative + * + * @return The validated ReconnectOptions instance + * @throws IllegalArgumentException if configuration is invalid + */ + public ReconnectOptions build() { + if (minReconnectionDelayMs <= 0) { + throw new IllegalArgumentException("minReconnectionDelayMs must be positive"); + } + if (maxReconnectionDelayMs <= 0) { + throw new IllegalArgumentException("maxReconnectionDelayMs must be positive"); + } + if (minReconnectionDelayMs > maxReconnectionDelayMs) { + throw new IllegalArgumentException("minReconnectionDelayMs (" + minReconnectionDelayMs + + ") must not exceed maxReconnectionDelayMs (" + maxReconnectionDelayMs + ")"); + } + if (reconnectionDelayGrowFactor < 1.0) { + throw new IllegalArgumentException("reconnectionDelayGrowFactor must be >= 1.0"); + } + if (maxRetries < 0) { + throw new IllegalArgumentException("maxRetries must be non-negative"); + } + if (maxEnqueuedMessages < 0) { + throw new IllegalArgumentException("maxEnqueuedMessages must be non-negative"); + } + return new ReconnectOptions(this); + } + } + } +} diff --git a/src/main/java/com/deepgram/core/RequestOptions.java b/src/main/java/com/deepgram/core/RequestOptions.java new file mode 100644 index 0000000..d0e615a --- /dev/null +++ b/src/main/java/com/deepgram/core/RequestOptions.java @@ -0,0 +1,138 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.core; + +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; + +public final class RequestOptions { + private final String apiKey; + + private final Optional timeout; + + private final TimeUnit timeoutTimeUnit; + + private final Map headers; + + private final Map> headerSuppliers; + + private final Map queryParameters; + + private final Map> queryParameterSuppliers; + + private RequestOptions( + String apiKey, + Optional timeout, + TimeUnit timeoutTimeUnit, + Map headers, + Map> headerSuppliers, + Map queryParameters, + Map> queryParameterSuppliers) { + this.apiKey = apiKey; + this.timeout = timeout; + this.timeoutTimeUnit = timeoutTimeUnit; + this.headers = headers; + this.headerSuppliers = headerSuppliers; + this.queryParameters = queryParameters; + this.queryParameterSuppliers = queryParameterSuppliers; + } + + public Optional getTimeout() { + return timeout; + } + + public TimeUnit getTimeoutTimeUnit() { + return timeoutTimeUnit; + } + + public Map getHeaders() { + Map headers = new HashMap<>(); + if (this.apiKey != null) { + headers.put("Authorization", "Token " + this.apiKey); + } + headers.putAll(this.headers); + this.headerSuppliers.forEach((key, supplier) -> { + headers.put(key, supplier.get()); + }); + return headers; + } + + public Map getQueryParameters() { + Map queryParameters = new HashMap<>(this.queryParameters); + this.queryParameterSuppliers.forEach((key, supplier) -> { + queryParameters.put(key, supplier.get()); + }); + return queryParameters; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private String apiKey = null; + + private Optional timeout = Optional.empty(); + + private TimeUnit timeoutTimeUnit = TimeUnit.SECONDS; + + private final Map headers = new HashMap<>(); + + private final Map> headerSuppliers = new HashMap<>(); + + private final Map queryParameters = new HashMap<>(); + + private final Map> queryParameterSuppliers = new HashMap<>(); + + public Builder apiKey(String apiKey) { + this.apiKey = apiKey; + 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 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 Builder addQueryParameter(String key, String value) { + this.queryParameters.put(key, value); + return this; + } + + public Builder addQueryParameter(String key, Supplier value) { + this.queryParameterSuppliers.put(key, value); + return this; + } + + public RequestOptions build() { + return new RequestOptions( + apiKey, + timeout, + timeoutTimeUnit, + headers, + headerSuppliers, + queryParameters, + queryParameterSuppliers); + } + } +} diff --git a/src/main/java/com/deepgram/core/ResponseBodyInputStream.java b/src/main/java/com/deepgram/core/ResponseBodyInputStream.java new file mode 100644 index 0000000..2bdff70 --- /dev/null +++ b/src/main/java/com/deepgram/core/ResponseBodyInputStream.java @@ -0,0 +1,45 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.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/deepgram/core/ResponseBodyReader.java b/src/main/java/com/deepgram/core/ResponseBodyReader.java new file mode 100644 index 0000000..e820acf --- /dev/null +++ b/src/main/java/com/deepgram/core/ResponseBodyReader.java @@ -0,0 +1,44 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.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/deepgram/core/RetryInterceptor.java b/src/main/java/com/deepgram/core/RetryInterceptor.java new file mode 100644 index 0000000..b48acb7 --- /dev/null +++ b/src/main/java/com/deepgram/core/RetryInterceptor.java @@ -0,0 +1,180 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.core; + +import java.io.IOException; +import java.time.Duration; +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; +import java.time.format.DateTimeParseException; +import java.util.Optional; +import java.util.Random; +import okhttp3.Interceptor; +import okhttp3.Response; + +public class RetryInterceptor implements Interceptor { + + private static final Duration INITIAL_RETRY_DELAY = Duration.ofMillis(1000); + private static final Duration MAX_RETRY_DELAY = Duration.ofMillis(60000); + private static final double JITTER_FACTOR = 0.2; + + 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(response); + 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(response); + } else { + return response; + } + } + + return response; + } + + /** + * Calculates the retry delay from response headers, with fallback to exponential backoff. + * Priority: Retry-After > X-RateLimit-Reset > Exponential Backoff + */ + private Duration getRetryDelayFromHeaders(Response response, int retryAttempt) { + // Check for Retry-After header first (RFC 7231), with no jitter + String retryAfter = response.header("Retry-After"); + if (retryAfter != null) { + // Parse as number of seconds... + Optional secondsDelay = tryParseLong(retryAfter) + .map(seconds -> seconds * 1000) + .filter(delayMs -> delayMs > 0) + .map(delayMs -> Math.min(delayMs, MAX_RETRY_DELAY.toMillis())) + .map(Duration::ofMillis); + if (secondsDelay.isPresent()) { + return secondsDelay.get(); + } + + // ...or as an HTTP date; both are valid + Optional dateDelay = tryParseHttpDate(retryAfter) + .map(resetTime -> resetTime.toInstant().toEpochMilli() - System.currentTimeMillis()) + .filter(delayMs -> delayMs > 0) + .map(delayMs -> Math.min(delayMs, MAX_RETRY_DELAY.toMillis())) + .map(Duration::ofMillis); + if (dateDelay.isPresent()) { + return dateDelay.get(); + } + } + + // Then check for industry-standard X-RateLimit-Reset header, with positive jitter + String rateLimitReset = response.header("X-RateLimit-Reset"); + if (rateLimitReset != null) { + // Assume Unix timestamp in epoch seconds + Optional rateLimitDelay = tryParseLong(rateLimitReset) + .map(resetTimeSeconds -> (resetTimeSeconds * 1000) - System.currentTimeMillis()) + .filter(delayMs -> delayMs > 0) + .map(delayMs -> Math.min(delayMs, MAX_RETRY_DELAY.toMillis())) + .map(this::addPositiveJitter) + .map(Duration::ofMillis); + if (rateLimitDelay.isPresent()) { + return rateLimitDelay.get(); + } + } + + // Fall back to exponential backoff, with symmetric jitter + long baseDelay = INITIAL_RETRY_DELAY.toMillis() * (1L << retryAttempt); // 2^retryAttempt + long cappedDelay = Math.min(baseDelay, MAX_RETRY_DELAY.toMillis()); + return Duration.ofMillis(addSymmetricJitter(cappedDelay)); + } + + /** + * Attempts to parse a string as a long, returning empty Optional on failure. + */ + private Optional tryParseLong(String value) { + if (value == null) { + return Optional.empty(); + } + try { + return Optional.of(Long.parseLong(value)); + } catch (NumberFormatException e) { + return Optional.empty(); + } + } + + /** + * Attempts to parse a string as an HTTP date (RFC 1123), returning empty Optional on failure. + */ + private Optional tryParseHttpDate(String value) { + if (value == null) { + return Optional.empty(); + } + try { + return Optional.of(ZonedDateTime.parse(value, DateTimeFormatter.RFC_1123_DATE_TIME)); + } catch (DateTimeParseException e) { + return Optional.empty(); + } + } + + /** + * Adds positive jitter (100-120% of original value) to prevent thundering herd. + * Used for X-RateLimit-Reset header delays. + */ + private long addPositiveJitter(long delayMs) { + double jitterMultiplier = 1.0 + (random.nextDouble() * JITTER_FACTOR); + return (long) (delayMs * jitterMultiplier); + } + + /** + * Adds symmetric jitter (90-110% of original value) to prevent thundering herd. + * Used for exponential backoff delays. + */ + private long addSymmetricJitter(long delayMs) { + double jitterMultiplier = 1.0 + ((random.nextDouble() - 0.5) * JITTER_FACTOR); + return (long) (delayMs * jitterMultiplier); + } + + private static boolean shouldRetry(int statusCode) { + return statusCode == 408 || 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(Response response) { + if (retryNumber >= maxNumRetries) { + return Optional.empty(); + } + + Duration delay = getRetryDelayFromHeaders(response, retryNumber); + retryNumber += 1; + return Optional.of(delay); + } + } +} diff --git a/src/main/java/com/deepgram/core/Rfc2822DateTimeDeserializer.java b/src/main/java/com/deepgram/core/Rfc2822DateTimeDeserializer.java new file mode 100644 index 0000000..d76bdc1 --- /dev/null +++ b/src/main/java/com/deepgram/core/Rfc2822DateTimeDeserializer.java @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.core; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Custom deserializer that handles converting RFC 2822 (RFC 1123) dates into {@link OffsetDateTime} objects. + * This is used for fields with format "date-time-rfc-2822", such as Twilio's dateCreated, dateSent, dateUpdated. + */ +public class Rfc2822DateTimeDeserializer extends JsonDeserializer { + + @Override + public OffsetDateTime deserialize(JsonParser parser, DeserializationContext context) throws IOException { + String raw = parser.getValueAsString(); + return ZonedDateTime.parse(raw, DateTimeFormatter.RFC_1123_DATE_TIME).toOffsetDateTime(); + } +} diff --git a/src/main/java/com/deepgram/core/SseEvent.java b/src/main/java/com/deepgram/core/SseEvent.java new file mode 100644 index 0000000..96abbe0 --- /dev/null +++ b/src/main/java/com/deepgram/core/SseEvent.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.core; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Objects; +import java.util.Optional; + +/** + * Represents a Server-Sent Event with all standard fields. + * Used for event-level discrimination where the discriminator is at the SSE envelope level. + * + * @param The type of the data field + */ +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonIgnoreProperties(ignoreUnknown = true) +public final class SseEvent { + private final String event; + private final T data; + private final String id; + private final Long retry; + + private SseEvent(String event, T data, String id, Long retry) { + this.event = event; + this.data = data; + this.id = id; + this.retry = retry; + } + + @JsonProperty("event") + public Optional getEvent() { + return Optional.ofNullable(event); + } + + @JsonProperty("data") + public T getData() { + return data; + } + + @JsonProperty("id") + public Optional getId() { + return Optional.ofNullable(id); + } + + @JsonProperty("retry") + public Optional getRetry() { + return Optional.ofNullable(retry); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + SseEvent sseEvent = (SseEvent) o; + return Objects.equals(event, sseEvent.event) + && Objects.equals(data, sseEvent.data) + && Objects.equals(id, sseEvent.id) + && Objects.equals(retry, sseEvent.retry); + } + + @Override + public int hashCode() { + return Objects.hash(event, data, id, retry); + } + + @Override + public String toString() { + return "SseEvent{" + "event='" + + event + '\'' + ", data=" + + data + ", id='" + + id + '\'' + ", retry=" + + retry + '}'; + } + + public static Builder builder() { + return new Builder<>(); + } + + public static final class Builder { + private String event; + private T data; + private String id; + private Long retry; + + private Builder() {} + + public Builder event(String event) { + this.event = event; + return this; + } + + public Builder data(T data) { + this.data = data; + return this; + } + + public Builder id(String id) { + this.id = id; + return this; + } + + public Builder retry(Long retry) { + this.retry = retry; + return this; + } + + public SseEvent build() { + return new SseEvent<>(event, data, id, retry); + } + } +} diff --git a/src/main/java/com/deepgram/core/SseEventParser.java b/src/main/java/com/deepgram/core/SseEventParser.java new file mode 100644 index 0000000..06f6057 --- /dev/null +++ b/src/main/java/com/deepgram/core/SseEventParser.java @@ -0,0 +1,228 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.core; + +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.core.type.TypeReference; +import java.lang.reflect.Field; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Optional; +import java.util.Set; + +/** + * Utility class for parsing Server-Sent Events with support for discriminated unions. + *

+ * Handles two discrimination patterns: + *

    + *
  1. Data-level discrimination: The discriminator (e.g., 'type') is inside the JSON data payload. + * Jackson's polymorphic deserialization handles this automatically.
  2. + *
  3. Event-level discrimination: The discriminator (e.g., 'event') is at the SSE envelope level. + * This requires constructing the full SSE envelope for Jackson to process.
  4. + *
+ */ +public final class SseEventParser { + + private static final Set SSE_ENVELOPE_FIELDS = new HashSet<>(Arrays.asList("event", "data", "id", "retry")); + + private SseEventParser() { + // Utility class + } + + /** + * Parse an SSE event using event-level discrimination. + *

+ * Constructs the full SSE envelope object with event, data, id, and retry fields, + * then deserializes it to the target union type. + * + * @param eventType The SSE event type (from event: field) + * @param data The SSE data content (from data: field) + * @param id The SSE event ID (from id: field), may be null + * @param retry The SSE retry value (from retry: field), may be null + * @param unionClass The target union class + * @param discriminatorProperty The property name used for discrimination (e.g., "event") + * @param The target type + * @return The deserialized object + */ + public static T parseEventLevelUnion( + String eventType, String data, String id, Long retry, Class unionClass, String discriminatorProperty) { + try { + // Determine if data should be parsed as JSON based on the variant's expected type + Object parsedData = parseDataForVariant(eventType, data, unionClass, discriminatorProperty); + + // Construct the SSE envelope object + Map envelope = new HashMap<>(); + envelope.put(discriminatorProperty, eventType); + envelope.put("data", parsedData); + if (id != null) { + envelope.put("id", id); + } + if (retry != null) { + envelope.put("retry", retry); + } + + // Serialize to JSON and deserialize to target type + String envelopeJson = ObjectMappers.JSON_MAPPER.writeValueAsString(envelope); + return ObjectMappers.JSON_MAPPER.readValue(envelopeJson, unionClass); + } catch (Exception e) { + throw new RuntimeException("Failed to parse SSE event with event-level discrimination", e); + } + } + + /** + * Parse an SSE event using data-level discrimination. + *

+ * Simply parses the data field as JSON and deserializes it to the target type. + * Jackson's polymorphic deserialization handles the discrimination automatically. + * + * @param data The SSE data content (from data: field) + * @param valueType The target type + * @param The target type + * @return The deserialized object + */ + public static T parseDataLevelUnion(String data, Class valueType) { + try { + return ObjectMappers.JSON_MAPPER.readValue(data, valueType); + } catch (Exception e) { + throw new RuntimeException("Failed to parse SSE data with data-level discrimination", e); + } + } + + /** + * Determines if the given discriminator property indicates event-level discrimination. + * Event-level discrimination occurs when the discriminator is an SSE envelope field. + * + * @param discriminatorProperty The discriminator property name + * @return true if event-level discrimination, false otherwise + */ + public static boolean isEventLevelDiscrimination(String discriminatorProperty) { + return SSE_ENVELOPE_FIELDS.contains(discriminatorProperty); + } + + /** + * Attempts to find the discriminator property from the union class's Jackson annotations. + * + * @param unionClass The union class to inspect + * @return The discriminator property name, or empty if not found + */ + public static Optional findDiscriminatorProperty(Class unionClass) { + try { + // Look for JsonTypeInfo on the class itself + JsonTypeInfo typeInfo = unionClass.getAnnotation(JsonTypeInfo.class); + if (typeInfo != null && !typeInfo.property().isEmpty()) { + return Optional.of(typeInfo.property()); + } + + // Look for inner Value interface with JsonTypeInfo + for (Class innerClass : unionClass.getDeclaredClasses()) { + typeInfo = innerClass.getAnnotation(JsonTypeInfo.class); + if (typeInfo != null && !typeInfo.property().isEmpty()) { + return Optional.of(typeInfo.property()); + } + } + } catch (Exception e) { + // Ignore reflection errors + } + return Optional.empty(); + } + + /** + * Parse the data field based on what the matching variant expects. + * If the variant expects a String for its data field, returns the raw string. + * Otherwise, parses the data as JSON. + */ + private static Object parseDataForVariant( + String eventType, String data, Class unionClass, String discriminatorProperty) { + if (data == null || data.isEmpty()) { + return data; + } + + try { + // Try to find the variant class that matches this event type + Class variantClass = findVariantClass(unionClass, eventType, discriminatorProperty); + if (variantClass != null) { + // Check if the variant expects a String for the data field + Field dataField = findField(variantClass, "data"); + if (dataField != null && String.class.equals(dataField.getType())) { + // Variant expects String - return raw data + return data; + } + } + + // Try to parse as JSON + return ObjectMappers.JSON_MAPPER.readValue(data, new TypeReference>() {}); + } catch (Exception e) { + // If JSON parsing fails, return as string + return data; + } + } + + /** + * Find the variant class that matches the given discriminator value. + */ + private static Class findVariantClass( + Class unionClass, String discriminatorValue, String discriminatorProperty) { + try { + // Look for JsonSubTypes annotation + JsonSubTypes subTypes = findJsonSubTypes(unionClass); + if (subTypes == null) { + return null; + } + + for (JsonSubTypes.Type subType : subTypes.value()) { + JsonTypeName typeName = subType.value().getAnnotation(JsonTypeName.class); + if (typeName != null && typeName.value().equals(discriminatorValue)) { + return subType.value(); + } + // Also check the name attribute of @JsonSubTypes.Type + if (subType.name().equals(discriminatorValue)) { + return subType.value(); + } + } + } catch (Exception e) { + // Ignore reflection errors + } + return null; + } + + /** + * Find JsonSubTypes annotation on the class or its inner classes. + */ + private static JsonSubTypes findJsonSubTypes(Class unionClass) { + // Check the class itself + JsonSubTypes subTypes = unionClass.getAnnotation(JsonSubTypes.class); + if (subTypes != null) { + return subTypes; + } + + // Check inner classes (for Fern-style unions with inner Value interface) + for (Class innerClass : unionClass.getDeclaredClasses()) { + subTypes = innerClass.getAnnotation(JsonSubTypes.class); + if (subTypes != null) { + return subTypes; + } + } + return null; + } + + /** + * Find a field by name in a class, including private fields. + */ + private static Field findField(Class clazz, String fieldName) { + try { + return clazz.getDeclaredField(fieldName); + } catch (NoSuchFieldException e) { + // Check superclass + Class superClass = clazz.getSuperclass(); + if (superClass != null && superClass != Object.class) { + return findField(superClass, fieldName); + } + return null; + } + } +} diff --git a/src/main/java/com/deepgram/core/Stream.java b/src/main/java/com/deepgram/core/Stream.java new file mode 100644 index 0000000..9990912 --- /dev/null +++ b/src/main/java/com/deepgram/core/Stream.java @@ -0,0 +1,513 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.core; + +import java.io.Closeable; +import java.io.IOException; +import java.io.Reader; +import java.util.Iterator; +import java.util.NoSuchElementException; +import java.util.Scanner; + +/** + * The {@code Stream} class implements {@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. + * Iterable stream for parsing JSON and Server-Sent Events (SSE) data. + * Supports both newline-delimited JSON and SSE with optional stream termination. + * + * @param The type of objects in the stream. + */ +public final class Stream implements Iterable, Closeable { + + private static final String NEWLINE = "\n"; + private static final String DATA_PREFIX = "data:"; + + public enum StreamType { + JSON, + SSE, + SSE_EVENT_DISCRIMINATED + } + + private final Class valueType; + private final Scanner scanner; + private final StreamType streamType; + private final String messageTerminator; + private final String streamTerminator; + private final Reader sseReader; + private final String discriminatorProperty; + private boolean isClosed = false; + + /** + * 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.valueType = valueType; + this.scanner = new Scanner(reader).useDelimiter(delimiter); + this.streamType = StreamType.JSON; + this.messageTerminator = delimiter; + this.streamTerminator = null; + this.sseReader = null; + this.discriminatorProperty = null; + } + + private Stream(Class valueType, StreamType type, Reader reader, String terminator) { + this(valueType, type, reader, terminator, null); + } + + private Stream( + Class valueType, StreamType type, Reader reader, String terminator, String discriminatorProperty) { + this.valueType = valueType; + this.streamType = type; + this.discriminatorProperty = discriminatorProperty; + if (type == StreamType.JSON) { + this.scanner = new Scanner(reader).useDelimiter(terminator); + this.messageTerminator = terminator; + this.streamTerminator = null; + this.sseReader = null; + } else { + this.scanner = null; + this.messageTerminator = NEWLINE; + this.streamTerminator = terminator; + this.sseReader = reader; + } + } + + public static Stream fromJson(Class valueType, Reader reader, String delimiter) { + return new Stream<>(valueType, reader, delimiter); + } + + public static Stream fromJson(Class valueType, Reader reader) { + return new Stream<>(valueType, reader, NEWLINE); + } + + public static Stream fromSse(Class valueType, Reader sseReader) { + return new Stream<>(valueType, StreamType.SSE, sseReader, null); + } + + public static Stream fromSse(Class valueType, Reader sseReader, String streamTerminator) { + return new Stream<>(valueType, StreamType.SSE, sseReader, streamTerminator); + } + + /** + * Creates a stream from SSE data with event-level discrimination support. + * Use this when the SSE payload is a discriminated union where the discriminator + * is an SSE envelope field (e.g., 'event'). + * + * @param valueType The class of the objects in the stream. + * @param sseReader The reader that provides the SSE data. + * @param discriminatorProperty The property name used for discrimination (e.g., "event"). + * @param The type of objects in the stream. + * @return A new Stream instance configured for SSE with event-level discrimination. + */ + public static Stream fromSseWithEventDiscrimination( + Class valueType, Reader sseReader, String discriminatorProperty) { + return new Stream<>(valueType, StreamType.SSE_EVENT_DISCRIMINATED, sseReader, null, discriminatorProperty); + } + + /** + * Creates a stream from SSE data with event-level discrimination support and a stream terminator. + * + * @param valueType The class of the objects in the stream. + * @param sseReader The reader that provides the SSE data. + * @param discriminatorProperty The property name used for discrimination (e.g., "event"). + * @param streamTerminator The terminator string that signals end of stream (e.g., "[DONE]"). + * @param The type of objects in the stream. + * @return A new Stream instance configured for SSE with event-level discrimination. + */ + public static Stream fromSseWithEventDiscrimination( + Class valueType, Reader sseReader, String discriminatorProperty, String streamTerminator) { + return new Stream<>( + valueType, StreamType.SSE_EVENT_DISCRIMINATED, sseReader, streamTerminator, discriminatorProperty); + } + + @Override + public void close() throws IOException { + if (!isClosed) { + isClosed = true; + if (scanner != null) { + scanner.close(); + } + if (sseReader != null) { + sseReader.close(); + } + } + } + + private boolean isStreamClosed() { + return isClosed; + } + + /** + * 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() { + switch (streamType) { + case SSE: + return new SSEIterator(); + case SSE_EVENT_DISCRIMINATED: + return new SSEEventDiscriminatedIterator(); + case JSON: + default: + return new JsonIterator(); + } + } + + private final class JsonIterator implements 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() { + if (isStreamClosed()) { + return false; + } + 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 (isStreamClosed()) { + throw new NoSuchElementException("Stream is closed"); + } + + 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); + } + } + } + + @Override + public void remove() { + throw new UnsupportedOperationException(); + } + } + + private final class SSEIterator implements Iterator { + private Scanner sseScanner; + private T nextItem; + private boolean hasNextItem = false; + private boolean endOfStream = false; + private StringBuilder eventDataBuffer = new StringBuilder(); + private String currentEventType = null; + + private SSEIterator() { + if (sseReader != null && !isStreamClosed()) { + this.sseScanner = new Scanner(sseReader); + } else { + this.endOfStream = true; + } + } + + @Override + public boolean hasNext() { + if (isStreamClosed() || endOfStream) { + return false; + } + + if (hasNextItem) { + return true; + } + + return readNextMessage(); + } + + @Override + public T next() { + if (!hasNext()) { + throw new NoSuchElementException("No more elements in stream"); + } + + T result = nextItem; + nextItem = null; + hasNextItem = false; + return result; + } + + @Override + public void remove() { + throw new UnsupportedOperationException(); + } + + private boolean readNextMessage() { + if (sseScanner == null || isStreamClosed()) { + endOfStream = true; + return false; + } + + try { + while (sseScanner.hasNextLine()) { + String line = sseScanner.nextLine(); + + if (line.trim().isEmpty()) { + if (eventDataBuffer.length() > 0) { + try { + nextItem = ObjectMappers.JSON_MAPPER.readValue(eventDataBuffer.toString(), valueType); + hasNextItem = true; + eventDataBuffer.setLength(0); + currentEventType = null; + return true; + } catch (Exception parseEx) { + System.err.println("Failed to parse SSE event: " + parseEx.getMessage()); + eventDataBuffer.setLength(0); + currentEventType = null; + continue; + } + } + continue; + } + + if (line.startsWith(DATA_PREFIX)) { + String dataContent = line.substring(DATA_PREFIX.length()); + if (dataContent.startsWith(" ")) { + dataContent = dataContent.substring(1); + } + + if (eventDataBuffer.length() == 0 + && streamTerminator != null + && dataContent.trim().equals(streamTerminator)) { + endOfStream = true; + return false; + } + + if (eventDataBuffer.length() > 0) { + eventDataBuffer.append('\n'); + } + eventDataBuffer.append(dataContent); + } else if (line.startsWith("event:")) { + String eventValue = line.length() > 6 ? line.substring(6) : ""; + if (eventValue.startsWith(" ")) { + eventValue = eventValue.substring(1); + } + currentEventType = eventValue; + } else if (line.startsWith("id:")) { + // Event ID field (ignored) + } else if (line.startsWith("retry:")) { + // Retry field (ignored) + } else if (line.startsWith(":")) { + // Comment line (ignored) + } + } + + if (eventDataBuffer.length() > 0) { + try { + nextItem = ObjectMappers.JSON_MAPPER.readValue(eventDataBuffer.toString(), valueType); + hasNextItem = true; + eventDataBuffer.setLength(0); + currentEventType = null; + return true; + } catch (Exception parseEx) { + System.err.println("Failed to parse final SSE event: " + parseEx.getMessage()); + eventDataBuffer.setLength(0); + currentEventType = null; + } + } + + endOfStream = true; + return false; + + } catch (Exception e) { + System.err.println("Failed to parse SSE stream: " + e.getMessage()); + endOfStream = true; + return false; + } + } + } + + /** + * Iterator for SSE streams with event-level discrimination. + * Uses SseEventParser to construct the full SSE envelope for Jackson deserialization. + */ + private final class SSEEventDiscriminatedIterator implements Iterator { + private Scanner sseScanner; + private T nextItem; + private boolean hasNextItem = false; + private boolean endOfStream = false; + private StringBuilder eventDataBuffer = new StringBuilder(); + private String currentEventType = null; + private String currentEventId = null; + private Long currentRetry = null; + + private SSEEventDiscriminatedIterator() { + if (sseReader != null && !isStreamClosed()) { + this.sseScanner = new Scanner(sseReader); + } else { + this.endOfStream = true; + } + } + + @Override + public boolean hasNext() { + if (isStreamClosed() || endOfStream) { + return false; + } + + if (hasNextItem) { + return true; + } + + return readNextMessage(); + } + + @Override + public T next() { + if (!hasNext()) { + throw new NoSuchElementException("No more elements in stream"); + } + + T result = nextItem; + nextItem = null; + hasNextItem = false; + return result; + } + + @Override + public void remove() { + throw new UnsupportedOperationException(); + } + + private boolean readNextMessage() { + if (sseScanner == null || isStreamClosed()) { + endOfStream = true; + return false; + } + + try { + while (sseScanner.hasNextLine()) { + String line = sseScanner.nextLine(); + + if (line.trim().isEmpty()) { + if (eventDataBuffer.length() > 0 || currentEventType != null) { + try { + // Use SseEventParser for event-level discrimination + nextItem = SseEventParser.parseEventLevelUnion( + currentEventType, + eventDataBuffer.toString(), + currentEventId, + currentRetry, + valueType, + discriminatorProperty); + hasNextItem = true; + resetEventState(); + return true; + } catch (Exception parseEx) { + System.err.println("Failed to parse SSE event: " + parseEx.getMessage()); + resetEventState(); + continue; + } + } + continue; + } + + if (line.startsWith(DATA_PREFIX)) { + String dataContent = line.substring(DATA_PREFIX.length()); + if (dataContent.startsWith(" ")) { + dataContent = dataContent.substring(1); + } + + if (eventDataBuffer.length() == 0 + && streamTerminator != null + && dataContent.trim().equals(streamTerminator)) { + endOfStream = true; + return false; + } + + if (eventDataBuffer.length() > 0) { + eventDataBuffer.append('\n'); + } + eventDataBuffer.append(dataContent); + } else if (line.startsWith("event:")) { + String eventValue = line.length() > 6 ? line.substring(6) : ""; + if (eventValue.startsWith(" ")) { + eventValue = eventValue.substring(1); + } + currentEventType = eventValue; + } else if (line.startsWith("id:")) { + String idValue = line.length() > 3 ? line.substring(3) : ""; + if (idValue.startsWith(" ")) { + idValue = idValue.substring(1); + } + currentEventId = idValue; + } else if (line.startsWith("retry:")) { + String retryValue = line.length() > 6 ? line.substring(6) : ""; + if (retryValue.startsWith(" ")) { + retryValue = retryValue.substring(1); + } + try { + currentRetry = Long.parseLong(retryValue.trim()); + } catch (NumberFormatException e) { + // Ignore invalid retry values + } + } else if (line.startsWith(":")) { + // Comment line (ignored) + } + } + + // Handle any remaining buffered data at end of stream + if (eventDataBuffer.length() > 0 || currentEventType != null) { + try { + nextItem = SseEventParser.parseEventLevelUnion( + currentEventType, + eventDataBuffer.toString(), + currentEventId, + currentRetry, + valueType, + discriminatorProperty); + hasNextItem = true; + resetEventState(); + return true; + } catch (Exception parseEx) { + System.err.println("Failed to parse final SSE event: " + parseEx.getMessage()); + resetEventState(); + } + } + + endOfStream = true; + return false; + + } catch (Exception e) { + System.err.println("Failed to parse SSE stream: " + e.getMessage()); + endOfStream = true; + return false; + } + } + + private void resetEventState() { + eventDataBuffer.setLength(0); + currentEventType = null; + currentEventId = null; + currentRetry = null; + } + } +} diff --git a/src/main/java/com/deepgram/core/Suppliers.java b/src/main/java/com/deepgram/core/Suppliers.java new file mode 100644 index 0000000..ce8152a --- /dev/null +++ b/src/main/java/com/deepgram/core/Suppliers.java @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.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/deepgram/core/WebSocketFactory.java b/src/main/java/com/deepgram/core/WebSocketFactory.java new file mode 100644 index 0000000..aed8249 --- /dev/null +++ b/src/main/java/com/deepgram/core/WebSocketFactory.java @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.core; + +import okhttp3.Request; +import okhttp3.WebSocket; +import okhttp3.WebSocketListener; + +/** + * Factory interface for creating WebSocket connections. + * Allows for pluggable WebSocket implementations and testing. + */ +public interface WebSocketFactory { + /** + * Creates a WebSocket connection with the specified request and listener. + * + * @param request The WebSocket connection request with URL and headers + * @param listener The listener for WebSocket events + * @return A WebSocket instance ready for communication + */ + WebSocket create(Request request, WebSocketListener listener); +} diff --git a/src/main/java/com/deepgram/core/WebSocketReadyState.java b/src/main/java/com/deepgram/core/WebSocketReadyState.java new file mode 100644 index 0000000..532b433 --- /dev/null +++ b/src/main/java/com/deepgram/core/WebSocketReadyState.java @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.core; + +/** + * WebSocket connection ready state, based on the W3C WebSocket API. + */ +public enum WebSocketReadyState { + /** + * The connection is being established. + */ + CONNECTING, + + /** + * The connection is open and ready to communicate. + */ + OPEN, + + /** + * The connection is in the process of closing. + */ + CLOSING, + + /** + * The connection is closed. + */ + CLOSED +} diff --git a/src/main/java/com/deepgram/core/WrappedAlias.java b/src/main/java/com/deepgram/core/WrappedAlias.java new file mode 100644 index 0000000..6004719 --- /dev/null +++ b/src/main/java/com/deepgram/core/WrappedAlias.java @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.core; + +public interface WrappedAlias { + Object get(); +} diff --git a/src/main/java/com/deepgram/errors/BadRequestError.java b/src/main/java/com/deepgram/errors/BadRequestError.java new file mode 100644 index 0000000..00ecb1d --- /dev/null +++ b/src/main/java/com/deepgram/errors/BadRequestError.java @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.errors; + +import com.deepgram.core.DeepgramApiApiException; +import okhttp3.Response; + +public final class BadRequestError extends DeepgramApiApiException { + /** + * The body of the response that triggered the exception. + */ + private final Object body; + + public BadRequestError(Object body) { + super("BadRequestError", 400, body); + this.body = body; + } + + public BadRequestError(Object body, Response rawResponse) { + super("BadRequestError", 400, body, rawResponse); + this.body = body; + } + + /** + * @return the body + */ + @java.lang.Override + public Object body() { + return this.body; + } +} diff --git a/src/main/java/com/deepgram/resources/agent/AgentClient.java b/src/main/java/com/deepgram/resources/agent/AgentClient.java new file mode 100644 index 0000000..036ca56 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/AgentClient.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.Suppliers; +import com.deepgram.resources.agent.v1.V1Client; +import java.util.function.Supplier; + +public class AgentClient { + protected final ClientOptions clientOptions; + + protected final Supplier v1Client; + + public AgentClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.v1Client = Suppliers.memoize(() -> new V1Client(clientOptions)); + } + + public V1Client v1() { + return this.v1Client.get(); + } +} diff --git a/src/main/java/com/deepgram/resources/agent/AsyncAgentClient.java b/src/main/java/com/deepgram/resources/agent/AsyncAgentClient.java new file mode 100644 index 0000000..bf6f07e --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/AsyncAgentClient.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.Suppliers; +import com.deepgram.resources.agent.v1.AsyncV1Client; +import java.util.function.Supplier; + +public class AsyncAgentClient { + protected final ClientOptions clientOptions; + + protected final Supplier v1Client; + + public AsyncAgentClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.v1Client = Suppliers.memoize(() -> new AsyncV1Client(clientOptions)); + } + + public AsyncV1Client v1() { + return this.v1Client.get(); + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/AsyncV1Client.java b/src/main/java/com/deepgram/resources/agent/v1/AsyncV1Client.java new file mode 100644 index 0000000..089dde7 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/AsyncV1Client.java @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.Suppliers; +import com.deepgram.resources.agent.v1.settings.AsyncSettingsClient; +import com.deepgram.resources.agent.v1.websocket.V1WebSocketClient; +import java.util.function.Supplier; + +public class AsyncV1Client { + protected final ClientOptions clientOptions; + + protected final Supplier settingsClient; + + public AsyncV1Client(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.settingsClient = Suppliers.memoize(() -> new AsyncSettingsClient(clientOptions)); + } + + /** + * Creates a new WebSocket client for the v1 channel. + */ + public V1WebSocketClient v1WebSocket() { + return new V1WebSocketClient(clientOptions); + } + + public AsyncSettingsClient settings() { + return this.settingsClient.get(); + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/V1Client.java b/src/main/java/com/deepgram/resources/agent/v1/V1Client.java new file mode 100644 index 0000000..3cc3b46 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/V1Client.java @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.Suppliers; +import com.deepgram.resources.agent.v1.settings.SettingsClient; +import com.deepgram.resources.agent.v1.websocket.V1WebSocketClient; +import java.util.function.Supplier; + +public class V1Client { + protected final ClientOptions clientOptions; + + protected final Supplier settingsClient; + + public V1Client(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.settingsClient = Suppliers.memoize(() -> new SettingsClient(clientOptions)); + } + + /** + * Creates a new WebSocket client for the v1 channel. + */ + public V1WebSocketClient v1WebSocket() { + return new V1WebSocketClient(clientOptions); + } + + public SettingsClient settings() { + return this.settingsClient.get(); + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/settings/AsyncSettingsClient.java b/src/main/java/com/deepgram/resources/agent/v1/settings/AsyncSettingsClient.java new file mode 100644 index 0000000..bbe124d --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/settings/AsyncSettingsClient.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.settings; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.Suppliers; +import com.deepgram.resources.agent.v1.settings.think.AsyncThinkClient; +import java.util.function.Supplier; + +public class AsyncSettingsClient { + protected final ClientOptions clientOptions; + + protected final Supplier thinkClient; + + public AsyncSettingsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.thinkClient = Suppliers.memoize(() -> new AsyncThinkClient(clientOptions)); + } + + public AsyncThinkClient think() { + return this.thinkClient.get(); + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/settings/SettingsClient.java b/src/main/java/com/deepgram/resources/agent/v1/settings/SettingsClient.java new file mode 100644 index 0000000..e6e34ca --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/settings/SettingsClient.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.settings; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.Suppliers; +import com.deepgram.resources.agent.v1.settings.think.ThinkClient; +import java.util.function.Supplier; + +public class SettingsClient { + protected final ClientOptions clientOptions; + + protected final Supplier thinkClient; + + public SettingsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.thinkClient = Suppliers.memoize(() -> new ThinkClient(clientOptions)); + } + + public ThinkClient think() { + return this.thinkClient.get(); + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/settings/think/AsyncThinkClient.java b/src/main/java/com/deepgram/resources/agent/v1/settings/think/AsyncThinkClient.java new file mode 100644 index 0000000..7068a0d --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/settings/think/AsyncThinkClient.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.settings.think; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.Suppliers; +import com.deepgram.resources.agent.v1.settings.think.models.AsyncModelsClient; +import java.util.function.Supplier; + +public class AsyncThinkClient { + protected final ClientOptions clientOptions; + + protected final Supplier modelsClient; + + public AsyncThinkClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.modelsClient = Suppliers.memoize(() -> new AsyncModelsClient(clientOptions)); + } + + public AsyncModelsClient models() { + return this.modelsClient.get(); + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/settings/think/ThinkClient.java b/src/main/java/com/deepgram/resources/agent/v1/settings/think/ThinkClient.java new file mode 100644 index 0000000..7b6ec85 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/settings/think/ThinkClient.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.settings.think; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.Suppliers; +import com.deepgram.resources.agent.v1.settings.think.models.ModelsClient; +import java.util.function.Supplier; + +public class ThinkClient { + protected final ClientOptions clientOptions; + + protected final Supplier modelsClient; + + public ThinkClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.modelsClient = Suppliers.memoize(() -> new ModelsClient(clientOptions)); + } + + public ModelsClient models() { + return this.modelsClient.get(); + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/settings/think/models/AsyncModelsClient.java b/src/main/java/com/deepgram/resources/agent/v1/settings/think/models/AsyncModelsClient.java new file mode 100644 index 0000000..7790a75 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/settings/think/models/AsyncModelsClient.java @@ -0,0 +1,41 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.settings.think.models; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.RequestOptions; +import com.deepgram.types.AgentThinkModelsV1Response; +import java.util.concurrent.CompletableFuture; + +public class AsyncModelsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawModelsClient rawClient; + + public AsyncModelsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawModelsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawModelsClient withRawResponse() { + return this.rawClient; + } + + /** + * Retrieves the available think models that can be used for AI agent processing + */ + public CompletableFuture list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Retrieves the available think models that can be used for AI agent processing + */ + public CompletableFuture list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/settings/think/models/AsyncRawModelsClient.java b/src/main/java/com/deepgram/resources/agent/v1/settings/think/models/AsyncRawModelsClient.java new file mode 100644 index 0000000..cdc9836 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/settings/think/models/AsyncRawModelsClient.java @@ -0,0 +1,101 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.settings.think.models; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.DeepgramApiApiException; +import com.deepgram.core.DeepgramApiException; +import com.deepgram.core.DeepgramApiHttpResponse; +import com.deepgram.core.ObjectMappers; +import com.deepgram.core.RequestOptions; +import com.deepgram.errors.BadRequestError; +import com.deepgram.types.AgentThinkModelsV1Response; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawModelsClient { + protected final ClientOptions clientOptions; + + public AsyncRawModelsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Retrieves the available think models that can be used for AI agent processing + */ + public CompletableFuture> list() { + return list(null); + } + + /** + * Retrieves the available think models that can be used for AI agent processing + */ + public CompletableFuture> list(RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/agent/settings/think/models"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, AgentThinkModelsV1Response.class), + response)); + return; + } + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/settings/think/models/ModelsClient.java b/src/main/java/com/deepgram/resources/agent/v1/settings/think/models/ModelsClient.java new file mode 100644 index 0000000..1df2a35 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/settings/think/models/ModelsClient.java @@ -0,0 +1,40 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.settings.think.models; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.RequestOptions; +import com.deepgram.types.AgentThinkModelsV1Response; + +public class ModelsClient { + protected final ClientOptions clientOptions; + + private final RawModelsClient rawClient; + + public ModelsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawModelsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawModelsClient withRawResponse() { + return this.rawClient; + } + + /** + * Retrieves the available think models that can be used for AI agent processing + */ + public AgentThinkModelsV1Response list() { + return this.rawClient.list().body(); + } + + /** + * Retrieves the available think models that can be used for AI agent processing + */ + public AgentThinkModelsV1Response list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/settings/think/models/RawModelsClient.java b/src/main/java/com/deepgram/resources/agent/v1/settings/think/models/RawModelsClient.java new file mode 100644 index 0000000..1494c48 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/settings/think/models/RawModelsClient.java @@ -0,0 +1,82 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.settings.think.models; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.DeepgramApiApiException; +import com.deepgram.core.DeepgramApiException; +import com.deepgram.core.DeepgramApiHttpResponse; +import com.deepgram.core.ObjectMappers; +import com.deepgram.core.RequestOptions; +import com.deepgram.errors.BadRequestError; +import com.deepgram.types.AgentThinkModelsV1Response; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawModelsClient { + protected final ClientOptions clientOptions; + + public RawModelsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Retrieves the available think models that can be used for AI agent processing + */ + public DeepgramApiHttpResponse list() { + return list(null); + } + + /** + * Retrieves the available think models that can be used for AI agent processing + */ + public DeepgramApiHttpResponse list(RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/agent/settings/think/models"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, AgentThinkModelsV1Response.class), + response); + } + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new DeepgramApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1AgentAudioDone.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1AgentAudioDone.java new file mode 100644 index 0000000..71825ed --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1AgentAudioDone.java @@ -0,0 +1,78 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AgentV1AgentAudioDone.Builder.class) +public final class AgentV1AgentAudioDone { + private final Map additionalProperties; + + private AgentV1AgentAudioDone(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + /** + * @return Message type identifier indicating the agent has finished sending audio + */ + @JsonProperty("type") + public String getType() { + return "AgentAudioDone"; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1AgentAudioDone; + } + + @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(AgentV1AgentAudioDone other) { + return this; + } + + public AgentV1AgentAudioDone build() { + return new AgentV1AgentAudioDone(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1AgentStartedSpeaking.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1AgentStartedSpeaking.java new file mode 100644 index 0000000..65c5d4e --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1AgentStartedSpeaking.java @@ -0,0 +1,203 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AgentV1AgentStartedSpeaking.Builder.class) +public final class AgentV1AgentStartedSpeaking { + private final float totalLatency; + + private final float ttsLatency; + + private final float tttLatency; + + private final Map additionalProperties; + + private AgentV1AgentStartedSpeaking( + float totalLatency, float ttsLatency, float tttLatency, Map additionalProperties) { + this.totalLatency = totalLatency; + this.ttsLatency = ttsLatency; + this.tttLatency = tttLatency; + this.additionalProperties = additionalProperties; + } + + /** + * @return Message type identifier for agent started speaking + */ + @JsonProperty("type") + public String getType() { + return "AgentStartedSpeaking"; + } + + /** + * @return Seconds from receiving the user's utterance to producing the agent's reply + */ + @JsonProperty("total_latency") + public float getTotalLatency() { + return totalLatency; + } + + /** + * @return The portion of total latency attributable to text-to-speech + */ + @JsonProperty("tts_latency") + public float getTtsLatency() { + return ttsLatency; + } + + /** + * @return The portion of total latency attributable to text-to-text (usually an LLM) + */ + @JsonProperty("ttt_latency") + public float getTttLatency() { + return tttLatency; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1AgentStartedSpeaking && equalTo((AgentV1AgentStartedSpeaking) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1AgentStartedSpeaking other) { + return totalLatency == other.totalLatency && ttsLatency == other.ttsLatency && tttLatency == other.tttLatency; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.totalLatency, this.ttsLatency, this.tttLatency); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TotalLatencyStage builder() { + return new Builder(); + } + + public interface TotalLatencyStage { + /** + *

Seconds from receiving the user's utterance to producing the agent's reply

+ */ + TtsLatencyStage totalLatency(float totalLatency); + + Builder from(AgentV1AgentStartedSpeaking other); + } + + public interface TtsLatencyStage { + /** + *

The portion of total latency attributable to text-to-speech

+ */ + TttLatencyStage ttsLatency(float ttsLatency); + } + + public interface TttLatencyStage { + /** + *

The portion of total latency attributable to text-to-text (usually an LLM)

+ */ + _FinalStage tttLatency(float tttLatency); + } + + public interface _FinalStage { + AgentV1AgentStartedSpeaking build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TotalLatencyStage, TtsLatencyStage, TttLatencyStage, _FinalStage { + private float totalLatency; + + private float ttsLatency; + + private float tttLatency; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentV1AgentStartedSpeaking other) { + totalLatency(other.getTotalLatency()); + ttsLatency(other.getTtsLatency()); + tttLatency(other.getTttLatency()); + return this; + } + + /** + *

Seconds from receiving the user's utterance to producing the agent's reply

+ *

Seconds from receiving the user's utterance to producing the agent's reply

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

The portion of total latency attributable to text-to-speech

+ *

The portion of total latency attributable to text-to-speech

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

The portion of total latency attributable to text-to-text (usually an LLM)

+ *

The portion of total latency attributable to text-to-text (usually an LLM)

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ttt_latency") + public _FinalStage tttLatency(float tttLatency) { + this.tttLatency = tttLatency; + return this; + } + + @java.lang.Override + public AgentV1AgentStartedSpeaking build() { + return new AgentV1AgentStartedSpeaking(totalLatency, ttsLatency, tttLatency, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1AgentThinking.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1AgentThinking.java new file mode 100644 index 0000000..b98b6b5 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1AgentThinking.java @@ -0,0 +1,137 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AgentV1AgentThinking.Builder.class) +public final class AgentV1AgentThinking { + private final String content; + + private final Map additionalProperties; + + private AgentV1AgentThinking(String content, Map additionalProperties) { + this.content = content; + this.additionalProperties = additionalProperties; + } + + /** + * @return Message type identifier for agent thinking + */ + @JsonProperty("type") + public String getType() { + return "AgentThinking"; + } + + /** + * @return The text of the agent's thought process + */ + @JsonProperty("content") + public String getContent() { + return content; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1AgentThinking && equalTo((AgentV1AgentThinking) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1AgentThinking other) { + return content.equals(other.content); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.content); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ContentStage builder() { + return new Builder(); + } + + public interface ContentStage { + /** + *

The text of the agent's thought process

+ */ + _FinalStage content(@NotNull String content); + + Builder from(AgentV1AgentThinking other); + } + + public interface _FinalStage { + AgentV1AgentThinking build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ContentStage, _FinalStage { + private String content; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentV1AgentThinking other) { + content(other.getContent()); + return this; + } + + /** + *

The text of the agent's thought process

+ *

The text of the agent's thought process

+ * @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; + } + + @java.lang.Override + public AgentV1AgentThinking build() { + return new AgentV1AgentThinking(content, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1ConversationText.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1ConversationText.java new file mode 100644 index 0000000..95c005d --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1ConversationText.java @@ -0,0 +1,171 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AgentV1ConversationText.Builder.class) +public final class AgentV1ConversationText { + private final AgentV1ConversationTextRole role; + + private final String content; + + private final Map additionalProperties; + + private AgentV1ConversationText( + AgentV1ConversationTextRole role, String content, Map additionalProperties) { + this.role = role; + this.content = content; + this.additionalProperties = additionalProperties; + } + + /** + * @return Message type identifier for conversation text + */ + @JsonProperty("type") + public String getType() { + return "ConversationText"; + } + + /** + * @return Identifies who spoke the statement + */ + @JsonProperty("role") + public AgentV1ConversationTextRole getRole() { + return role; + } + + /** + * @return The actual statement that was spoken + */ + @JsonProperty("content") + public String getContent() { + return content; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1ConversationText && equalTo((AgentV1ConversationText) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1ConversationText other) { + return role.equals(other.role) && content.equals(other.content); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.role, this.content); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static RoleStage builder() { + return new Builder(); + } + + public interface RoleStage { + /** + *

Identifies who spoke the statement

+ */ + ContentStage role(@NotNull AgentV1ConversationTextRole role); + + Builder from(AgentV1ConversationText other); + } + + public interface ContentStage { + /** + *

The actual statement that was spoken

+ */ + _FinalStage content(@NotNull String content); + } + + public interface _FinalStage { + AgentV1ConversationText build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements RoleStage, ContentStage, _FinalStage { + private AgentV1ConversationTextRole role; + + private String content; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentV1ConversationText other) { + role(other.getRole()); + content(other.getContent()); + return this; + } + + /** + *

Identifies who spoke the statement

+ *

Identifies who spoke the statement

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

The actual statement that was spoken

+ *

The actual statement that was spoken

+ * @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; + } + + @java.lang.Override + public AgentV1ConversationText build() { + return new AgentV1ConversationText(role, content, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1ConversationTextRole.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1ConversationTextRole.java new file mode 100644 index 0000000..d59439e --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1ConversationTextRole.java @@ -0,0 +1,85 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AgentV1ConversationTextRole { + public static final AgentV1ConversationTextRole ASSISTANT = + new AgentV1ConversationTextRole(Value.ASSISTANT, "assistant"); + + public static final AgentV1ConversationTextRole USER = new AgentV1ConversationTextRole(Value.USER, "user"); + + private final Value value; + + private final String string; + + AgentV1ConversationTextRole(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AgentV1ConversationTextRole + && this.string.equals(((AgentV1ConversationTextRole) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ASSISTANT: + return visitor.visitAssistant(); + case USER: + return visitor.visitUser(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AgentV1ConversationTextRole valueOf(String value) { + switch (value) { + case "assistant": + return ASSISTANT; + case "user": + return USER; + default: + return new AgentV1ConversationTextRole(Value.UNKNOWN, value); + } + } + + public enum Value { + USER, + + ASSISTANT, + + UNKNOWN + } + + public interface Visitor { + T visitUser(); + + T visitAssistant(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1Error.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1Error.java new file mode 100644 index 0000000..aa97cc9 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1Error.java @@ -0,0 +1,170 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AgentV1Error.Builder.class) +public final class AgentV1Error { + private final String description; + + private final String code; + + private final Map additionalProperties; + + private AgentV1Error(String description, String code, Map additionalProperties) { + this.description = description; + this.code = code; + this.additionalProperties = additionalProperties; + } + + /** + * @return Message type identifier for error responses + */ + @JsonProperty("type") + public String getType() { + return "Error"; + } + + /** + * @return A description of what went wrong + */ + @JsonProperty("description") + public String getDescription() { + return description; + } + + /** + * @return Error code identifying the type of error + */ + @JsonProperty("code") + public String getCode() { + return code; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1Error && equalTo((AgentV1Error) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1Error other) { + return description.equals(other.description) && code.equals(other.code); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.description, this.code); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DescriptionStage builder() { + return new Builder(); + } + + public interface DescriptionStage { + /** + *

A description of what went wrong

+ */ + CodeStage description(@NotNull String description); + + Builder from(AgentV1Error other); + } + + public interface CodeStage { + /** + *

Error code identifying the type of error

+ */ + _FinalStage code(@NotNull String code); + } + + public interface _FinalStage { + AgentV1Error build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DescriptionStage, CodeStage, _FinalStage { + private String description; + + private String code; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentV1Error other) { + description(other.getDescription()); + code(other.getCode()); + return this; + } + + /** + *

A description of what went wrong

+ *

A description of what went wrong

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

Error code identifying the type of error

+ *

Error code identifying the type of error

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("code") + public _FinalStage code(@NotNull String code) { + this.code = Objects.requireNonNull(code, "code must not be null"); + return this; + } + + @java.lang.Override + public AgentV1Error build() { + return new AgentV1Error(description, code, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1FunctionCallRequest.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1FunctionCallRequest.java new file mode 100644 index 0000000..074e912 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1FunctionCallRequest.java @@ -0,0 +1,131 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = AgentV1FunctionCallRequest.Builder.class) +public final class AgentV1FunctionCallRequest { + private final List functions; + + private final Map additionalProperties; + + private AgentV1FunctionCallRequest( + List functions, Map additionalProperties) { + this.functions = functions; + this.additionalProperties = additionalProperties; + } + + /** + * @return Message type identifier for function call requests + */ + @JsonProperty("type") + public String getType() { + return "FunctionCallRequest"; + } + + /** + * @return Array of functions to be called + */ + @JsonProperty("functions") + public List getFunctions() { + return functions; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1FunctionCallRequest && equalTo((AgentV1FunctionCallRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1FunctionCallRequest other) { + return functions.equals(other.functions); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.functions); + } + + @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 functions = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AgentV1FunctionCallRequest other) { + functions(other.getFunctions()); + return this; + } + + /** + *

Array of functions to be called

+ */ + @JsonSetter(value = "functions", nulls = Nulls.SKIP) + public Builder functions(List functions) { + this.functions.clear(); + if (functions != null) { + this.functions.addAll(functions); + } + return this; + } + + public Builder addFunctions(AgentV1FunctionCallRequestFunctionsItem functions) { + this.functions.add(functions); + return this; + } + + public Builder addAllFunctions(List functions) { + if (functions != null) { + this.functions.addAll(functions); + } + return this; + } + + public AgentV1FunctionCallRequest build() { + return new AgentV1FunctionCallRequest(functions, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1FunctionCallRequestFunctionsItem.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1FunctionCallRequestFunctionsItem.java new file mode 100644 index 0000000..cba0f6b --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1FunctionCallRequestFunctionsItem.java @@ -0,0 +1,233 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AgentV1FunctionCallRequestFunctionsItem.Builder.class) +public final class AgentV1FunctionCallRequestFunctionsItem { + private final String id; + + private final String name; + + private final String arguments; + + private final boolean clientSide; + + private final Map additionalProperties; + + private AgentV1FunctionCallRequestFunctionsItem( + String id, String name, String arguments, boolean clientSide, Map additionalProperties) { + this.id = id; + this.name = name; + this.arguments = arguments; + this.clientSide = clientSide; + this.additionalProperties = additionalProperties; + } + + /** + * @return Unique identifier for the function call + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The name of the function to call + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return JSON string containing the function arguments + */ + @JsonProperty("arguments") + public String getArguments() { + return arguments; + } + + /** + * @return Whether the function should be executed client-side + */ + @JsonProperty("client_side") + public boolean getClientSide() { + return clientSide; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1FunctionCallRequestFunctionsItem + && equalTo((AgentV1FunctionCallRequestFunctionsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1FunctionCallRequestFunctionsItem other) { + return id.equals(other.id) + && name.equals(other.name) + && arguments.equals(other.arguments) + && clientSide == other.clientSide; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.arguments, this.clientSide); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Unique identifier for the function call

+ */ + NameStage id(@NotNull String id); + + Builder from(AgentV1FunctionCallRequestFunctionsItem other); + } + + public interface NameStage { + /** + *

The name of the function to call

+ */ + ArgumentsStage name(@NotNull String name); + } + + public interface ArgumentsStage { + /** + *

JSON string containing the function arguments

+ */ + ClientSideStage arguments(@NotNull String arguments); + } + + public interface ClientSideStage { + /** + *

Whether the function should be executed client-side

+ */ + _FinalStage clientSide(boolean clientSide); + } + + public interface _FinalStage { + AgentV1FunctionCallRequestFunctionsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, NameStage, ArgumentsStage, ClientSideStage, _FinalStage { + private String id; + + private String name; + + private String arguments; + + private boolean clientSide; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentV1FunctionCallRequestFunctionsItem other) { + id(other.getId()); + name(other.getName()); + arguments(other.getArguments()); + clientSide(other.getClientSide()); + return this; + } + + /** + *

Unique identifier for the function call

+ *

Unique identifier for the function call

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

The name of the function to call

+ *

The name of the function to call

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

JSON string containing the function arguments

+ *

JSON string containing the function arguments

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

Whether the function should be executed client-side

+ *

Whether the function should be executed client-side

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("client_side") + public _FinalStage clientSide(boolean clientSide) { + this.clientSide = clientSide; + return this; + } + + @java.lang.Override + public AgentV1FunctionCallRequestFunctionsItem build() { + return new AgentV1FunctionCallRequestFunctionsItem(id, name, arguments, clientSide, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1InjectAgentMessage.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1InjectAgentMessage.java new file mode 100644 index 0000000..bcadf23 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1InjectAgentMessage.java @@ -0,0 +1,137 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AgentV1InjectAgentMessage.Builder.class) +public final class AgentV1InjectAgentMessage { + private final String message; + + private final Map additionalProperties; + + private AgentV1InjectAgentMessage(String message, Map additionalProperties) { + this.message = message; + this.additionalProperties = additionalProperties; + } + + /** + * @return Message type identifier for injecting an agent message + */ + @JsonProperty("type") + public String getType() { + return "InjectAgentMessage"; + } + + /** + * @return The statement that the agent should say + */ + @JsonProperty("message") + public String getMessage() { + return message; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1InjectAgentMessage && equalTo((AgentV1InjectAgentMessage) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1InjectAgentMessage 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 { + /** + *

The statement that the agent should say

+ */ + _FinalStage message(@NotNull String message); + + Builder from(AgentV1InjectAgentMessage other); + } + + public interface _FinalStage { + AgentV1InjectAgentMessage build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @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(AgentV1InjectAgentMessage other) { + message(other.getMessage()); + return this; + } + + /** + *

The statement that the agent should say

+ *

The statement that the agent should say

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @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 AgentV1InjectAgentMessage build() { + return new AgentV1InjectAgentMessage(message, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1InjectUserMessage.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1InjectUserMessage.java new file mode 100644 index 0000000..38696b6 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1InjectUserMessage.java @@ -0,0 +1,137 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AgentV1InjectUserMessage.Builder.class) +public final class AgentV1InjectUserMessage { + private final String content; + + private final Map additionalProperties; + + private AgentV1InjectUserMessage(String content, Map additionalProperties) { + this.content = content; + this.additionalProperties = additionalProperties; + } + + /** + * @return Message type identifier for injecting a user message + */ + @JsonProperty("type") + public String getType() { + return "InjectUserMessage"; + } + + /** + * @return The specific phrase or statement the agent should respond to + */ + @JsonProperty("content") + public String getContent() { + return content; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1InjectUserMessage && equalTo((AgentV1InjectUserMessage) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1InjectUserMessage other) { + return content.equals(other.content); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.content); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ContentStage builder() { + return new Builder(); + } + + public interface ContentStage { + /** + *

The specific phrase or statement the agent should respond to

+ */ + _FinalStage content(@NotNull String content); + + Builder from(AgentV1InjectUserMessage other); + } + + public interface _FinalStage { + AgentV1InjectUserMessage build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ContentStage, _FinalStage { + private String content; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentV1InjectUserMessage other) { + content(other.getContent()); + return this; + } + + /** + *

The specific phrase or statement the agent should respond to

+ *

The specific phrase or statement the agent should respond to

+ * @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; + } + + @java.lang.Override + public AgentV1InjectUserMessage build() { + return new AgentV1InjectUserMessage(content, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1InjectionRefused.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1InjectionRefused.java new file mode 100644 index 0000000..8a2250d --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1InjectionRefused.java @@ -0,0 +1,137 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AgentV1InjectionRefused.Builder.class) +public final class AgentV1InjectionRefused { + private final String message; + + private final Map additionalProperties; + + private AgentV1InjectionRefused(String message, Map additionalProperties) { + this.message = message; + this.additionalProperties = additionalProperties; + } + + /** + * @return Message type identifier for injection refused + */ + @JsonProperty("type") + public String getType() { + return "InjectionRefused"; + } + + /** + * @return Details about why the injection was refused + */ + @JsonProperty("message") + public String getMessage() { + return message; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1InjectionRefused && equalTo((AgentV1InjectionRefused) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1InjectionRefused 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 { + /** + *

Details about why the injection was refused

+ */ + _FinalStage message(@NotNull String message); + + Builder from(AgentV1InjectionRefused other); + } + + public interface _FinalStage { + AgentV1InjectionRefused build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @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(AgentV1InjectionRefused other) { + message(other.getMessage()); + return this; + } + + /** + *

Details about why the injection was refused

+ *

Details about why the injection was refused

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @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 AgentV1InjectionRefused build() { + return new AgentV1InjectionRefused(message, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1KeepAlive.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1KeepAlive.java new file mode 100644 index 0000000..7842266 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1KeepAlive.java @@ -0,0 +1,78 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AgentV1KeepAlive.Builder.class) +public final class AgentV1KeepAlive { + private final Map additionalProperties; + + private AgentV1KeepAlive(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + /** + * @return Message type identifier + */ + @JsonProperty("type") + public String getType() { + return "KeepAlive"; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1KeepAlive; + } + + @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(AgentV1KeepAlive other) { + return this; + } + + public AgentV1KeepAlive build() { + return new AgentV1KeepAlive(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1PromptUpdated.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1PromptUpdated.java new file mode 100644 index 0000000..68d71cc --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1PromptUpdated.java @@ -0,0 +1,78 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AgentV1PromptUpdated.Builder.class) +public final class AgentV1PromptUpdated { + private final Map additionalProperties; + + private AgentV1PromptUpdated(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + /** + * @return Message type identifier for prompt update confirmation + */ + @JsonProperty("type") + public String getType() { + return "PromptUpdated"; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1PromptUpdated; + } + + @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(AgentV1PromptUpdated other) { + return this; + } + + public AgentV1PromptUpdated build() { + return new AgentV1PromptUpdated(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1ReceiveFunctionCallResponse.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1ReceiveFunctionCallResponse.java new file mode 100644 index 0000000..17e67d8 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1ReceiveFunctionCallResponse.java @@ -0,0 +1,231 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = AgentV1ReceiveFunctionCallResponse.Builder.class) +public final class AgentV1ReceiveFunctionCallResponse { + private final Optional id; + + private final String name; + + private final String content; + + private final Map additionalProperties; + + private AgentV1ReceiveFunctionCallResponse( + Optional id, String name, String content, Map additionalProperties) { + this.id = id; + this.name = name; + this.content = content; + this.additionalProperties = additionalProperties; + } + + /** + * @return Message type identifier for function call responses + */ + @JsonProperty("type") + public String getType() { + return "FunctionCallResponse"; + } + + /** + * @return The unique identifier for the function call. + *

Required for client responses: Should match the id from + * the corresponding FunctionCallRequest + * • Optional for server responses: Server may omit when responding + * to internal function executions

+ */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + /** + * @return The name of the function being called + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return The content or result of the function call + */ + @JsonProperty("content") + public String getContent() { + return content; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1ReceiveFunctionCallResponse + && equalTo((AgentV1ReceiveFunctionCallResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1ReceiveFunctionCallResponse other) { + return id.equals(other.id) && name.equals(other.name) && content.equals(other.content); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.content); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static NameStage builder() { + return new Builder(); + } + + public interface NameStage { + /** + *

The name of the function being called

+ */ + ContentStage name(@NotNull String name); + + Builder from(AgentV1ReceiveFunctionCallResponse other); + } + + public interface ContentStage { + /** + *

The content or result of the function call

+ */ + _FinalStage content(@NotNull String content); + } + + public interface _FinalStage { + AgentV1ReceiveFunctionCallResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The unique identifier for the function call.

+ *

Required for client responses: Should match the id from + * the corresponding FunctionCallRequest + * • Optional for server responses: Server may omit when responding + * to internal function executions

+ */ + _FinalStage id(Optional id); + + _FinalStage id(String id); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements NameStage, ContentStage, _FinalStage { + private String name; + + private String content; + + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentV1ReceiveFunctionCallResponse other) { + id(other.getId()); + name(other.getName()); + content(other.getContent()); + return this; + } + + /** + *

The name of the function being called

+ *

The name of the function being called

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

The content or result of the function call

+ *

The content or result of the function call

+ * @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; + } + + /** + *

The unique identifier for the function call.

+ *

Required for client responses: Should match the id from + * the corresponding FunctionCallRequest + * • Optional for server responses: Server may omit when responding + * to internal function executions

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + /** + *

The unique identifier for the function call.

+ *

Required for client responses: Should match the id from + * the corresponding FunctionCallRequest + * • Optional for server responses: Server may omit when responding + * to internal function executions

+ */ + @java.lang.Override + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public _FinalStage id(Optional id) { + this.id = id; + return this; + } + + @java.lang.Override + public AgentV1ReceiveFunctionCallResponse build() { + return new AgentV1ReceiveFunctionCallResponse(id, name, content, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SendFunctionCallResponse.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SendFunctionCallResponse.java new file mode 100644 index 0000000..e89546b --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SendFunctionCallResponse.java @@ -0,0 +1,230 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = AgentV1SendFunctionCallResponse.Builder.class) +public final class AgentV1SendFunctionCallResponse { + private final Optional id; + + private final String name; + + private final String content; + + private final Map additionalProperties; + + private AgentV1SendFunctionCallResponse( + Optional id, String name, String content, Map additionalProperties) { + this.id = id; + this.name = name; + this.content = content; + this.additionalProperties = additionalProperties; + } + + /** + * @return Message type identifier for function call responses + */ + @JsonProperty("type") + public String getType() { + return "FunctionCallResponse"; + } + + /** + * @return The unique identifier for the function call. + *

Required for client responses: Should match the id from + * the corresponding FunctionCallRequest + * • Optional for server responses: Server may omit when responding + * to internal function executions

+ */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + /** + * @return The name of the function being called + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return The content or result of the function call + */ + @JsonProperty("content") + public String getContent() { + return content; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1SendFunctionCallResponse && equalTo((AgentV1SendFunctionCallResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1SendFunctionCallResponse other) { + return id.equals(other.id) && name.equals(other.name) && content.equals(other.content); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.content); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static NameStage builder() { + return new Builder(); + } + + public interface NameStage { + /** + *

The name of the function being called

+ */ + ContentStage name(@NotNull String name); + + Builder from(AgentV1SendFunctionCallResponse other); + } + + public interface ContentStage { + /** + *

The content or result of the function call

+ */ + _FinalStage content(@NotNull String content); + } + + public interface _FinalStage { + AgentV1SendFunctionCallResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The unique identifier for the function call.

+ *

Required for client responses: Should match the id from + * the corresponding FunctionCallRequest + * • Optional for server responses: Server may omit when responding + * to internal function executions

+ */ + _FinalStage id(Optional id); + + _FinalStage id(String id); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements NameStage, ContentStage, _FinalStage { + private String name; + + private String content; + + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentV1SendFunctionCallResponse other) { + id(other.getId()); + name(other.getName()); + content(other.getContent()); + return this; + } + + /** + *

The name of the function being called

+ *

The name of the function being called

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

The content or result of the function call

+ *

The content or result of the function call

+ * @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; + } + + /** + *

The unique identifier for the function call.

+ *

Required for client responses: Should match the id from + * the corresponding FunctionCallRequest + * • Optional for server responses: Server may omit when responding + * to internal function executions

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + /** + *

The unique identifier for the function call.

+ *

Required for client responses: Should match the id from + * the corresponding FunctionCallRequest + * • Optional for server responses: Server may omit when responding + * to internal function executions

+ */ + @java.lang.Override + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public _FinalStage id(Optional id) { + this.id = id; + return this; + } + + @java.lang.Override + public AgentV1SendFunctionCallResponse build() { + return new AgentV1SendFunctionCallResponse(id, name, content, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1Settings.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1Settings.java new file mode 100644 index 0000000..205222a --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1Settings.java @@ -0,0 +1,311 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = AgentV1Settings.Builder.class) +public final class AgentV1Settings { + private final Optional> tags; + + private final Optional experimental; + + private final Optional flags; + + private final Optional mipOptOut; + + private final AgentV1SettingsAudio audio; + + private final AgentV1SettingsAgent agent; + + private final Map additionalProperties; + + private AgentV1Settings( + Optional> tags, + Optional experimental, + Optional flags, + Optional mipOptOut, + AgentV1SettingsAudio audio, + AgentV1SettingsAgent agent, + Map additionalProperties) { + this.tags = tags; + this.experimental = experimental; + this.flags = flags; + this.mipOptOut = mipOptOut; + this.audio = audio; + this.agent = agent; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("type") + public String getType() { + return "Settings"; + } + + /** + * @return Tags to associate with the request + */ + @JsonProperty("tags") + public Optional> getTags() { + return tags; + } + + /** + * @return To enable experimental features + */ + @JsonProperty("experimental") + public Optional getExperimental() { + return experimental; + } + + @JsonProperty("flags") + public Optional getFlags() { + return flags; + } + + /** + * @return To opt out of Deepgram Model Improvement Program + */ + @JsonProperty("mip_opt_out") + public Optional getMipOptOut() { + return mipOptOut; + } + + @JsonProperty("audio") + public AgentV1SettingsAudio getAudio() { + return audio; + } + + @JsonProperty("agent") + public AgentV1SettingsAgent getAgent() { + return agent; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1Settings && equalTo((AgentV1Settings) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1Settings other) { + return tags.equals(other.tags) + && experimental.equals(other.experimental) + && flags.equals(other.flags) + && mipOptOut.equals(other.mipOptOut) + && audio.equals(other.audio) + && agent.equals(other.agent); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.tags, this.experimental, this.flags, this.mipOptOut, this.audio, this.agent); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AudioStage builder() { + return new Builder(); + } + + public interface AudioStage { + AgentStage audio(@NotNull AgentV1SettingsAudio audio); + + Builder from(AgentV1Settings other); + } + + public interface AgentStage { + _FinalStage agent(@NotNull AgentV1SettingsAgent agent); + } + + public interface _FinalStage { + AgentV1Settings build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Tags to associate with the request

+ */ + _FinalStage tags(Optional> tags); + + _FinalStage tags(List tags); + + /** + *

To enable experimental features

+ */ + _FinalStage experimental(Optional experimental); + + _FinalStage experimental(Boolean experimental); + + _FinalStage flags(Optional flags); + + _FinalStage flags(AgentV1SettingsFlags flags); + + /** + *

To opt out of Deepgram Model Improvement Program

+ */ + _FinalStage mipOptOut(Optional mipOptOut); + + _FinalStage mipOptOut(Boolean mipOptOut); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AudioStage, AgentStage, _FinalStage { + private AgentV1SettingsAudio audio; + + private AgentV1SettingsAgent agent; + + private Optional mipOptOut = Optional.empty(); + + private Optional flags = Optional.empty(); + + private Optional experimental = Optional.empty(); + + private Optional> tags = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentV1Settings other) { + tags(other.getTags()); + experimental(other.getExperimental()); + flags(other.getFlags()); + mipOptOut(other.getMipOptOut()); + audio(other.getAudio()); + agent(other.getAgent()); + return this; + } + + @java.lang.Override + @JsonSetter("audio") + public AgentStage audio(@NotNull AgentV1SettingsAudio audio) { + this.audio = Objects.requireNonNull(audio, "audio must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("agent") + public _FinalStage agent(@NotNull AgentV1SettingsAgent agent) { + this.agent = Objects.requireNonNull(agent, "agent must not be null"); + return this; + } + + /** + *

To opt out of Deepgram Model Improvement Program

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage mipOptOut(Boolean mipOptOut) { + this.mipOptOut = Optional.ofNullable(mipOptOut); + return this; + } + + /** + *

To opt out of Deepgram Model Improvement Program

+ */ + @java.lang.Override + @JsonSetter(value = "mip_opt_out", nulls = Nulls.SKIP) + public _FinalStage mipOptOut(Optional mipOptOut) { + this.mipOptOut = mipOptOut; + return this; + } + + @java.lang.Override + public _FinalStage flags(AgentV1SettingsFlags flags) { + this.flags = Optional.ofNullable(flags); + return this; + } + + @java.lang.Override + @JsonSetter(value = "flags", nulls = Nulls.SKIP) + public _FinalStage flags(Optional flags) { + this.flags = flags; + return this; + } + + /** + *

To enable experimental features

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage experimental(Boolean experimental) { + this.experimental = Optional.ofNullable(experimental); + return this; + } + + /** + *

To enable experimental features

+ */ + @java.lang.Override + @JsonSetter(value = "experimental", nulls = Nulls.SKIP) + public _FinalStage experimental(Optional experimental) { + this.experimental = experimental; + return this; + } + + /** + *

Tags to associate with the request

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

Tags to associate with the request

+ */ + @java.lang.Override + @JsonSetter(value = "tags", nulls = Nulls.SKIP) + public _FinalStage tags(Optional> tags) { + this.tags = tags; + return this; + } + + @java.lang.Override + public AgentV1Settings build() { + return new AgentV1Settings(tags, experimental, flags, mipOptOut, audio, agent, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgent.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgent.java new file mode 100644 index 0000000..5422be9 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgent.java @@ -0,0 +1,245 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AgentV1SettingsAgent.Builder.class) +public final class AgentV1SettingsAgent { + private final Optional language; + + private final Optional context; + + private final Optional listen; + + private final Optional think; + + private final Optional speak; + + private final Optional greeting; + + private final Map additionalProperties; + + private AgentV1SettingsAgent( + Optional language, + Optional context, + Optional listen, + Optional think, + Optional speak, + Optional greeting, + Map additionalProperties) { + this.language = language; + this.context = context; + this.listen = listen; + this.think = think; + this.speak = speak; + this.greeting = greeting; + this.additionalProperties = additionalProperties; + } + + /** + * @return Deprecated. Use listen.provider.language and speak.provider.language fields instead. + */ + @JsonProperty("language") + public Optional getLanguage() { + return language; + } + + /** + * @return Conversation context including the history of messages and function calls + */ + @JsonProperty("context") + public Optional getContext() { + return context; + } + + @JsonProperty("listen") + public Optional getListen() { + return listen; + } + + @JsonProperty("think") + public Optional getThink() { + return think; + } + + @JsonProperty("speak") + public Optional getSpeak() { + return speak; + } + + /** + * @return Optional message that agent will speak at the start + */ + @JsonProperty("greeting") + public Optional getGreeting() { + return greeting; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1SettingsAgent && equalTo((AgentV1SettingsAgent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1SettingsAgent other) { + return language.equals(other.language) + && context.equals(other.context) + && listen.equals(other.listen) + && think.equals(other.think) + && speak.equals(other.speak) + && greeting.equals(other.greeting); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.language, this.context, this.listen, this.think, this.speak, this.greeting); + } + + @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 language = Optional.empty(); + + private Optional context = Optional.empty(); + + private Optional listen = Optional.empty(); + + private Optional think = Optional.empty(); + + private Optional speak = Optional.empty(); + + private Optional greeting = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AgentV1SettingsAgent other) { + language(other.getLanguage()); + context(other.getContext()); + listen(other.getListen()); + think(other.getThink()); + speak(other.getSpeak()); + greeting(other.getGreeting()); + return this; + } + + /** + *

Deprecated. Use listen.provider.language and speak.provider.language fields instead.

+ */ + @JsonSetter(value = "language", nulls = Nulls.SKIP) + public Builder language(Optional language) { + this.language = language; + return this; + } + + public Builder language(String language) { + this.language = Optional.ofNullable(language); + return this; + } + + /** + *

Conversation context including the history of messages and function calls

+ */ + @JsonSetter(value = "context", nulls = Nulls.SKIP) + public Builder context(Optional context) { + this.context = context; + return this; + } + + public Builder context(AgentV1SettingsAgentContext context) { + this.context = Optional.ofNullable(context); + return this; + } + + @JsonSetter(value = "listen", nulls = Nulls.SKIP) + public Builder listen(Optional listen) { + this.listen = listen; + return this; + } + + public Builder listen(AgentV1SettingsAgentListen listen) { + this.listen = Optional.ofNullable(listen); + return this; + } + + @JsonSetter(value = "think", nulls = Nulls.SKIP) + public Builder think(Optional think) { + this.think = think; + return this; + } + + public Builder think(AgentV1SettingsAgentThink think) { + this.think = Optional.ofNullable(think); + return this; + } + + @JsonSetter(value = "speak", nulls = Nulls.SKIP) + public Builder speak(Optional speak) { + this.speak = speak; + return this; + } + + public Builder speak(AgentV1SettingsAgentSpeak speak) { + this.speak = Optional.ofNullable(speak); + return this; + } + + /** + *

Optional message that agent will speak at the start

+ */ + @JsonSetter(value = "greeting", nulls = Nulls.SKIP) + public Builder greeting(Optional greeting) { + this.greeting = greeting; + return this; + } + + public Builder greeting(String greeting) { + this.greeting = Optional.ofNullable(greeting); + return this; + } + + public AgentV1SettingsAgent build() { + return new AgentV1SettingsAgent(language, context, listen, think, speak, greeting, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentContext.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentContext.java new file mode 100644 index 0000000..fd06720 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentContext.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = AgentV1SettingsAgentContext.Builder.class) +public final class AgentV1SettingsAgentContext { + private final Optional> messages; + + private final Map additionalProperties; + + private AgentV1SettingsAgentContext( + Optional> messages, + Map additionalProperties) { + this.messages = messages; + this.additionalProperties = additionalProperties; + } + + /** + * @return Conversation history as a list of messages and function calls + */ + @JsonProperty("messages") + public Optional> getMessages() { + return messages; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1SettingsAgentContext && equalTo((AgentV1SettingsAgentContext) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1SettingsAgentContext other) { + return messages.equals(other.messages); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.messages); + } + + @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(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AgentV1SettingsAgentContext other) { + messages(other.getMessages()); + return this; + } + + /** + *

Conversation history as a list of messages and function calls

+ */ + @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; + } + + public AgentV1SettingsAgentContext build() { + return new AgentV1SettingsAgentContext(messages, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentContextMessagesItem.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentContextMessagesItem.java new file mode 100644 index 0000000..59a80c4 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentContextMessagesItem.java @@ -0,0 +1,100 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +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 java.io.IOException; +import java.util.Objects; + +@JsonDeserialize(using = AgentV1SettingsAgentContextMessagesItem.Deserializer.class) +public final class AgentV1SettingsAgentContextMessagesItem { + private final Object value; + + private final int type; + + private AgentV1SettingsAgentContextMessagesItem(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + @SuppressWarnings("unchecked") + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((AgentV1SettingsAgentContextMessagesItemContent) this.value); + } else if (this.type == 1) { + return visitor.visit((AgentV1SettingsAgentContextMessagesItemFunctionCalls) 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 AgentV1SettingsAgentContextMessagesItem + && equalTo((AgentV1SettingsAgentContextMessagesItem) other); + } + + private boolean equalTo(AgentV1SettingsAgentContextMessagesItem 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 AgentV1SettingsAgentContextMessagesItem of(AgentV1SettingsAgentContextMessagesItemContent value) { + return new AgentV1SettingsAgentContextMessagesItem(value, 0); + } + + public static AgentV1SettingsAgentContextMessagesItem of( + AgentV1SettingsAgentContextMessagesItemFunctionCalls value) { + return new AgentV1SettingsAgentContextMessagesItem(value, 1); + } + + public interface Visitor { + T visit(AgentV1SettingsAgentContextMessagesItemContent value); + + T visit(AgentV1SettingsAgentContextMessagesItemFunctionCalls value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(AgentV1SettingsAgentContextMessagesItem.class); + } + + @java.lang.Override + public AgentV1SettingsAgentContextMessagesItem deserialize(JsonParser p, DeserializationContext context) + throws IOException { + Object value = p.readValueAs(Object.class); + try { + return of(ObjectMappers.JSON_MAPPER.convertValue( + value, AgentV1SettingsAgentContextMessagesItemContent.class)); + } catch (RuntimeException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue( + value, AgentV1SettingsAgentContextMessagesItemFunctionCalls.class)); + } catch (RuntimeException e) { + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentContextMessagesItemContent.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentContextMessagesItemContent.java new file mode 100644 index 0000000..d8aa345 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentContextMessagesItemContent.java @@ -0,0 +1,174 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AgentV1SettingsAgentContextMessagesItemContent.Builder.class) +public final class AgentV1SettingsAgentContextMessagesItemContent { + private final AgentV1SettingsAgentContextMessagesItemContentRole role; + + private final String content; + + private final Map additionalProperties; + + private AgentV1SettingsAgentContextMessagesItemContent( + AgentV1SettingsAgentContextMessagesItemContentRole role, + String content, + Map additionalProperties) { + this.role = role; + this.content = content; + this.additionalProperties = additionalProperties; + } + + /** + * @return Message type identifier for conversation text + */ + @JsonProperty("type") + public String getType() { + return "History"; + } + + /** + * @return Identifies who spoke the statement + */ + @JsonProperty("role") + public AgentV1SettingsAgentContextMessagesItemContentRole getRole() { + return role; + } + + /** + * @return The actual statement that was spoken + */ + @JsonProperty("content") + public String getContent() { + return content; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1SettingsAgentContextMessagesItemContent + && equalTo((AgentV1SettingsAgentContextMessagesItemContent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1SettingsAgentContextMessagesItemContent other) { + return role.equals(other.role) && content.equals(other.content); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.role, this.content); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static RoleStage builder() { + return new Builder(); + } + + public interface RoleStage { + /** + *

Identifies who spoke the statement

+ */ + ContentStage role(@NotNull AgentV1SettingsAgentContextMessagesItemContentRole role); + + Builder from(AgentV1SettingsAgentContextMessagesItemContent other); + } + + public interface ContentStage { + /** + *

The actual statement that was spoken

+ */ + _FinalStage content(@NotNull String content); + } + + public interface _FinalStage { + AgentV1SettingsAgentContextMessagesItemContent build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements RoleStage, ContentStage, _FinalStage { + private AgentV1SettingsAgentContextMessagesItemContentRole role; + + private String content; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentV1SettingsAgentContextMessagesItemContent other) { + role(other.getRole()); + content(other.getContent()); + return this; + } + + /** + *

Identifies who spoke the statement

+ *

Identifies who spoke the statement

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

The actual statement that was spoken

+ *

The actual statement that was spoken

+ * @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; + } + + @java.lang.Override + public AgentV1SettingsAgentContextMessagesItemContent build() { + return new AgentV1SettingsAgentContextMessagesItemContent(role, content, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentContextMessagesItemContentRole.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentContextMessagesItemContentRole.java new file mode 100644 index 0000000..7f9932f --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentContextMessagesItemContentRole.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AgentV1SettingsAgentContextMessagesItemContentRole { + public static final AgentV1SettingsAgentContextMessagesItemContentRole ASSISTANT = + new AgentV1SettingsAgentContextMessagesItemContentRole(Value.ASSISTANT, "assistant"); + + public static final AgentV1SettingsAgentContextMessagesItemContentRole USER = + new AgentV1SettingsAgentContextMessagesItemContentRole(Value.USER, "user"); + + private final Value value; + + private final String string; + + AgentV1SettingsAgentContextMessagesItemContentRole(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AgentV1SettingsAgentContextMessagesItemContentRole + && this.string.equals(((AgentV1SettingsAgentContextMessagesItemContentRole) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ASSISTANT: + return visitor.visitAssistant(); + case USER: + return visitor.visitUser(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AgentV1SettingsAgentContextMessagesItemContentRole valueOf(String value) { + switch (value) { + case "assistant": + return ASSISTANT; + case "user": + return USER; + default: + return new AgentV1SettingsAgentContextMessagesItemContentRole(Value.UNKNOWN, value); + } + } + + public enum Value { + USER, + + ASSISTANT, + + UNKNOWN + } + + public interface Visitor { + T visitUser(); + + T visitAssistant(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentContextMessagesItemFunctionCalls.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentContextMessagesItemFunctionCalls.java new file mode 100644 index 0000000..4b54bb6 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentContextMessagesItemFunctionCalls.java @@ -0,0 +1,134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = AgentV1SettingsAgentContextMessagesItemFunctionCalls.Builder.class) +public final class AgentV1SettingsAgentContextMessagesItemFunctionCalls { + private final List functionCalls; + + private final Map additionalProperties; + + private AgentV1SettingsAgentContextMessagesItemFunctionCalls( + List functionCalls, + Map additionalProperties) { + this.functionCalls = functionCalls; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("type") + public String getType() { + return "History"; + } + + /** + * @return List of function call objects + */ + @JsonProperty("function_calls") + public List getFunctionCalls() { + return functionCalls; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1SettingsAgentContextMessagesItemFunctionCalls + && equalTo((AgentV1SettingsAgentContextMessagesItemFunctionCalls) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1SettingsAgentContextMessagesItemFunctionCalls other) { + return functionCalls.equals(other.functionCalls); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.functionCalls); + } + + @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 functionCalls = + new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AgentV1SettingsAgentContextMessagesItemFunctionCalls other) { + functionCalls(other.getFunctionCalls()); + return this; + } + + /** + *

List of function call objects

+ */ + @JsonSetter(value = "function_calls", nulls = Nulls.SKIP) + public Builder functionCalls( + List functionCalls) { + this.functionCalls.clear(); + if (functionCalls != null) { + this.functionCalls.addAll(functionCalls); + } + return this; + } + + public Builder addFunctionCalls( + AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem functionCalls) { + this.functionCalls.add(functionCalls); + return this; + } + + public Builder addAllFunctionCalls( + List functionCalls) { + if (functionCalls != null) { + this.functionCalls.addAll(functionCalls); + } + return this; + } + + public AgentV1SettingsAgentContextMessagesItemFunctionCalls build() { + return new AgentV1SettingsAgentContextMessagesItemFunctionCalls(functionCalls, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem.java new file mode 100644 index 0000000..6da93e0 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem.java @@ -0,0 +1,274 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem.Builder.class) +public final class AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem { + private final String id; + + private final String name; + + private final boolean clientSide; + + private final String arguments; + + private final String response; + + private final Map additionalProperties; + + private AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem( + String id, + String name, + boolean clientSide, + String arguments, + String response, + Map additionalProperties) { + this.id = id; + this.name = name; + this.clientSide = clientSide; + this.arguments = arguments; + this.response = response; + this.additionalProperties = additionalProperties; + } + + /** + * @return Unique identifier for the function call + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return Name of the function called + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return Indicates if the call was client-side or server-side + */ + @JsonProperty("client_side") + public boolean getClientSide() { + return clientSide; + } + + /** + * @return Arguments passed to the function + */ + @JsonProperty("arguments") + public String getArguments() { + return arguments; + } + + /** + * @return Response from the function call + */ + @JsonProperty("response") + public String getResponse() { + return response; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem + && equalTo((AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem other) { + return id.equals(other.id) + && name.equals(other.name) + && clientSide == other.clientSide + && arguments.equals(other.arguments) + && response.equals(other.response); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.clientSide, this.arguments, this.response); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

Unique identifier for the function call

+ */ + NameStage id(@NotNull String id); + + Builder from(AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem other); + } + + public interface NameStage { + /** + *

Name of the function called

+ */ + ClientSideStage name(@NotNull String name); + } + + public interface ClientSideStage { + /** + *

Indicates if the call was client-side or server-side

+ */ + ArgumentsStage clientSide(boolean clientSide); + } + + public interface ArgumentsStage { + /** + *

Arguments passed to the function

+ */ + ResponseStage arguments(@NotNull String arguments); + } + + public interface ResponseStage { + /** + *

Response from the function call

+ */ + _FinalStage response(@NotNull String response); + } + + public interface _FinalStage { + AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements IdStage, NameStage, ClientSideStage, ArgumentsStage, ResponseStage, _FinalStage { + private String id; + + private String name; + + private boolean clientSide; + + private String arguments; + + private String response; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem other) { + id(other.getId()); + name(other.getName()); + clientSide(other.getClientSide()); + arguments(other.getArguments()); + response(other.getResponse()); + return this; + } + + /** + *

Unique identifier for the function call

+ *

Unique identifier for the function call

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

Name of the function called

+ *

Name of the function called

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

Indicates if the call was client-side or server-side

+ *

Indicates if the call was client-side or server-side

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

Arguments passed to the function

+ *

Arguments passed to the function

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

Response from the function call

+ *

Response from the function call

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("response") + public _FinalStage response(@NotNull String response) { + this.response = Objects.requireNonNull(response, "response must not be null"); + return this; + } + + @java.lang.Override + public AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem build() { + return new AgentV1SettingsAgentContextMessagesItemFunctionCallsFunctionCallsItem( + id, name, clientSide, arguments, response, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentListen.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentListen.java new file mode 100644 index 0000000..4dbd7cb --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentListen.java @@ -0,0 +1,106 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AgentV1SettingsAgentListen.Builder.class) +public final class AgentV1SettingsAgentListen { + private final Optional provider; + + private final Map additionalProperties; + + private AgentV1SettingsAgentListen( + Optional provider, Map additionalProperties) { + this.provider = provider; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public Optional getProvider() { + return provider; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1SettingsAgentListen && equalTo((AgentV1SettingsAgentListen) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1SettingsAgentListen other) { + return provider.equals(other.provider); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(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 provider = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AgentV1SettingsAgentListen other) { + provider(other.getProvider()); + return this; + } + + @JsonSetter(value = "provider", nulls = Nulls.SKIP) + public Builder provider(Optional provider) { + this.provider = provider; + return this; + } + + public Builder provider(AgentV1SettingsAgentListenProvider provider) { + this.provider = Optional.ofNullable(provider); + return this; + } + + public AgentV1SettingsAgentListen build() { + return new AgentV1SettingsAgentListen(provider, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentListenProvider.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentListenProvider.java new file mode 100644 index 0000000..dd0810b --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentListenProvider.java @@ -0,0 +1,222 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.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 AgentV1SettingsAgentListenProvider { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private AgentV1SettingsAgentListenProvider(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static AgentV1SettingsAgentListenProvider v1(AgentV1SettingsAgentListenProviderV1 value) { + return new AgentV1SettingsAgentListenProvider(new V1Value(value)); + } + + public static AgentV1SettingsAgentListenProvider v2(AgentV1SettingsAgentListenProviderV2 value) { + return new AgentV1SettingsAgentListenProvider(new V2Value(value)); + } + + public boolean isV1() { + return value instanceof V1Value; + } + + public boolean isV2() { + return value instanceof V2Value; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getV1() { + if (isV1()) { + return Optional.of(((V1Value) value).value); + } + return Optional.empty(); + } + + public Optional getV2() { + if (isV2()) { + return Optional.of(((V2Value) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1SettingsAgentListenProvider + && value.equals(((AgentV1SettingsAgentListenProvider) other).value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + return value.toString(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitV1(AgentV1SettingsAgentListenProviderV1 v1); + + T visitV2(AgentV1SettingsAgentListenProviderV2 v2); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "version", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(V1Value.class), @JsonSubTypes.Type(V2Value.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("v1") + @JsonIgnoreProperties("version") + private static final class V1Value implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "version", allowSetters = true) + private AgentV1SettingsAgentListenProviderV1 value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private V1Value() {} + + private V1Value(AgentV1SettingsAgentListenProviderV1 value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitV1(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1Value && equalTo((V1Value) other); + } + + private boolean equalTo(V1Value other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AgentV1SettingsAgentListenProvider{" + "value: " + value + "}"; + } + } + + @JsonTypeName("v2") + @JsonIgnoreProperties("version") + private static final class V2Value implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "version", allowSetters = true) + private AgentV1SettingsAgentListenProviderV2 value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private V2Value() {} + + private V2Value(AgentV1SettingsAgentListenProviderV2 value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitV2(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V2Value && equalTo((V2Value) other); + } + + private boolean equalTo(V2Value other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AgentV1SettingsAgentListenProvider{" + "value: " + value + "}"; + } + } + + @JsonIgnoreProperties("version") + 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 "AgentV1SettingsAgentListenProvider{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentListenProviderV1.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentListenProviderV1.java new file mode 100644 index 0000000..4d94cc0 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentListenProviderV1.java @@ -0,0 +1,214 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = AgentV1SettingsAgentListenProviderV1.Builder.class) +public final class AgentV1SettingsAgentListenProviderV1 { + private final Optional model; + + private final Optional language; + + private final Optional> keyterms; + + private final Optional smartFormat; + + private final Map additionalProperties; + + private AgentV1SettingsAgentListenProviderV1( + Optional model, + Optional language, + Optional> keyterms, + Optional smartFormat, + Map additionalProperties) { + this.model = model; + this.language = language; + this.keyterms = keyterms; + this.smartFormat = smartFormat; + this.additionalProperties = additionalProperties; + } + + /** + * @return Provider type for speech-to-text + */ + @JsonProperty("type") + public String getType() { + return "deepgram"; + } + + /** + * @return Model to use for speech to text using the V1 API (e.g. Nova-3, Nova-2) + */ + @JsonProperty("model") + public Optional getModel() { + return model; + } + + /** + * @return Language code to use for speech-to-text. Can be a BCP-47 language tag (e.g. en), or multi for code-switching transcription + */ + @JsonProperty("language") + public Optional getLanguage() { + return language; + } + + /** + * @return Prompt keyterm recognition to improve Keyword Recall Rate + */ + @JsonProperty("keyterms") + public Optional> getKeyterms() { + return keyterms; + } + + /** + * @return Applies smart formatting to improve transcript readability + */ + @JsonProperty("smart_format") + public Optional getSmartFormat() { + return smartFormat; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1SettingsAgentListenProviderV1 + && equalTo((AgentV1SettingsAgentListenProviderV1) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1SettingsAgentListenProviderV1 other) { + return model.equals(other.model) + && language.equals(other.language) + && keyterms.equals(other.keyterms) + && smartFormat.equals(other.smartFormat); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.model, this.language, this.keyterms, this.smartFormat); + } + + @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> keyterms = Optional.empty(); + + private Optional smartFormat = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AgentV1SettingsAgentListenProviderV1 other) { + model(other.getModel()); + language(other.getLanguage()); + keyterms(other.getKeyterms()); + smartFormat(other.getSmartFormat()); + return this; + } + + /** + *

Model to use for speech to text using the V1 API (e.g. Nova-3, Nova-2)

+ */ + @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; + } + + /** + *

Language code to use for speech-to-text. Can be a BCP-47 language tag (e.g. en), or multi for code-switching transcription

+ */ + @JsonSetter(value = "language", nulls = Nulls.SKIP) + public Builder language(Optional language) { + this.language = language; + return this; + } + + public Builder language(String language) { + this.language = Optional.ofNullable(language); + return this; + } + + /** + *

Prompt keyterm recognition to improve Keyword Recall Rate

+ */ + @JsonSetter(value = "keyterms", nulls = Nulls.SKIP) + public Builder keyterms(Optional> keyterms) { + this.keyterms = keyterms; + return this; + } + + public Builder keyterms(List keyterms) { + this.keyterms = Optional.ofNullable(keyterms); + return this; + } + + /** + *

Applies smart formatting to improve transcript readability

+ */ + @JsonSetter(value = "smart_format", 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; + } + + public AgentV1SettingsAgentListenProviderV1 build() { + return new AgentV1SettingsAgentListenProviderV1( + model, language, keyterms, smartFormat, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentListenProviderV2.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentListenProviderV2.java new file mode 100644 index 0000000..90debd3 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentListenProviderV2.java @@ -0,0 +1,183 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = AgentV1SettingsAgentListenProviderV2.Builder.class) +public final class AgentV1SettingsAgentListenProviderV2 { + private final String model; + + private final Optional> keyterms; + + private final Map additionalProperties; + + private AgentV1SettingsAgentListenProviderV2( + String model, Optional> keyterms, Map additionalProperties) { + this.model = model; + this.keyterms = keyterms; + this.additionalProperties = additionalProperties; + } + + /** + * @return Provider type for speech-to-text + */ + @JsonProperty("type") + public String getType() { + return "deepgram"; + } + + /** + * @return Model to use for speech to text using the V2 API (e.g. flux-general-en) + */ + @JsonProperty("model") + public String getModel() { + return model; + } + + /** + * @return Prompt keyterm recognition to improve Keyword Recall Rate + */ + @JsonProperty("keyterms") + public Optional> getKeyterms() { + return keyterms; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1SettingsAgentListenProviderV2 + && equalTo((AgentV1SettingsAgentListenProviderV2) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1SettingsAgentListenProviderV2 other) { + return model.equals(other.model) && keyterms.equals(other.keyterms); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.model, this.keyterms); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ModelStage builder() { + return new Builder(); + } + + public interface ModelStage { + /** + *

Model to use for speech to text using the V2 API (e.g. flux-general-en)

+ */ + _FinalStage model(@NotNull String model); + + Builder from(AgentV1SettingsAgentListenProviderV2 other); + } + + public interface _FinalStage { + AgentV1SettingsAgentListenProviderV2 build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Prompt keyterm recognition to improve Keyword Recall Rate

+ */ + _FinalStage keyterms(Optional> keyterms); + + _FinalStage keyterms(List keyterms); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ModelStage, _FinalStage { + private String model; + + private Optional> keyterms = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentV1SettingsAgentListenProviderV2 other) { + model(other.getModel()); + keyterms(other.getKeyterms()); + return this; + } + + /** + *

Model to use for speech to text using the V2 API (e.g. flux-general-en)

+ *

Model to use for speech to text using the V2 API (e.g. flux-general-en)

+ * @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; + } + + /** + *

Prompt keyterm recognition to improve Keyword Recall Rate

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

Prompt keyterm recognition to improve Keyword Recall Rate

+ */ + @java.lang.Override + @JsonSetter(value = "keyterms", nulls = Nulls.SKIP) + public _FinalStage keyterms(Optional> keyterms) { + this.keyterms = keyterms; + return this; + } + + @java.lang.Override + public AgentV1SettingsAgentListenProviderV2 build() { + return new AgentV1SettingsAgentListenProviderV2(model, keyterms, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeak.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeak.java new file mode 100644 index 0000000..b71e5f8 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeak.java @@ -0,0 +1,98 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import java.io.IOException; +import java.util.List; +import java.util.Objects; + +@JsonDeserialize(using = AgentV1SettingsAgentSpeak.Deserializer.class) +public final class AgentV1SettingsAgentSpeak { + private final Object value; + + private final int type; + + private AgentV1SettingsAgentSpeak(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + @SuppressWarnings("unchecked") + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((AgentV1SettingsAgentSpeakEndpoint) this.value); + } else if (this.type == 1) { + return visitor.visit((List) 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 AgentV1SettingsAgentSpeak && equalTo((AgentV1SettingsAgentSpeak) other); + } + + private boolean equalTo(AgentV1SettingsAgentSpeak 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 AgentV1SettingsAgentSpeak of(AgentV1SettingsAgentSpeakEndpoint value) { + return new AgentV1SettingsAgentSpeak(value, 0); + } + + public static AgentV1SettingsAgentSpeak of(List value) { + return new AgentV1SettingsAgentSpeak(value, 1); + } + + public interface Visitor { + T visit(AgentV1SettingsAgentSpeakEndpoint value); + + T visit(List value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(AgentV1SettingsAgentSpeak.class); + } + + @java.lang.Override + public AgentV1SettingsAgentSpeak deserialize(JsonParser p, DeserializationContext context) throws IOException { + Object value = p.readValueAs(Object.class); + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, AgentV1SettingsAgentSpeakEndpoint.class)); + } catch (RuntimeException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue( + value, new TypeReference>() {})); + } catch (RuntimeException e) { + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakEndpoint.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakEndpoint.java new file mode 100644 index 0000000..5f95e82 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakEndpoint.java @@ -0,0 +1,168 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = AgentV1SettingsAgentSpeakEndpoint.Builder.class) +public final class AgentV1SettingsAgentSpeakEndpoint { + private final AgentV1SettingsAgentSpeakEndpointProvider provider; + + private final Optional endpoint; + + private final Map additionalProperties; + + private AgentV1SettingsAgentSpeakEndpoint( + AgentV1SettingsAgentSpeakEndpointProvider provider, + Optional endpoint, + Map additionalProperties) { + this.provider = provider; + this.endpoint = endpoint; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public AgentV1SettingsAgentSpeakEndpointProvider getProvider() { + return provider; + } + + /** + * @return Optional if provider is Deepgram. Required for non-Deepgram TTS providers. + * When present, must include url field and headers object. Valid schemes are https and wss with wss only supported for Eleven Labs. + */ + @JsonProperty("endpoint") + public Optional getEndpoint() { + return endpoint; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1SettingsAgentSpeakEndpoint && equalTo((AgentV1SettingsAgentSpeakEndpoint) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1SettingsAgentSpeakEndpoint other) { + return provider.equals(other.provider) && endpoint.equals(other.endpoint); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.provider, this.endpoint); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ProviderStage builder() { + return new Builder(); + } + + public interface ProviderStage { + _FinalStage provider(@NotNull AgentV1SettingsAgentSpeakEndpointProvider provider); + + Builder from(AgentV1SettingsAgentSpeakEndpoint other); + } + + public interface _FinalStage { + AgentV1SettingsAgentSpeakEndpoint build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Optional if provider is Deepgram. Required for non-Deepgram TTS providers. + * When present, must include url field and headers object. Valid schemes are https and wss with wss only supported for Eleven Labs.

+ */ + _FinalStage endpoint(Optional endpoint); + + _FinalStage endpoint(AgentV1SettingsAgentSpeakEndpointEndpoint endpoint); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ProviderStage, _FinalStage { + private AgentV1SettingsAgentSpeakEndpointProvider provider; + + private Optional endpoint = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentV1SettingsAgentSpeakEndpoint other) { + provider(other.getProvider()); + endpoint(other.getEndpoint()); + return this; + } + + @java.lang.Override + @JsonSetter("provider") + public _FinalStage provider(@NotNull AgentV1SettingsAgentSpeakEndpointProvider provider) { + this.provider = Objects.requireNonNull(provider, "provider must not be null"); + return this; + } + + /** + *

Optional if provider is Deepgram. Required for non-Deepgram TTS providers. + * When present, must include url field and headers object. Valid schemes are https and wss with wss only supported for Eleven Labs.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage endpoint(AgentV1SettingsAgentSpeakEndpointEndpoint endpoint) { + this.endpoint = Optional.ofNullable(endpoint); + return this; + } + + /** + *

Optional if provider is Deepgram. Required for non-Deepgram TTS providers. + * When present, must include url field and headers object. Valid schemes are https and wss with wss only supported for Eleven Labs.

+ */ + @java.lang.Override + @JsonSetter(value = "endpoint", nulls = Nulls.SKIP) + public _FinalStage endpoint(Optional endpoint) { + this.endpoint = endpoint; + return this; + } + + @java.lang.Override + public AgentV1SettingsAgentSpeakEndpoint build() { + return new AgentV1SettingsAgentSpeakEndpoint(provider, endpoint, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakEndpointEndpoint.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakEndpointEndpoint.java new file mode 100644 index 0000000..3f573f1 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakEndpointEndpoint.java @@ -0,0 +1,135 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AgentV1SettingsAgentSpeakEndpointEndpoint.Builder.class) +public final class AgentV1SettingsAgentSpeakEndpointEndpoint { + private final Optional url; + + private final Optional> headers; + + private final Map additionalProperties; + + private AgentV1SettingsAgentSpeakEndpointEndpoint( + Optional url, Optional> headers, Map additionalProperties) { + this.url = url; + this.headers = headers; + this.additionalProperties = additionalProperties; + } + + /** + * @return Custom TTS endpoint URL. Cannot contain output_format or model_id query parameters when the provider is Eleven Labs. + */ + @JsonProperty("url") + public Optional getUrl() { + return url; + } + + @JsonProperty("headers") + public Optional> getHeaders() { + return headers; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1SettingsAgentSpeakEndpointEndpoint + && equalTo((AgentV1SettingsAgentSpeakEndpointEndpoint) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1SettingsAgentSpeakEndpointEndpoint other) { + return url.equals(other.url) && headers.equals(other.headers); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.url, this.headers); + } + + @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 url = Optional.empty(); + + private Optional> headers = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AgentV1SettingsAgentSpeakEndpointEndpoint other) { + url(other.getUrl()); + headers(other.getHeaders()); + return this; + } + + /** + *

Custom TTS endpoint URL. Cannot contain output_format or model_id query parameters when the provider is Eleven Labs.

+ */ + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public Builder url(Optional url) { + this.url = url; + return this; + } + + public Builder url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + @JsonSetter(value = "headers", nulls = Nulls.SKIP) + public Builder headers(Optional> headers) { + this.headers = headers; + return this; + } + + public Builder headers(Map headers) { + this.headers = Optional.ofNullable(headers); + return this; + } + + public AgentV1SettingsAgentSpeakEndpointEndpoint build() { + return new AgentV1SettingsAgentSpeakEndpointEndpoint(url, headers, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakEndpointProvider.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakEndpointProvider.java new file mode 100644 index 0000000..b9347be --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakEndpointProvider.java @@ -0,0 +1,401 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.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 AgentV1SettingsAgentSpeakEndpointProvider { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private AgentV1SettingsAgentSpeakEndpointProvider(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static AgentV1SettingsAgentSpeakEndpointProvider deepgram(Deepgram value) { + return new AgentV1SettingsAgentSpeakEndpointProvider(new DeepgramValue(value)); + } + + public static AgentV1SettingsAgentSpeakEndpointProvider elevenLabs(ElevenLabs value) { + return new AgentV1SettingsAgentSpeakEndpointProvider(new ElevenLabsValue(value)); + } + + public static AgentV1SettingsAgentSpeakEndpointProvider cartesia(Cartesia value) { + return new AgentV1SettingsAgentSpeakEndpointProvider(new CartesiaValue(value)); + } + + public static AgentV1SettingsAgentSpeakEndpointProvider openAi( + AgentV1SettingsAgentSpeakEndpointProviderOpenAi value) { + return new AgentV1SettingsAgentSpeakEndpointProvider(new OpenAiValue(value)); + } + + public static AgentV1SettingsAgentSpeakEndpointProvider awsPolly( + AgentV1SettingsAgentSpeakEndpointProviderAwsPolly value) { + return new AgentV1SettingsAgentSpeakEndpointProvider(new AwsPollyValue(value)); + } + + public boolean isDeepgram() { + return value instanceof DeepgramValue; + } + + public boolean isElevenLabs() { + return value instanceof ElevenLabsValue; + } + + public boolean isCartesia() { + return value instanceof CartesiaValue; + } + + public boolean isOpenAi() { + return value instanceof OpenAiValue; + } + + public boolean isAwsPolly() { + return value instanceof AwsPollyValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getDeepgram() { + if (isDeepgram()) { + return Optional.of(((DeepgramValue) value).value); + } + return Optional.empty(); + } + + public Optional getElevenLabs() { + if (isElevenLabs()) { + return Optional.of(((ElevenLabsValue) value).value); + } + return Optional.empty(); + } + + public Optional getCartesia() { + if (isCartesia()) { + return Optional.of(((CartesiaValue) value).value); + } + return Optional.empty(); + } + + public Optional getOpenAi() { + if (isOpenAi()) { + return Optional.of(((OpenAiValue) value).value); + } + return Optional.empty(); + } + + public Optional getAwsPolly() { + if (isAwsPolly()) { + return Optional.of(((AwsPollyValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1SettingsAgentSpeakEndpointProvider + && value.equals(((AgentV1SettingsAgentSpeakEndpointProvider) other).value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + return value.toString(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitDeepgram(Deepgram deepgram); + + T visitElevenLabs(ElevenLabs elevenLabs); + + T visitCartesia(Cartesia cartesia); + + T visitOpenAi(AgentV1SettingsAgentSpeakEndpointProviderOpenAi openAi); + + T visitAwsPolly(AgentV1SettingsAgentSpeakEndpointProviderAwsPolly awsPolly); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(DeepgramValue.class), + @JsonSubTypes.Type(ElevenLabsValue.class), + @JsonSubTypes.Type(CartesiaValue.class), + @JsonSubTypes.Type(OpenAiValue.class), + @JsonSubTypes.Type(AwsPollyValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("deepgram") + @JsonIgnoreProperties("type") + private static final class DeepgramValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "type", allowSetters = true) + private Deepgram value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private DeepgramValue() {} + + private DeepgramValue(Deepgram 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 "AgentV1SettingsAgentSpeakEndpointProvider{" + "value: " + value + "}"; + } + } + + @JsonTypeName("eleven_labs") + @JsonIgnoreProperties("type") + private static final class ElevenLabsValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "type", allowSetters = true) + private ElevenLabs value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ElevenLabsValue() {} + + private ElevenLabsValue(ElevenLabs value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitElevenLabs(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ElevenLabsValue && equalTo((ElevenLabsValue) other); + } + + private boolean equalTo(ElevenLabsValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AgentV1SettingsAgentSpeakEndpointProvider{" + "value: " + value + "}"; + } + } + + @JsonTypeName("cartesia") + @JsonIgnoreProperties("type") + private static final class CartesiaValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "type", allowSetters = true) + private Cartesia value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private CartesiaValue() {} + + private CartesiaValue(Cartesia 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 "AgentV1SettingsAgentSpeakEndpointProvider{" + "value: " + value + "}"; + } + } + + @JsonTypeName("open_ai") + @JsonIgnoreProperties("type") + private static final class OpenAiValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "type", allowSetters = true) + private AgentV1SettingsAgentSpeakEndpointProviderOpenAi value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private OpenAiValue() {} + + private OpenAiValue(AgentV1SettingsAgentSpeakEndpointProviderOpenAi 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 "AgentV1SettingsAgentSpeakEndpointProvider{" + "value: " + value + "}"; + } + } + + @JsonTypeName("aws_polly") + @JsonIgnoreProperties("type") + private static final class AwsPollyValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "type", allowSetters = true) + private AgentV1SettingsAgentSpeakEndpointProviderAwsPolly value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private AwsPollyValue() {} + + private AwsPollyValue(AgentV1SettingsAgentSpeakEndpointProviderAwsPolly value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitAwsPolly(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AwsPollyValue && equalTo((AwsPollyValue) other); + } + + private boolean equalTo(AwsPollyValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AgentV1SettingsAgentSpeakEndpointProvider{" + "value: " + value + "}"; + } + } + + @JsonIgnoreProperties("type") + 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 "AgentV1SettingsAgentSpeakEndpointProvider{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakEndpointProviderAwsPolly.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakEndpointProviderAwsPolly.java new file mode 100644 index 0000000..1aaf900 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakEndpointProviderAwsPolly.java @@ -0,0 +1,262 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = AgentV1SettingsAgentSpeakEndpointProviderAwsPolly.Builder.class) +public final class AgentV1SettingsAgentSpeakEndpointProviderAwsPolly { + private final AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice voice; + + private final String language; + + private final Optional languageCode; + + private final AgentV1SettingsAgentSpeakEndpointProviderAwsPollyEngine engine; + + private final AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentials credentials; + + private final Map additionalProperties; + + private AgentV1SettingsAgentSpeakEndpointProviderAwsPolly( + AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice voice, + String language, + Optional languageCode, + AgentV1SettingsAgentSpeakEndpointProviderAwsPollyEngine engine, + AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentials credentials, + Map additionalProperties) { + this.voice = voice; + this.language = language; + this.languageCode = languageCode; + this.engine = engine; + this.credentials = credentials; + this.additionalProperties = additionalProperties; + } + + /** + * @return AWS Polly voice name + */ + @JsonProperty("voice") + public AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice getVoice() { + return voice; + } + + /** + * @return Language code to use, e.g. 'en-US'. Corresponds to the language_code parameter in the AWS Polly API + */ + @JsonProperty("language") + public String getLanguage() { + return language; + } + + /** + * @return Use the language field instead. + */ + @JsonProperty("language_code") + public Optional getLanguageCode() { + return languageCode; + } + + @JsonProperty("engine") + public AgentV1SettingsAgentSpeakEndpointProviderAwsPollyEngine getEngine() { + return engine; + } + + @JsonProperty("credentials") + public AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentials getCredentials() { + return credentials; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1SettingsAgentSpeakEndpointProviderAwsPolly + && equalTo((AgentV1SettingsAgentSpeakEndpointProviderAwsPolly) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1SettingsAgentSpeakEndpointProviderAwsPolly other) { + return voice.equals(other.voice) + && language.equals(other.language) + && languageCode.equals(other.languageCode) + && engine.equals(other.engine) + && credentials.equals(other.credentials); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.voice, this.language, this.languageCode, this.engine, this.credentials); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static VoiceStage builder() { + return new Builder(); + } + + public interface VoiceStage { + /** + *

AWS Polly voice name

+ */ + LanguageStage voice(@NotNull AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice voice); + + Builder from(AgentV1SettingsAgentSpeakEndpointProviderAwsPolly other); + } + + public interface LanguageStage { + /** + *

Language code to use, e.g. 'en-US'. Corresponds to the language_code parameter in the AWS Polly API

+ */ + EngineStage language(@NotNull String language); + } + + public interface EngineStage { + CredentialsStage engine(@NotNull AgentV1SettingsAgentSpeakEndpointProviderAwsPollyEngine engine); + } + + public interface CredentialsStage { + _FinalStage credentials(@NotNull AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentials credentials); + } + + public interface _FinalStage { + AgentV1SettingsAgentSpeakEndpointProviderAwsPolly build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Use the language field instead.

+ */ + _FinalStage languageCode(Optional languageCode); + + _FinalStage languageCode(String languageCode); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements VoiceStage, LanguageStage, EngineStage, CredentialsStage, _FinalStage { + private AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice voice; + + private String language; + + private AgentV1SettingsAgentSpeakEndpointProviderAwsPollyEngine engine; + + private AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentials credentials; + + private Optional languageCode = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentV1SettingsAgentSpeakEndpointProviderAwsPolly other) { + voice(other.getVoice()); + language(other.getLanguage()); + languageCode(other.getLanguageCode()); + engine(other.getEngine()); + credentials(other.getCredentials()); + return this; + } + + /** + *

AWS Polly voice name

+ *

AWS Polly voice name

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

Language code to use, e.g. 'en-US'. Corresponds to the language_code parameter in the AWS Polly API

+ *

Language code to use, e.g. 'en-US'. Corresponds to the language_code parameter in the AWS Polly API

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

Use the language field instead.

+ * @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; + } + + /** + *

Use the language field instead.

+ */ + @java.lang.Override + @JsonSetter(value = "language_code", nulls = Nulls.SKIP) + public _FinalStage languageCode(Optional languageCode) { + this.languageCode = languageCode; + return this; + } + + @java.lang.Override + public AgentV1SettingsAgentSpeakEndpointProviderAwsPolly build() { + return new AgentV1SettingsAgentSpeakEndpointProviderAwsPolly( + voice, language, languageCode, engine, credentials, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentials.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentials.java new file mode 100644 index 0000000..de1986a --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentials.java @@ -0,0 +1,240 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentials.Builder.class) +public final class AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentials { + private final AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsType type; + + private final String region; + + private final String accessKeyId; + + private final String secretAccessKey; + + private final Optional sessionToken; + + private final Map additionalProperties; + + private AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentials( + AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsType type, + String region, + String accessKeyId, + String secretAccessKey, + Optional sessionToken, + Map additionalProperties) { + this.type = type; + this.region = region; + this.accessKeyId = accessKeyId; + this.secretAccessKey = secretAccessKey; + this.sessionToken = sessionToken; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("type") + public AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsType getType() { + return type; + } + + @JsonProperty("region") + public String getRegion() { + return region; + } + + @JsonProperty("access_key_id") + public String getAccessKeyId() { + return accessKeyId; + } + + @JsonProperty("secret_access_key") + public String getSecretAccessKey() { + return secretAccessKey; + } + + /** + * @return Required for STS only + */ + @JsonProperty("session_token") + public Optional getSessionToken() { + return sessionToken; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentials + && equalTo((AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentials) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentials other) { + return type.equals(other.type) + && region.equals(other.region) + && accessKeyId.equals(other.accessKeyId) + && secretAccessKey.equals(other.secretAccessKey) + && sessionToken.equals(other.sessionToken); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.region, this.accessKeyId, this.secretAccessKey, this.sessionToken); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TypeStage builder() { + return new Builder(); + } + + public interface TypeStage { + RegionStage type(@NotNull AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsType type); + + Builder from(AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentials other); + } + + public interface RegionStage { + AccessKeyIdStage region(@NotNull String region); + } + + public interface AccessKeyIdStage { + SecretAccessKeyStage accessKeyId(@NotNull String accessKeyId); + } + + public interface SecretAccessKeyStage { + _FinalStage secretAccessKey(@NotNull String secretAccessKey); + } + + public interface _FinalStage { + AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentials build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Required for STS only

+ */ + _FinalStage sessionToken(Optional sessionToken); + + _FinalStage sessionToken(String sessionToken); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements TypeStage, RegionStage, AccessKeyIdStage, SecretAccessKeyStage, _FinalStage { + private AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsType type; + + private String region; + + private String accessKeyId; + + private String secretAccessKey; + + private Optional sessionToken = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentials other) { + type(other.getType()); + region(other.getRegion()); + accessKeyId(other.getAccessKeyId()); + secretAccessKey(other.getSecretAccessKey()); + sessionToken(other.getSessionToken()); + return this; + } + + @java.lang.Override + @JsonSetter("type") + public RegionStage type(@NotNull AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("region") + public AccessKeyIdStage region(@NotNull String region) { + this.region = Objects.requireNonNull(region, "region must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("access_key_id") + public SecretAccessKeyStage accessKeyId(@NotNull String accessKeyId) { + this.accessKeyId = Objects.requireNonNull(accessKeyId, "accessKeyId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("secret_access_key") + public _FinalStage secretAccessKey(@NotNull String secretAccessKey) { + this.secretAccessKey = Objects.requireNonNull(secretAccessKey, "secretAccessKey must not be null"); + return this; + } + + /** + *

Required for STS only

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sessionToken(String sessionToken) { + this.sessionToken = Optional.ofNullable(sessionToken); + return this; + } + + /** + *

Required for STS only

+ */ + @java.lang.Override + @JsonSetter(value = "session_token", nulls = Nulls.SKIP) + public _FinalStage sessionToken(Optional sessionToken) { + this.sessionToken = sessionToken; + return this; + } + + @java.lang.Override + public AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentials build() { + return new AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentials( + type, region, accessKeyId, secretAccessKey, sessionToken, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsType.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsType.java new file mode 100644 index 0000000..fd36d2c --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsType.java @@ -0,0 +1,87 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsType { + public static final AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsType IAM = + new AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsType(Value.IAM, "iam"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsType STS = + new AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsType(Value.STS, "sts"); + + private final Value value; + + private final String string; + + AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsType + && this.string.equals( + ((AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case IAM: + return visitor.visitIam(); + case STS: + return visitor.visitSts(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsType valueOf(String value) { + switch (value) { + case "iam": + return IAM; + case "sts": + return STS; + default: + return new AgentV1SettingsAgentSpeakEndpointProviderAwsPollyCredentialsType(Value.UNKNOWN, value); + } + } + + public enum Value { + STS, + + IAM, + + UNKNOWN + } + + public interface Visitor { + T visitSts(); + + T visitIam(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakEndpointProviderAwsPollyEngine.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakEndpointProviderAwsPollyEngine.java new file mode 100644 index 0000000..90b4971 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakEndpointProviderAwsPollyEngine.java @@ -0,0 +1,109 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AgentV1SettingsAgentSpeakEndpointProviderAwsPollyEngine { + public static final AgentV1SettingsAgentSpeakEndpointProviderAwsPollyEngine LONG_FORM = + new AgentV1SettingsAgentSpeakEndpointProviderAwsPollyEngine(Value.LONG_FORM, "long-form"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderAwsPollyEngine STANDARD = + new AgentV1SettingsAgentSpeakEndpointProviderAwsPollyEngine(Value.STANDARD, "standard"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderAwsPollyEngine GENERATIVE = + new AgentV1SettingsAgentSpeakEndpointProviderAwsPollyEngine(Value.GENERATIVE, "generative"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderAwsPollyEngine NEURAL = + new AgentV1SettingsAgentSpeakEndpointProviderAwsPollyEngine(Value.NEURAL, "neural"); + + private final Value value; + + private final String string; + + AgentV1SettingsAgentSpeakEndpointProviderAwsPollyEngine(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AgentV1SettingsAgentSpeakEndpointProviderAwsPollyEngine + && this.string.equals( + ((AgentV1SettingsAgentSpeakEndpointProviderAwsPollyEngine) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case LONG_FORM: + return visitor.visitLongForm(); + case STANDARD: + return visitor.visitStandard(); + case GENERATIVE: + return visitor.visitGenerative(); + case NEURAL: + return visitor.visitNeural(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AgentV1SettingsAgentSpeakEndpointProviderAwsPollyEngine valueOf(String value) { + switch (value) { + case "long-form": + return LONG_FORM; + case "standard": + return STANDARD; + case "generative": + return GENERATIVE; + case "neural": + return NEURAL; + default: + return new AgentV1SettingsAgentSpeakEndpointProviderAwsPollyEngine(Value.UNKNOWN, value); + } + } + + public enum Value { + GENERATIVE, + + LONG_FORM, + + STANDARD, + + NEURAL, + + UNKNOWN + } + + public interface Visitor { + T visitGenerative(); + + T visitLongForm(); + + T visitStandard(); + + T visitNeural(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice.java new file mode 100644 index 0000000..426453f --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice.java @@ -0,0 +1,152 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice { + public static final AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice ARTHUR = + new AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice(Value.ARTHUR, "Arthur"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice JOANNA = + new AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice(Value.JOANNA, "Joanna"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice BRIAN = + new AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice(Value.BRIAN, "Brian"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice AMY = + new AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice(Value.AMY, "Amy"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice EMMA = + new AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice(Value.EMMA, "Emma"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice MATTHEW = + new AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice(Value.MATTHEW, "Matthew"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice ARIA = + new AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice(Value.ARIA, "Aria"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice AYANDA = + new AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice(Value.AYANDA, "Ayanda"); + + private final Value value; + + private final String string; + + AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice + && this.string.equals(((AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ARTHUR: + return visitor.visitArthur(); + case JOANNA: + return visitor.visitJoanna(); + case BRIAN: + return visitor.visitBrian(); + case AMY: + return visitor.visitAmy(); + case EMMA: + return visitor.visitEmma(); + case MATTHEW: + return visitor.visitMatthew(); + case ARIA: + return visitor.visitAria(); + case AYANDA: + return visitor.visitAyanda(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice valueOf(String value) { + switch (value) { + case "Arthur": + return ARTHUR; + case "Joanna": + return JOANNA; + case "Brian": + return BRIAN; + case "Amy": + return AMY; + case "Emma": + return EMMA; + case "Matthew": + return MATTHEW; + case "Aria": + return ARIA; + case "Ayanda": + return AYANDA; + default: + return new AgentV1SettingsAgentSpeakEndpointProviderAwsPollyVoice(Value.UNKNOWN, value); + } + } + + public enum Value { + MATTHEW, + + JOANNA, + + AMY, + + EMMA, + + BRIAN, + + ARTHUR, + + ARIA, + + AYANDA, + + UNKNOWN + } + + public interface Visitor { + T visitMatthew(); + + T visitJoanna(); + + T visitAmy(); + + T visitEmma(); + + T visitBrian(); + + T visitArthur(); + + T visitAria(); + + T visitAyanda(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakEndpointProviderCartesiaModelId.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakEndpointProviderCartesiaModelId.java new file mode 100644 index 0000000..49931a6 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakEndpointProviderCartesiaModelId.java @@ -0,0 +1,88 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AgentV1SettingsAgentSpeakEndpointProviderCartesiaModelId { + public static final AgentV1SettingsAgentSpeakEndpointProviderCartesiaModelId SONIC_MULTILINGUAL = + new AgentV1SettingsAgentSpeakEndpointProviderCartesiaModelId( + Value.SONIC_MULTILINGUAL, "sonic-multilingual"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderCartesiaModelId SONIC2 = + new AgentV1SettingsAgentSpeakEndpointProviderCartesiaModelId(Value.SONIC2, "sonic-2"); + + private final Value value; + + private final String string; + + AgentV1SettingsAgentSpeakEndpointProviderCartesiaModelId(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AgentV1SettingsAgentSpeakEndpointProviderCartesiaModelId + && this.string.equals( + ((AgentV1SettingsAgentSpeakEndpointProviderCartesiaModelId) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SONIC_MULTILINGUAL: + return visitor.visitSonicMultilingual(); + case SONIC2: + return visitor.visitSonic2(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AgentV1SettingsAgentSpeakEndpointProviderCartesiaModelId valueOf(String value) { + switch (value) { + case "sonic-multilingual": + return SONIC_MULTILINGUAL; + case "sonic-2": + return SONIC2; + default: + return new AgentV1SettingsAgentSpeakEndpointProviderCartesiaModelId(Value.UNKNOWN, value); + } + } + + public enum Value { + SONIC2, + + SONIC_MULTILINGUAL, + + UNKNOWN + } + + public interface Visitor { + T visitSonic2(); + + T visitSonicMultilingual(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakEndpointProviderCartesiaVoice.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakEndpointProviderCartesiaVoice.java new file mode 100644 index 0000000..9e06b01 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakEndpointProviderCartesiaVoice.java @@ -0,0 +1,164 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AgentV1SettingsAgentSpeakEndpointProviderCartesiaVoice.Builder.class) +public final class AgentV1SettingsAgentSpeakEndpointProviderCartesiaVoice { + private final String mode; + + private final String id; + + private final Map additionalProperties; + + private AgentV1SettingsAgentSpeakEndpointProviderCartesiaVoice( + String mode, String id, Map additionalProperties) { + this.mode = mode; + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return Cartesia voice mode + */ + @JsonProperty("mode") + public String getMode() { + return mode; + } + + /** + * @return Cartesia voice ID + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1SettingsAgentSpeakEndpointProviderCartesiaVoice + && equalTo((AgentV1SettingsAgentSpeakEndpointProviderCartesiaVoice) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1SettingsAgentSpeakEndpointProviderCartesiaVoice other) { + return mode.equals(other.mode) && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.mode, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ModeStage builder() { + return new Builder(); + } + + public interface ModeStage { + /** + *

Cartesia voice mode

+ */ + IdStage mode(@NotNull String mode); + + Builder from(AgentV1SettingsAgentSpeakEndpointProviderCartesiaVoice other); + } + + public interface IdStage { + /** + *

Cartesia voice ID

+ */ + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + AgentV1SettingsAgentSpeakEndpointProviderCartesiaVoice build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ModeStage, IdStage, _FinalStage { + private String mode; + + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentV1SettingsAgentSpeakEndpointProviderCartesiaVoice other) { + mode(other.getMode()); + id(other.getId()); + return this; + } + + /** + *

Cartesia voice mode

+ *

Cartesia voice mode

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

Cartesia voice ID

+ *

Cartesia voice ID

+ * @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 AgentV1SettingsAgentSpeakEndpointProviderCartesiaVoice build() { + return new AgentV1SettingsAgentSpeakEndpointProviderCartesiaVoice(mode, id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel.java new file mode 100644 index 0000000..4b7bf99 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel.java @@ -0,0 +1,757 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel { + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA_ANGUS_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA_ANGUS_EN, "aura-angus-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2JUPITER_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2JUPITER_EN, "aura-2-jupiter-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2CORA_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2CORA_EN, "aura-2-cora-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA_STELLA_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA_STELLA_EN, "aura-stella-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2HELENA_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2HELENA_EN, "aura-2-helena-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2AQUILA_ES = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2AQUILA_ES, "aura-2-aquila-es"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2ATLAS_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2ATLAS_EN, "aura-2-atlas-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2ORION_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2ORION_EN, "aura-2-orion-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2DRACO_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2DRACO_EN, "aura-2-draco-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2HYPERION_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2HYPERION_EN, "aura-2-hyperion-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2JANUS_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2JANUS_EN, "aura-2-janus-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA_HELIOS_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA_HELIOS_EN, "aura-helios-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2PLUTO_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2PLUTO_EN, "aura-2-pluto-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2ARCAS_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2ARCAS_EN, "aura-2-arcas-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2NESTOR_ES = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2NESTOR_ES, "aura-2-nestor-es"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2NEPTUNE_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2NEPTUNE_EN, "aura-2-neptune-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2MINERVA_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2MINERVA_EN, "aura-2-minerva-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2ALVARO_ES = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2ALVARO_ES, "aura-2-alvaro-es"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA_ATHENA_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA_ATHENA_EN, "aura-athena-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA_PERSEUS_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA_PERSEUS_EN, "aura-perseus-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2ODYSSEUS_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2ODYSSEUS_EN, "aura-2-odysseus-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2PANDORA_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2PANDORA_EN, "aura-2-pandora-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2ZEUS_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2ZEUS_EN, "aura-2-zeus-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2ELECTRA_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2ELECTRA_EN, "aura-2-electra-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2ORPHEUS_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2ORPHEUS_EN, "aura-2-orpheus-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2THALIA_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2THALIA_EN, "aura-2-thalia-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2CELESTE_ES = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2CELESTE_ES, "aura-2-celeste-es"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA_ASTERIA_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA_ASTERIA_EN, "aura-asteria-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2ESTRELLA_ES = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2ESTRELLA_ES, "aura-2-estrella-es"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2HERA_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2HERA_EN, "aura-2-hera-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2MARS_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2MARS_EN, "aura-2-mars-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2SIRIO_ES = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2SIRIO_ES, "aura-2-sirio-es"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2ASTERIA_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2ASTERIA_EN, "aura-2-asteria-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2HERMES_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2HERMES_EN, "aura-2-hermes-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2VESTA_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2VESTA_EN, "aura-2-vesta-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2CARINA_ES = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2CARINA_ES, "aura-2-carina-es"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2CALLISTA_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2CALLISTA_EN, "aura-2-callista-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2HARMONIA_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2HARMONIA_EN, "aura-2-harmonia-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2SELENA_ES = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2SELENA_ES, "aura-2-selena-es"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2AURORA_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2AURORA_EN, "aura-2-aurora-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA_ZEUS_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA_ZEUS_EN, "aura-zeus-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2OPHELIA_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2OPHELIA_EN, "aura-2-ophelia-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2AMALTHEA_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2AMALTHEA_EN, "aura-2-amalthea-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA_ORPHEUS_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA_ORPHEUS_EN, "aura-orpheus-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2DELIA_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2DELIA_EN, "aura-2-delia-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA_LUNA_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA_LUNA_EN, "aura-luna-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2APOLLO_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2APOLLO_EN, "aura-2-apollo-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2SELENE_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2SELENE_EN, "aura-2-selene-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2THEIA_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2THEIA_EN, "aura-2-theia-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA_HERA_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA_HERA_EN, "aura-hera-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2CORDELIA_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2CORDELIA_EN, "aura-2-cordelia-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2ANDROMEDA_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2ANDROMEDA_EN, "aura-2-andromeda-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2ARIES_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2ARIES_EN, "aura-2-aries-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2JUNO_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2JUNO_EN, "aura-2-juno-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2LUNA_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2LUNA_EN, "aura-2-luna-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2DIANA_ES = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2DIANA_ES, "aura-2-diana-es"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2JAVIER_ES = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2JAVIER_ES, "aura-2-javier-es"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA_ORION_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA_ORION_EN, "aura-orion-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA_ARCAS_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA_ARCAS_EN, "aura-arcas-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2IRIS_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2IRIS_EN, "aura-2-iris-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2ATHENA_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2ATHENA_EN, "aura-2-athena-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2SATURN_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2SATURN_EN, "aura-2-saturn-en"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel AURA2PHOEBE_EN = + new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.AURA2PHOEBE_EN, "aura-2-phoebe-en"); + + private final Value value; + + private final String string; + + AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel + && this.string.equals(((AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case AURA_ANGUS_EN: + return visitor.visitAuraAngusEn(); + case AURA2JUPITER_EN: + return visitor.visitAura2JupiterEn(); + case AURA2CORA_EN: + return visitor.visitAura2CoraEn(); + case AURA_STELLA_EN: + return visitor.visitAuraStellaEn(); + case AURA2HELENA_EN: + return visitor.visitAura2HelenaEn(); + case AURA2AQUILA_ES: + return visitor.visitAura2AquilaEs(); + case AURA2ATLAS_EN: + return visitor.visitAura2AtlasEn(); + case AURA2ORION_EN: + return visitor.visitAura2OrionEn(); + case AURA2DRACO_EN: + return visitor.visitAura2DracoEn(); + case AURA2HYPERION_EN: + return visitor.visitAura2HyperionEn(); + case AURA2JANUS_EN: + return visitor.visitAura2JanusEn(); + case AURA_HELIOS_EN: + return visitor.visitAuraHeliosEn(); + case AURA2PLUTO_EN: + return visitor.visitAura2PlutoEn(); + case AURA2ARCAS_EN: + return visitor.visitAura2ArcasEn(); + case AURA2NESTOR_ES: + return visitor.visitAura2NestorEs(); + case AURA2NEPTUNE_EN: + return visitor.visitAura2NeptuneEn(); + case AURA2MINERVA_EN: + return visitor.visitAura2MinervaEn(); + case AURA2ALVARO_ES: + return visitor.visitAura2AlvaroEs(); + case AURA_ATHENA_EN: + return visitor.visitAuraAthenaEn(); + case AURA_PERSEUS_EN: + return visitor.visitAuraPerseusEn(); + case AURA2ODYSSEUS_EN: + return visitor.visitAura2OdysseusEn(); + case AURA2PANDORA_EN: + return visitor.visitAura2PandoraEn(); + case AURA2ZEUS_EN: + return visitor.visitAura2ZeusEn(); + case AURA2ELECTRA_EN: + return visitor.visitAura2ElectraEn(); + case AURA2ORPHEUS_EN: + return visitor.visitAura2OrpheusEn(); + case AURA2THALIA_EN: + return visitor.visitAura2ThaliaEn(); + case AURA2CELESTE_ES: + return visitor.visitAura2CelesteEs(); + case AURA_ASTERIA_EN: + return visitor.visitAuraAsteriaEn(); + case AURA2ESTRELLA_ES: + return visitor.visitAura2EstrellaEs(); + case AURA2HERA_EN: + return visitor.visitAura2HeraEn(); + case AURA2MARS_EN: + return visitor.visitAura2MarsEn(); + case AURA2SIRIO_ES: + return visitor.visitAura2SirioEs(); + case AURA2ASTERIA_EN: + return visitor.visitAura2AsteriaEn(); + case AURA2HERMES_EN: + return visitor.visitAura2HermesEn(); + case AURA2VESTA_EN: + return visitor.visitAura2VestaEn(); + case AURA2CARINA_ES: + return visitor.visitAura2CarinaEs(); + case AURA2CALLISTA_EN: + return visitor.visitAura2CallistaEn(); + case AURA2HARMONIA_EN: + return visitor.visitAura2HarmoniaEn(); + case AURA2SELENA_ES: + return visitor.visitAura2SelenaEs(); + case AURA2AURORA_EN: + return visitor.visitAura2AuroraEn(); + case AURA_ZEUS_EN: + return visitor.visitAuraZeusEn(); + case AURA2OPHELIA_EN: + return visitor.visitAura2OpheliaEn(); + case AURA2AMALTHEA_EN: + return visitor.visitAura2AmaltheaEn(); + case AURA_ORPHEUS_EN: + return visitor.visitAuraOrpheusEn(); + case AURA2DELIA_EN: + return visitor.visitAura2DeliaEn(); + case AURA_LUNA_EN: + return visitor.visitAuraLunaEn(); + case AURA2APOLLO_EN: + return visitor.visitAura2ApolloEn(); + case AURA2SELENE_EN: + return visitor.visitAura2SeleneEn(); + case AURA2THEIA_EN: + return visitor.visitAura2TheiaEn(); + case AURA_HERA_EN: + return visitor.visitAuraHeraEn(); + case AURA2CORDELIA_EN: + return visitor.visitAura2CordeliaEn(); + case AURA2ANDROMEDA_EN: + return visitor.visitAura2AndromedaEn(); + case AURA2ARIES_EN: + return visitor.visitAura2AriesEn(); + case AURA2JUNO_EN: + return visitor.visitAura2JunoEn(); + case AURA2LUNA_EN: + return visitor.visitAura2LunaEn(); + case AURA2DIANA_ES: + return visitor.visitAura2DianaEs(); + case AURA2JAVIER_ES: + return visitor.visitAura2JavierEs(); + case AURA_ORION_EN: + return visitor.visitAuraOrionEn(); + case AURA_ARCAS_EN: + return visitor.visitAuraArcasEn(); + case AURA2IRIS_EN: + return visitor.visitAura2IrisEn(); + case AURA2ATHENA_EN: + return visitor.visitAura2AthenaEn(); + case AURA2SATURN_EN: + return visitor.visitAura2SaturnEn(); + case AURA2PHOEBE_EN: + return visitor.visitAura2PhoebeEn(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel valueOf(String value) { + switch (value) { + case "aura-angus-en": + return AURA_ANGUS_EN; + case "aura-2-jupiter-en": + return AURA2JUPITER_EN; + case "aura-2-cora-en": + return AURA2CORA_EN; + case "aura-stella-en": + return AURA_STELLA_EN; + case "aura-2-helena-en": + return AURA2HELENA_EN; + case "aura-2-aquila-es": + return AURA2AQUILA_ES; + case "aura-2-atlas-en": + return AURA2ATLAS_EN; + case "aura-2-orion-en": + return AURA2ORION_EN; + case "aura-2-draco-en": + return AURA2DRACO_EN; + case "aura-2-hyperion-en": + return AURA2HYPERION_EN; + case "aura-2-janus-en": + return AURA2JANUS_EN; + case "aura-helios-en": + return AURA_HELIOS_EN; + case "aura-2-pluto-en": + return AURA2PLUTO_EN; + case "aura-2-arcas-en": + return AURA2ARCAS_EN; + case "aura-2-nestor-es": + return AURA2NESTOR_ES; + case "aura-2-neptune-en": + return AURA2NEPTUNE_EN; + case "aura-2-minerva-en": + return AURA2MINERVA_EN; + case "aura-2-alvaro-es": + return AURA2ALVARO_ES; + case "aura-athena-en": + return AURA_ATHENA_EN; + case "aura-perseus-en": + return AURA_PERSEUS_EN; + case "aura-2-odysseus-en": + return AURA2ODYSSEUS_EN; + case "aura-2-pandora-en": + return AURA2PANDORA_EN; + case "aura-2-zeus-en": + return AURA2ZEUS_EN; + case "aura-2-electra-en": + return AURA2ELECTRA_EN; + case "aura-2-orpheus-en": + return AURA2ORPHEUS_EN; + case "aura-2-thalia-en": + return AURA2THALIA_EN; + case "aura-2-celeste-es": + return AURA2CELESTE_ES; + case "aura-asteria-en": + return AURA_ASTERIA_EN; + case "aura-2-estrella-es": + return AURA2ESTRELLA_ES; + case "aura-2-hera-en": + return AURA2HERA_EN; + case "aura-2-mars-en": + return AURA2MARS_EN; + case "aura-2-sirio-es": + return AURA2SIRIO_ES; + case "aura-2-asteria-en": + return AURA2ASTERIA_EN; + case "aura-2-hermes-en": + return AURA2HERMES_EN; + case "aura-2-vesta-en": + return AURA2VESTA_EN; + case "aura-2-carina-es": + return AURA2CARINA_ES; + case "aura-2-callista-en": + return AURA2CALLISTA_EN; + case "aura-2-harmonia-en": + return AURA2HARMONIA_EN; + case "aura-2-selena-es": + return AURA2SELENA_ES; + case "aura-2-aurora-en": + return AURA2AURORA_EN; + case "aura-zeus-en": + return AURA_ZEUS_EN; + case "aura-2-ophelia-en": + return AURA2OPHELIA_EN; + case "aura-2-amalthea-en": + return AURA2AMALTHEA_EN; + case "aura-orpheus-en": + return AURA_ORPHEUS_EN; + case "aura-2-delia-en": + return AURA2DELIA_EN; + case "aura-luna-en": + return AURA_LUNA_EN; + case "aura-2-apollo-en": + return AURA2APOLLO_EN; + case "aura-2-selene-en": + return AURA2SELENE_EN; + case "aura-2-theia-en": + return AURA2THEIA_EN; + case "aura-hera-en": + return AURA_HERA_EN; + case "aura-2-cordelia-en": + return AURA2CORDELIA_EN; + case "aura-2-andromeda-en": + return AURA2ANDROMEDA_EN; + case "aura-2-aries-en": + return AURA2ARIES_EN; + case "aura-2-juno-en": + return AURA2JUNO_EN; + case "aura-2-luna-en": + return AURA2LUNA_EN; + case "aura-2-diana-es": + return AURA2DIANA_ES; + case "aura-2-javier-es": + return AURA2JAVIER_ES; + case "aura-orion-en": + return AURA_ORION_EN; + case "aura-arcas-en": + return AURA_ARCAS_EN; + case "aura-2-iris-en": + return AURA2IRIS_EN; + case "aura-2-athena-en": + return AURA2ATHENA_EN; + case "aura-2-saturn-en": + return AURA2SATURN_EN; + case "aura-2-phoebe-en": + return AURA2PHOEBE_EN; + default: + return new AgentV1SettingsAgentSpeakEndpointProviderDeepgramModel(Value.UNKNOWN, value); + } + } + + public enum Value { + AURA_ASTERIA_EN, + + AURA_LUNA_EN, + + AURA_STELLA_EN, + + AURA_ATHENA_EN, + + AURA_HERA_EN, + + AURA_ORION_EN, + + AURA_ARCAS_EN, + + AURA_PERSEUS_EN, + + AURA_ANGUS_EN, + + AURA_ORPHEUS_EN, + + AURA_HELIOS_EN, + + AURA_ZEUS_EN, + + AURA2AMALTHEA_EN, + + AURA2ANDROMEDA_EN, + + AURA2APOLLO_EN, + + AURA2ARCAS_EN, + + AURA2ARIES_EN, + + AURA2ASTERIA_EN, + + AURA2ATHENA_EN, + + AURA2ATLAS_EN, + + AURA2AURORA_EN, + + AURA2CALLISTA_EN, + + AURA2CORA_EN, + + AURA2CORDELIA_EN, + + AURA2DELIA_EN, + + AURA2DRACO_EN, + + AURA2ELECTRA_EN, + + AURA2HARMONIA_EN, + + AURA2HELENA_EN, + + AURA2HERA_EN, + + AURA2HERMES_EN, + + AURA2HYPERION_EN, + + AURA2IRIS_EN, + + AURA2JANUS_EN, + + AURA2JUNO_EN, + + AURA2JUPITER_EN, + + AURA2LUNA_EN, + + AURA2MARS_EN, + + AURA2MINERVA_EN, + + AURA2NEPTUNE_EN, + + AURA2ODYSSEUS_EN, + + AURA2OPHELIA_EN, + + AURA2ORION_EN, + + AURA2ORPHEUS_EN, + + AURA2PANDORA_EN, + + AURA2PHOEBE_EN, + + AURA2PLUTO_EN, + + AURA2SATURN_EN, + + AURA2SELENE_EN, + + AURA2THALIA_EN, + + AURA2THEIA_EN, + + AURA2VESTA_EN, + + AURA2ZEUS_EN, + + AURA2SIRIO_ES, + + AURA2NESTOR_ES, + + AURA2CARINA_ES, + + AURA2CELESTE_ES, + + AURA2ALVARO_ES, + + AURA2DIANA_ES, + + AURA2AQUILA_ES, + + AURA2SELENA_ES, + + AURA2ESTRELLA_ES, + + AURA2JAVIER_ES, + + UNKNOWN + } + + public interface Visitor { + T visitAuraAsteriaEn(); + + T visitAuraLunaEn(); + + T visitAuraStellaEn(); + + T visitAuraAthenaEn(); + + T visitAuraHeraEn(); + + T visitAuraOrionEn(); + + T visitAuraArcasEn(); + + T visitAuraPerseusEn(); + + T visitAuraAngusEn(); + + T visitAuraOrpheusEn(); + + T visitAuraHeliosEn(); + + T visitAuraZeusEn(); + + T visitAura2AmaltheaEn(); + + T visitAura2AndromedaEn(); + + T visitAura2ApolloEn(); + + T visitAura2ArcasEn(); + + T visitAura2AriesEn(); + + T visitAura2AsteriaEn(); + + T visitAura2AthenaEn(); + + T visitAura2AtlasEn(); + + T visitAura2AuroraEn(); + + T visitAura2CallistaEn(); + + T visitAura2CoraEn(); + + T visitAura2CordeliaEn(); + + T visitAura2DeliaEn(); + + T visitAura2DracoEn(); + + T visitAura2ElectraEn(); + + T visitAura2HarmoniaEn(); + + T visitAura2HelenaEn(); + + T visitAura2HeraEn(); + + T visitAura2HermesEn(); + + T visitAura2HyperionEn(); + + T visitAura2IrisEn(); + + T visitAura2JanusEn(); + + T visitAura2JunoEn(); + + T visitAura2JupiterEn(); + + T visitAura2LunaEn(); + + T visitAura2MarsEn(); + + T visitAura2MinervaEn(); + + T visitAura2NeptuneEn(); + + T visitAura2OdysseusEn(); + + T visitAura2OpheliaEn(); + + T visitAura2OrionEn(); + + T visitAura2OrpheusEn(); + + T visitAura2PandoraEn(); + + T visitAura2PhoebeEn(); + + T visitAura2PlutoEn(); + + T visitAura2SaturnEn(); + + T visitAura2SeleneEn(); + + T visitAura2ThaliaEn(); + + T visitAura2TheiaEn(); + + T visitAura2VestaEn(); + + T visitAura2ZeusEn(); + + T visitAura2SirioEs(); + + T visitAura2NestorEs(); + + T visitAura2CarinaEs(); + + T visitAura2CelesteEs(); + + T visitAura2AlvaroEs(); + + T visitAura2DianaEs(); + + T visitAura2AquilaEs(); + + T visitAura2SelenaEs(); + + T visitAura2EstrellaEs(); + + T visitAura2JavierEs(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakEndpointProviderElevenLabsModelId.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakEndpointProviderElevenLabsModelId.java new file mode 100644 index 0000000..e0dad64 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakEndpointProviderElevenLabsModelId.java @@ -0,0 +1,100 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AgentV1SettingsAgentSpeakEndpointProviderElevenLabsModelId { + public static final AgentV1SettingsAgentSpeakEndpointProviderElevenLabsModelId ELEVEN_TURBO_V25 = + new AgentV1SettingsAgentSpeakEndpointProviderElevenLabsModelId(Value.ELEVEN_TURBO_V25, "eleven_turbo_v2_5"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderElevenLabsModelId ELEVEN_MONOLINGUAL_V1 = + new AgentV1SettingsAgentSpeakEndpointProviderElevenLabsModelId( + Value.ELEVEN_MONOLINGUAL_V1, "eleven_monolingual_v1"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderElevenLabsModelId ELEVEN_MULTILINGUAL_V2 = + new AgentV1SettingsAgentSpeakEndpointProviderElevenLabsModelId( + Value.ELEVEN_MULTILINGUAL_V2, "eleven_multilingual_v2"); + + private final Value value; + + private final String string; + + AgentV1SettingsAgentSpeakEndpointProviderElevenLabsModelId(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AgentV1SettingsAgentSpeakEndpointProviderElevenLabsModelId + && this.string.equals( + ((AgentV1SettingsAgentSpeakEndpointProviderElevenLabsModelId) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ELEVEN_TURBO_V25: + return visitor.visitElevenTurboV25(); + case ELEVEN_MONOLINGUAL_V1: + return visitor.visitElevenMonolingualV1(); + case ELEVEN_MULTILINGUAL_V2: + return visitor.visitElevenMultilingualV2(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AgentV1SettingsAgentSpeakEndpointProviderElevenLabsModelId valueOf(String value) { + switch (value) { + case "eleven_turbo_v2_5": + return ELEVEN_TURBO_V25; + case "eleven_monolingual_v1": + return ELEVEN_MONOLINGUAL_V1; + case "eleven_multilingual_v2": + return ELEVEN_MULTILINGUAL_V2; + default: + return new AgentV1SettingsAgentSpeakEndpointProviderElevenLabsModelId(Value.UNKNOWN, value); + } + } + + public enum Value { + ELEVEN_TURBO_V25, + + ELEVEN_MONOLINGUAL_V1, + + ELEVEN_MULTILINGUAL_V2, + + UNKNOWN + } + + public interface Visitor { + T visitElevenTurboV25(); + + T visitElevenMonolingualV1(); + + T visitElevenMultilingualV2(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakEndpointProviderOpenAi.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakEndpointProviderOpenAi.java new file mode 100644 index 0000000..ce688e6 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakEndpointProviderOpenAi.java @@ -0,0 +1,210 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = AgentV1SettingsAgentSpeakEndpointProviderOpenAi.Builder.class) +public final class AgentV1SettingsAgentSpeakEndpointProviderOpenAi { + private final Optional version; + + private final AgentV1SettingsAgentSpeakEndpointProviderOpenAiModel model; + + private final AgentV1SettingsAgentSpeakEndpointProviderOpenAiVoice voice; + + private final Map additionalProperties; + + private AgentV1SettingsAgentSpeakEndpointProviderOpenAi( + Optional version, + AgentV1SettingsAgentSpeakEndpointProviderOpenAiModel model, + AgentV1SettingsAgentSpeakEndpointProviderOpenAiVoice voice, + Map additionalProperties) { + this.version = version; + this.model = model; + this.voice = voice; + this.additionalProperties = additionalProperties; + } + + /** + * @return The REST API version for the OpenAI text-to-speech API + */ + @JsonProperty("version") + public Optional getVersion() { + return version; + } + + /** + * @return OpenAI TTS model + */ + @JsonProperty("model") + public AgentV1SettingsAgentSpeakEndpointProviderOpenAiModel getModel() { + return model; + } + + /** + * @return OpenAI voice + */ + @JsonProperty("voice") + public AgentV1SettingsAgentSpeakEndpointProviderOpenAiVoice getVoice() { + return voice; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1SettingsAgentSpeakEndpointProviderOpenAi + && equalTo((AgentV1SettingsAgentSpeakEndpointProviderOpenAi) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1SettingsAgentSpeakEndpointProviderOpenAi other) { + return version.equals(other.version) && model.equals(other.model) && voice.equals(other.voice); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.version, this.model, this.voice); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ModelStage builder() { + return new Builder(); + } + + public interface ModelStage { + /** + *

OpenAI TTS model

+ */ + VoiceStage model(@NotNull AgentV1SettingsAgentSpeakEndpointProviderOpenAiModel model); + + Builder from(AgentV1SettingsAgentSpeakEndpointProviderOpenAi other); + } + + public interface VoiceStage { + /** + *

OpenAI voice

+ */ + _FinalStage voice(@NotNull AgentV1SettingsAgentSpeakEndpointProviderOpenAiVoice voice); + } + + public interface _FinalStage { + AgentV1SettingsAgentSpeakEndpointProviderOpenAi build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The REST API version for the OpenAI text-to-speech API

+ */ + _FinalStage version(Optional version); + + _FinalStage version(String version); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ModelStage, VoiceStage, _FinalStage { + private AgentV1SettingsAgentSpeakEndpointProviderOpenAiModel model; + + private AgentV1SettingsAgentSpeakEndpointProviderOpenAiVoice voice; + + private Optional version = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentV1SettingsAgentSpeakEndpointProviderOpenAi other) { + version(other.getVersion()); + model(other.getModel()); + voice(other.getVoice()); + return this; + } + + /** + *

OpenAI TTS model

+ *

OpenAI TTS model

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

OpenAI voice

+ *

OpenAI voice

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

The REST API version for the OpenAI text-to-speech API

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage version(String version) { + this.version = Optional.ofNullable(version); + return this; + } + + /** + *

The REST API version for the OpenAI text-to-speech API

+ */ + @java.lang.Override + @JsonSetter(value = "version", nulls = Nulls.SKIP) + public _FinalStage version(Optional version) { + this.version = version; + return this; + } + + @java.lang.Override + public AgentV1SettingsAgentSpeakEndpointProviderOpenAi build() { + return new AgentV1SettingsAgentSpeakEndpointProviderOpenAi(version, model, voice, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakEndpointProviderOpenAiModel.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakEndpointProviderOpenAiModel.java new file mode 100644 index 0000000..d2c7c1d --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakEndpointProviderOpenAiModel.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AgentV1SettingsAgentSpeakEndpointProviderOpenAiModel { + public static final AgentV1SettingsAgentSpeakEndpointProviderOpenAiModel TTS1HD = + new AgentV1SettingsAgentSpeakEndpointProviderOpenAiModel(Value.TTS1HD, "tts-1-hd"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderOpenAiModel TTS1 = + new AgentV1SettingsAgentSpeakEndpointProviderOpenAiModel(Value.TTS1, "tts-1"); + + private final Value value; + + private final String string; + + AgentV1SettingsAgentSpeakEndpointProviderOpenAiModel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AgentV1SettingsAgentSpeakEndpointProviderOpenAiModel + && this.string.equals(((AgentV1SettingsAgentSpeakEndpointProviderOpenAiModel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case TTS1HD: + return visitor.visitTts1Hd(); + case TTS1: + return visitor.visitTts1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AgentV1SettingsAgentSpeakEndpointProviderOpenAiModel valueOf(String value) { + switch (value) { + case "tts-1-hd": + return TTS1HD; + case "tts-1": + return TTS1; + default: + return new AgentV1SettingsAgentSpeakEndpointProviderOpenAiModel(Value.UNKNOWN, value); + } + } + + public enum Value { + TTS1, + + TTS1HD, + + UNKNOWN + } + + public interface Visitor { + T visitTts1(); + + T visitTts1Hd(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakEndpointProviderOpenAiVoice.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakEndpointProviderOpenAiVoice.java new file mode 100644 index 0000000..685f89c --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakEndpointProviderOpenAiVoice.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AgentV1SettingsAgentSpeakEndpointProviderOpenAiVoice { + public static final AgentV1SettingsAgentSpeakEndpointProviderOpenAiVoice SHIMMER = + new AgentV1SettingsAgentSpeakEndpointProviderOpenAiVoice(Value.SHIMMER, "shimmer"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderOpenAiVoice FABLE = + new AgentV1SettingsAgentSpeakEndpointProviderOpenAiVoice(Value.FABLE, "fable"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderOpenAiVoice ALLOY = + new AgentV1SettingsAgentSpeakEndpointProviderOpenAiVoice(Value.ALLOY, "alloy"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderOpenAiVoice ONYX = + new AgentV1SettingsAgentSpeakEndpointProviderOpenAiVoice(Value.ONYX, "onyx"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderOpenAiVoice NOVA = + new AgentV1SettingsAgentSpeakEndpointProviderOpenAiVoice(Value.NOVA, "nova"); + + public static final AgentV1SettingsAgentSpeakEndpointProviderOpenAiVoice ECHO = + new AgentV1SettingsAgentSpeakEndpointProviderOpenAiVoice(Value.ECHO, "echo"); + + private final Value value; + + private final String string; + + AgentV1SettingsAgentSpeakEndpointProviderOpenAiVoice(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AgentV1SettingsAgentSpeakEndpointProviderOpenAiVoice + && this.string.equals(((AgentV1SettingsAgentSpeakEndpointProviderOpenAiVoice) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SHIMMER: + return visitor.visitShimmer(); + case FABLE: + return visitor.visitFable(); + case ALLOY: + return visitor.visitAlloy(); + case ONYX: + return visitor.visitOnyx(); + case NOVA: + return visitor.visitNova(); + case ECHO: + return visitor.visitEcho(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AgentV1SettingsAgentSpeakEndpointProviderOpenAiVoice valueOf(String value) { + switch (value) { + case "shimmer": + return SHIMMER; + case "fable": + return FABLE; + case "alloy": + return ALLOY; + case "onyx": + return ONYX; + case "nova": + return NOVA; + case "echo": + return ECHO; + default: + return new AgentV1SettingsAgentSpeakEndpointProviderOpenAiVoice(Value.UNKNOWN, value); + } + } + + public enum Value { + ALLOY, + + ECHO, + + FABLE, + + ONYX, + + NOVA, + + SHIMMER, + + UNKNOWN + } + + public interface Visitor { + T visitAlloy(); + + T visitEcho(); + + T visitFable(); + + T visitOnyx(); + + T visitNova(); + + T visitShimmer(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakOneItem.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakOneItem.java new file mode 100644 index 0000000..c71e777 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakOneItem.java @@ -0,0 +1,168 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = AgentV1SettingsAgentSpeakOneItem.Builder.class) +public final class AgentV1SettingsAgentSpeakOneItem { + private final AgentV1SettingsAgentSpeakOneItemProvider provider; + + private final Optional endpoint; + + private final Map additionalProperties; + + private AgentV1SettingsAgentSpeakOneItem( + AgentV1SettingsAgentSpeakOneItemProvider provider, + Optional endpoint, + Map additionalProperties) { + this.provider = provider; + this.endpoint = endpoint; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public AgentV1SettingsAgentSpeakOneItemProvider getProvider() { + return provider; + } + + /** + * @return Optional if provider is Deepgram. Required for non-Deepgram TTS providers. + * When present, must include url field and headers object. Valid schemes are https and wss with wss only supported for Eleven Labs. + */ + @JsonProperty("endpoint") + public Optional getEndpoint() { + return endpoint; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1SettingsAgentSpeakOneItem && equalTo((AgentV1SettingsAgentSpeakOneItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1SettingsAgentSpeakOneItem other) { + return provider.equals(other.provider) && endpoint.equals(other.endpoint); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.provider, this.endpoint); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ProviderStage builder() { + return new Builder(); + } + + public interface ProviderStage { + _FinalStage provider(@NotNull AgentV1SettingsAgentSpeakOneItemProvider provider); + + Builder from(AgentV1SettingsAgentSpeakOneItem other); + } + + public interface _FinalStage { + AgentV1SettingsAgentSpeakOneItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Optional if provider is Deepgram. Required for non-Deepgram TTS providers. + * When present, must include url field and headers object. Valid schemes are https and wss with wss only supported for Eleven Labs.

+ */ + _FinalStage endpoint(Optional endpoint); + + _FinalStage endpoint(AgentV1SettingsAgentSpeakOneItemEndpoint endpoint); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ProviderStage, _FinalStage { + private AgentV1SettingsAgentSpeakOneItemProvider provider; + + private Optional endpoint = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentV1SettingsAgentSpeakOneItem other) { + provider(other.getProvider()); + endpoint(other.getEndpoint()); + return this; + } + + @java.lang.Override + @JsonSetter("provider") + public _FinalStage provider(@NotNull AgentV1SettingsAgentSpeakOneItemProvider provider) { + this.provider = Objects.requireNonNull(provider, "provider must not be null"); + return this; + } + + /** + *

Optional if provider is Deepgram. Required for non-Deepgram TTS providers. + * When present, must include url field and headers object. Valid schemes are https and wss with wss only supported for Eleven Labs.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage endpoint(AgentV1SettingsAgentSpeakOneItemEndpoint endpoint) { + this.endpoint = Optional.ofNullable(endpoint); + return this; + } + + /** + *

Optional if provider is Deepgram. Required for non-Deepgram TTS providers. + * When present, must include url field and headers object. Valid schemes are https and wss with wss only supported for Eleven Labs.

+ */ + @java.lang.Override + @JsonSetter(value = "endpoint", nulls = Nulls.SKIP) + public _FinalStage endpoint(Optional endpoint) { + this.endpoint = endpoint; + return this; + } + + @java.lang.Override + public AgentV1SettingsAgentSpeakOneItem build() { + return new AgentV1SettingsAgentSpeakOneItem(provider, endpoint, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakOneItemEndpoint.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakOneItemEndpoint.java new file mode 100644 index 0000000..b64ce8c --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakOneItemEndpoint.java @@ -0,0 +1,135 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AgentV1SettingsAgentSpeakOneItemEndpoint.Builder.class) +public final class AgentV1SettingsAgentSpeakOneItemEndpoint { + private final Optional url; + + private final Optional> headers; + + private final Map additionalProperties; + + private AgentV1SettingsAgentSpeakOneItemEndpoint( + Optional url, Optional> headers, Map additionalProperties) { + this.url = url; + this.headers = headers; + this.additionalProperties = additionalProperties; + } + + /** + * @return Custom TTS endpoint URL. Cannot contain output_format or model_id query parameters when the provider is Eleven Labs. + */ + @JsonProperty("url") + public Optional getUrl() { + return url; + } + + @JsonProperty("headers") + public Optional> getHeaders() { + return headers; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1SettingsAgentSpeakOneItemEndpoint + && equalTo((AgentV1SettingsAgentSpeakOneItemEndpoint) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1SettingsAgentSpeakOneItemEndpoint other) { + return url.equals(other.url) && headers.equals(other.headers); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.url, this.headers); + } + + @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 url = Optional.empty(); + + private Optional> headers = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AgentV1SettingsAgentSpeakOneItemEndpoint other) { + url(other.getUrl()); + headers(other.getHeaders()); + return this; + } + + /** + *

Custom TTS endpoint URL. Cannot contain output_format or model_id query parameters when the provider is Eleven Labs.

+ */ + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public Builder url(Optional url) { + this.url = url; + return this; + } + + public Builder url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + @JsonSetter(value = "headers", nulls = Nulls.SKIP) + public Builder headers(Optional> headers) { + this.headers = headers; + return this; + } + + public Builder headers(Map headers) { + this.headers = Optional.ofNullable(headers); + return this; + } + + public AgentV1SettingsAgentSpeakOneItemEndpoint build() { + return new AgentV1SettingsAgentSpeakOneItemEndpoint(url, headers, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakOneItemProvider.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakOneItemProvider.java new file mode 100644 index 0000000..3151bc2 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakOneItemProvider.java @@ -0,0 +1,401 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.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 AgentV1SettingsAgentSpeakOneItemProvider { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private AgentV1SettingsAgentSpeakOneItemProvider(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static AgentV1SettingsAgentSpeakOneItemProvider deepgram(Deepgram value) { + return new AgentV1SettingsAgentSpeakOneItemProvider(new DeepgramValue(value)); + } + + public static AgentV1SettingsAgentSpeakOneItemProvider elevenLabs(ElevenLabs value) { + return new AgentV1SettingsAgentSpeakOneItemProvider(new ElevenLabsValue(value)); + } + + public static AgentV1SettingsAgentSpeakOneItemProvider cartesia(Cartesia value) { + return new AgentV1SettingsAgentSpeakOneItemProvider(new CartesiaValue(value)); + } + + public static AgentV1SettingsAgentSpeakOneItemProvider openAi( + AgentV1SettingsAgentSpeakOneItemProviderOpenAi value) { + return new AgentV1SettingsAgentSpeakOneItemProvider(new OpenAiValue(value)); + } + + public static AgentV1SettingsAgentSpeakOneItemProvider awsPolly( + AgentV1SettingsAgentSpeakOneItemProviderAwsPolly value) { + return new AgentV1SettingsAgentSpeakOneItemProvider(new AwsPollyValue(value)); + } + + public boolean isDeepgram() { + return value instanceof DeepgramValue; + } + + public boolean isElevenLabs() { + return value instanceof ElevenLabsValue; + } + + public boolean isCartesia() { + return value instanceof CartesiaValue; + } + + public boolean isOpenAi() { + return value instanceof OpenAiValue; + } + + public boolean isAwsPolly() { + return value instanceof AwsPollyValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getDeepgram() { + if (isDeepgram()) { + return Optional.of(((DeepgramValue) value).value); + } + return Optional.empty(); + } + + public Optional getElevenLabs() { + if (isElevenLabs()) { + return Optional.of(((ElevenLabsValue) value).value); + } + return Optional.empty(); + } + + public Optional getCartesia() { + if (isCartesia()) { + return Optional.of(((CartesiaValue) value).value); + } + return Optional.empty(); + } + + public Optional getOpenAi() { + if (isOpenAi()) { + return Optional.of(((OpenAiValue) value).value); + } + return Optional.empty(); + } + + public Optional getAwsPolly() { + if (isAwsPolly()) { + return Optional.of(((AwsPollyValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1SettingsAgentSpeakOneItemProvider + && value.equals(((AgentV1SettingsAgentSpeakOneItemProvider) other).value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + return value.toString(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitDeepgram(Deepgram deepgram); + + T visitElevenLabs(ElevenLabs elevenLabs); + + T visitCartesia(Cartesia cartesia); + + T visitOpenAi(AgentV1SettingsAgentSpeakOneItemProviderOpenAi openAi); + + T visitAwsPolly(AgentV1SettingsAgentSpeakOneItemProviderAwsPolly awsPolly); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(DeepgramValue.class), + @JsonSubTypes.Type(ElevenLabsValue.class), + @JsonSubTypes.Type(CartesiaValue.class), + @JsonSubTypes.Type(OpenAiValue.class), + @JsonSubTypes.Type(AwsPollyValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("deepgram") + @JsonIgnoreProperties("type") + private static final class DeepgramValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "type", allowSetters = true) + private Deepgram value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private DeepgramValue() {} + + private DeepgramValue(Deepgram 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 "AgentV1SettingsAgentSpeakOneItemProvider{" + "value: " + value + "}"; + } + } + + @JsonTypeName("eleven_labs") + @JsonIgnoreProperties("type") + private static final class ElevenLabsValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "type", allowSetters = true) + private ElevenLabs value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ElevenLabsValue() {} + + private ElevenLabsValue(ElevenLabs value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitElevenLabs(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ElevenLabsValue && equalTo((ElevenLabsValue) other); + } + + private boolean equalTo(ElevenLabsValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AgentV1SettingsAgentSpeakOneItemProvider{" + "value: " + value + "}"; + } + } + + @JsonTypeName("cartesia") + @JsonIgnoreProperties("type") + private static final class CartesiaValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "type", allowSetters = true) + private Cartesia value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private CartesiaValue() {} + + private CartesiaValue(Cartesia 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 "AgentV1SettingsAgentSpeakOneItemProvider{" + "value: " + value + "}"; + } + } + + @JsonTypeName("open_ai") + @JsonIgnoreProperties("type") + private static final class OpenAiValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "type", allowSetters = true) + private AgentV1SettingsAgentSpeakOneItemProviderOpenAi value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private OpenAiValue() {} + + private OpenAiValue(AgentV1SettingsAgentSpeakOneItemProviderOpenAi 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 "AgentV1SettingsAgentSpeakOneItemProvider{" + "value: " + value + "}"; + } + } + + @JsonTypeName("aws_polly") + @JsonIgnoreProperties("type") + private static final class AwsPollyValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "type", allowSetters = true) + private AgentV1SettingsAgentSpeakOneItemProviderAwsPolly value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private AwsPollyValue() {} + + private AwsPollyValue(AgentV1SettingsAgentSpeakOneItemProviderAwsPolly value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitAwsPolly(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AwsPollyValue && equalTo((AwsPollyValue) other); + } + + private boolean equalTo(AwsPollyValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AgentV1SettingsAgentSpeakOneItemProvider{" + "value: " + value + "}"; + } + } + + @JsonIgnoreProperties("type") + 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 "AgentV1SettingsAgentSpeakOneItemProvider{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakOneItemProviderAwsPolly.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakOneItemProviderAwsPolly.java new file mode 100644 index 0000000..dddef28 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakOneItemProviderAwsPolly.java @@ -0,0 +1,262 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = AgentV1SettingsAgentSpeakOneItemProviderAwsPolly.Builder.class) +public final class AgentV1SettingsAgentSpeakOneItemProviderAwsPolly { + private final AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice voice; + + private final String language; + + private final Optional languageCode; + + private final AgentV1SettingsAgentSpeakOneItemProviderAwsPollyEngine engine; + + private final AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentials credentials; + + private final Map additionalProperties; + + private AgentV1SettingsAgentSpeakOneItemProviderAwsPolly( + AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice voice, + String language, + Optional languageCode, + AgentV1SettingsAgentSpeakOneItemProviderAwsPollyEngine engine, + AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentials credentials, + Map additionalProperties) { + this.voice = voice; + this.language = language; + this.languageCode = languageCode; + this.engine = engine; + this.credentials = credentials; + this.additionalProperties = additionalProperties; + } + + /** + * @return AWS Polly voice name + */ + @JsonProperty("voice") + public AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice getVoice() { + return voice; + } + + /** + * @return Language code to use, e.g. 'en-US'. Corresponds to the language_code parameter in the AWS Polly API + */ + @JsonProperty("language") + public String getLanguage() { + return language; + } + + /** + * @return Use the language field instead. + */ + @JsonProperty("language_code") + public Optional getLanguageCode() { + return languageCode; + } + + @JsonProperty("engine") + public AgentV1SettingsAgentSpeakOneItemProviderAwsPollyEngine getEngine() { + return engine; + } + + @JsonProperty("credentials") + public AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentials getCredentials() { + return credentials; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1SettingsAgentSpeakOneItemProviderAwsPolly + && equalTo((AgentV1SettingsAgentSpeakOneItemProviderAwsPolly) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1SettingsAgentSpeakOneItemProviderAwsPolly other) { + return voice.equals(other.voice) + && language.equals(other.language) + && languageCode.equals(other.languageCode) + && engine.equals(other.engine) + && credentials.equals(other.credentials); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.voice, this.language, this.languageCode, this.engine, this.credentials); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static VoiceStage builder() { + return new Builder(); + } + + public interface VoiceStage { + /** + *

AWS Polly voice name

+ */ + LanguageStage voice(@NotNull AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice voice); + + Builder from(AgentV1SettingsAgentSpeakOneItemProviderAwsPolly other); + } + + public interface LanguageStage { + /** + *

Language code to use, e.g. 'en-US'. Corresponds to the language_code parameter in the AWS Polly API

+ */ + EngineStage language(@NotNull String language); + } + + public interface EngineStage { + CredentialsStage engine(@NotNull AgentV1SettingsAgentSpeakOneItemProviderAwsPollyEngine engine); + } + + public interface CredentialsStage { + _FinalStage credentials(@NotNull AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentials credentials); + } + + public interface _FinalStage { + AgentV1SettingsAgentSpeakOneItemProviderAwsPolly build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Use the language field instead.

+ */ + _FinalStage languageCode(Optional languageCode); + + _FinalStage languageCode(String languageCode); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements VoiceStage, LanguageStage, EngineStage, CredentialsStage, _FinalStage { + private AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice voice; + + private String language; + + private AgentV1SettingsAgentSpeakOneItemProviderAwsPollyEngine engine; + + private AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentials credentials; + + private Optional languageCode = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentV1SettingsAgentSpeakOneItemProviderAwsPolly other) { + voice(other.getVoice()); + language(other.getLanguage()); + languageCode(other.getLanguageCode()); + engine(other.getEngine()); + credentials(other.getCredentials()); + return this; + } + + /** + *

AWS Polly voice name

+ *

AWS Polly voice name

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

Language code to use, e.g. 'en-US'. Corresponds to the language_code parameter in the AWS Polly API

+ *

Language code to use, e.g. 'en-US'. Corresponds to the language_code parameter in the AWS Polly API

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

Use the language field instead.

+ * @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; + } + + /** + *

Use the language field instead.

+ */ + @java.lang.Override + @JsonSetter(value = "language_code", nulls = Nulls.SKIP) + public _FinalStage languageCode(Optional languageCode) { + this.languageCode = languageCode; + return this; + } + + @java.lang.Override + public AgentV1SettingsAgentSpeakOneItemProviderAwsPolly build() { + return new AgentV1SettingsAgentSpeakOneItemProviderAwsPolly( + voice, language, languageCode, engine, credentials, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentials.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentials.java new file mode 100644 index 0000000..909cdb6 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentials.java @@ -0,0 +1,240 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentials.Builder.class) +public final class AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentials { + private final AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsType type; + + private final String region; + + private final String accessKeyId; + + private final String secretAccessKey; + + private final Optional sessionToken; + + private final Map additionalProperties; + + private AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentials( + AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsType type, + String region, + String accessKeyId, + String secretAccessKey, + Optional sessionToken, + Map additionalProperties) { + this.type = type; + this.region = region; + this.accessKeyId = accessKeyId; + this.secretAccessKey = secretAccessKey; + this.sessionToken = sessionToken; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("type") + public AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsType getType() { + return type; + } + + @JsonProperty("region") + public String getRegion() { + return region; + } + + @JsonProperty("access_key_id") + public String getAccessKeyId() { + return accessKeyId; + } + + @JsonProperty("secret_access_key") + public String getSecretAccessKey() { + return secretAccessKey; + } + + /** + * @return Required for STS only + */ + @JsonProperty("session_token") + public Optional getSessionToken() { + return sessionToken; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentials + && equalTo((AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentials) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentials other) { + return type.equals(other.type) + && region.equals(other.region) + && accessKeyId.equals(other.accessKeyId) + && secretAccessKey.equals(other.secretAccessKey) + && sessionToken.equals(other.sessionToken); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.region, this.accessKeyId, this.secretAccessKey, this.sessionToken); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TypeStage builder() { + return new Builder(); + } + + public interface TypeStage { + RegionStage type(@NotNull AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsType type); + + Builder from(AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentials other); + } + + public interface RegionStage { + AccessKeyIdStage region(@NotNull String region); + } + + public interface AccessKeyIdStage { + SecretAccessKeyStage accessKeyId(@NotNull String accessKeyId); + } + + public interface SecretAccessKeyStage { + _FinalStage secretAccessKey(@NotNull String secretAccessKey); + } + + public interface _FinalStage { + AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentials build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Required for STS only

+ */ + _FinalStage sessionToken(Optional sessionToken); + + _FinalStage sessionToken(String sessionToken); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements TypeStage, RegionStage, AccessKeyIdStage, SecretAccessKeyStage, _FinalStage { + private AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsType type; + + private String region; + + private String accessKeyId; + + private String secretAccessKey; + + private Optional sessionToken = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentials other) { + type(other.getType()); + region(other.getRegion()); + accessKeyId(other.getAccessKeyId()); + secretAccessKey(other.getSecretAccessKey()); + sessionToken(other.getSessionToken()); + return this; + } + + @java.lang.Override + @JsonSetter("type") + public RegionStage type(@NotNull AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("region") + public AccessKeyIdStage region(@NotNull String region) { + this.region = Objects.requireNonNull(region, "region must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("access_key_id") + public SecretAccessKeyStage accessKeyId(@NotNull String accessKeyId) { + this.accessKeyId = Objects.requireNonNull(accessKeyId, "accessKeyId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("secret_access_key") + public _FinalStage secretAccessKey(@NotNull String secretAccessKey) { + this.secretAccessKey = Objects.requireNonNull(secretAccessKey, "secretAccessKey must not be null"); + return this; + } + + /** + *

Required for STS only

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sessionToken(String sessionToken) { + this.sessionToken = Optional.ofNullable(sessionToken); + return this; + } + + /** + *

Required for STS only

+ */ + @java.lang.Override + @JsonSetter(value = "session_token", nulls = Nulls.SKIP) + public _FinalStage sessionToken(Optional sessionToken) { + this.sessionToken = sessionToken; + return this; + } + + @java.lang.Override + public AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentials build() { + return new AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentials( + type, region, accessKeyId, secretAccessKey, sessionToken, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsType.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsType.java new file mode 100644 index 0000000..ee66d77 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsType.java @@ -0,0 +1,87 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsType { + public static final AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsType IAM = + new AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsType(Value.IAM, "iam"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsType STS = + new AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsType(Value.STS, "sts"); + + private final Value value; + + private final String string; + + AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsType + && this.string.equals( + ((AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case IAM: + return visitor.visitIam(); + case STS: + return visitor.visitSts(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsType valueOf(String value) { + switch (value) { + case "iam": + return IAM; + case "sts": + return STS; + default: + return new AgentV1SettingsAgentSpeakOneItemProviderAwsPollyCredentialsType(Value.UNKNOWN, value); + } + } + + public enum Value { + STS, + + IAM, + + UNKNOWN + } + + public interface Visitor { + T visitSts(); + + T visitIam(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakOneItemProviderAwsPollyEngine.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakOneItemProviderAwsPollyEngine.java new file mode 100644 index 0000000..19fe132 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakOneItemProviderAwsPollyEngine.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AgentV1SettingsAgentSpeakOneItemProviderAwsPollyEngine { + public static final AgentV1SettingsAgentSpeakOneItemProviderAwsPollyEngine LONG_FORM = + new AgentV1SettingsAgentSpeakOneItemProviderAwsPollyEngine(Value.LONG_FORM, "long-form"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderAwsPollyEngine STANDARD = + new AgentV1SettingsAgentSpeakOneItemProviderAwsPollyEngine(Value.STANDARD, "standard"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderAwsPollyEngine GENERATIVE = + new AgentV1SettingsAgentSpeakOneItemProviderAwsPollyEngine(Value.GENERATIVE, "generative"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderAwsPollyEngine NEURAL = + new AgentV1SettingsAgentSpeakOneItemProviderAwsPollyEngine(Value.NEURAL, "neural"); + + private final Value value; + + private final String string; + + AgentV1SettingsAgentSpeakOneItemProviderAwsPollyEngine(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AgentV1SettingsAgentSpeakOneItemProviderAwsPollyEngine + && this.string.equals(((AgentV1SettingsAgentSpeakOneItemProviderAwsPollyEngine) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case LONG_FORM: + return visitor.visitLongForm(); + case STANDARD: + return visitor.visitStandard(); + case GENERATIVE: + return visitor.visitGenerative(); + case NEURAL: + return visitor.visitNeural(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AgentV1SettingsAgentSpeakOneItemProviderAwsPollyEngine valueOf(String value) { + switch (value) { + case "long-form": + return LONG_FORM; + case "standard": + return STANDARD; + case "generative": + return GENERATIVE; + case "neural": + return NEURAL; + default: + return new AgentV1SettingsAgentSpeakOneItemProviderAwsPollyEngine(Value.UNKNOWN, value); + } + } + + public enum Value { + GENERATIVE, + + LONG_FORM, + + STANDARD, + + NEURAL, + + UNKNOWN + } + + public interface Visitor { + T visitGenerative(); + + T visitLongForm(); + + T visitStandard(); + + T visitNeural(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice.java new file mode 100644 index 0000000..58fc312 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice.java @@ -0,0 +1,152 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice { + public static final AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice ARTHUR = + new AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice(Value.ARTHUR, "Arthur"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice JOANNA = + new AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice(Value.JOANNA, "Joanna"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice BRIAN = + new AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice(Value.BRIAN, "Brian"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice AMY = + new AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice(Value.AMY, "Amy"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice EMMA = + new AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice(Value.EMMA, "Emma"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice MATTHEW = + new AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice(Value.MATTHEW, "Matthew"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice ARIA = + new AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice(Value.ARIA, "Aria"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice AYANDA = + new AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice(Value.AYANDA, "Ayanda"); + + private final Value value; + + private final String string; + + AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice + && this.string.equals(((AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ARTHUR: + return visitor.visitArthur(); + case JOANNA: + return visitor.visitJoanna(); + case BRIAN: + return visitor.visitBrian(); + case AMY: + return visitor.visitAmy(); + case EMMA: + return visitor.visitEmma(); + case MATTHEW: + return visitor.visitMatthew(); + case ARIA: + return visitor.visitAria(); + case AYANDA: + return visitor.visitAyanda(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice valueOf(String value) { + switch (value) { + case "Arthur": + return ARTHUR; + case "Joanna": + return JOANNA; + case "Brian": + return BRIAN; + case "Amy": + return AMY; + case "Emma": + return EMMA; + case "Matthew": + return MATTHEW; + case "Aria": + return ARIA; + case "Ayanda": + return AYANDA; + default: + return new AgentV1SettingsAgentSpeakOneItemProviderAwsPollyVoice(Value.UNKNOWN, value); + } + } + + public enum Value { + MATTHEW, + + JOANNA, + + AMY, + + EMMA, + + BRIAN, + + ARTHUR, + + ARIA, + + AYANDA, + + UNKNOWN + } + + public interface Visitor { + T visitMatthew(); + + T visitJoanna(); + + T visitAmy(); + + T visitEmma(); + + T visitBrian(); + + T visitArthur(); + + T visitAria(); + + T visitAyanda(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakOneItemProviderCartesiaModelId.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakOneItemProviderCartesiaModelId.java new file mode 100644 index 0000000..d7c3a32 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakOneItemProviderCartesiaModelId.java @@ -0,0 +1,87 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AgentV1SettingsAgentSpeakOneItemProviderCartesiaModelId { + public static final AgentV1SettingsAgentSpeakOneItemProviderCartesiaModelId SONIC_MULTILINGUAL = + new AgentV1SettingsAgentSpeakOneItemProviderCartesiaModelId(Value.SONIC_MULTILINGUAL, "sonic-multilingual"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderCartesiaModelId SONIC2 = + new AgentV1SettingsAgentSpeakOneItemProviderCartesiaModelId(Value.SONIC2, "sonic-2"); + + private final Value value; + + private final String string; + + AgentV1SettingsAgentSpeakOneItemProviderCartesiaModelId(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AgentV1SettingsAgentSpeakOneItemProviderCartesiaModelId + && this.string.equals( + ((AgentV1SettingsAgentSpeakOneItemProviderCartesiaModelId) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SONIC_MULTILINGUAL: + return visitor.visitSonicMultilingual(); + case SONIC2: + return visitor.visitSonic2(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AgentV1SettingsAgentSpeakOneItemProviderCartesiaModelId valueOf(String value) { + switch (value) { + case "sonic-multilingual": + return SONIC_MULTILINGUAL; + case "sonic-2": + return SONIC2; + default: + return new AgentV1SettingsAgentSpeakOneItemProviderCartesiaModelId(Value.UNKNOWN, value); + } + } + + public enum Value { + SONIC2, + + SONIC_MULTILINGUAL, + + UNKNOWN + } + + public interface Visitor { + T visitSonic2(); + + T visitSonicMultilingual(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoice.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoice.java new file mode 100644 index 0000000..aafe663 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoice.java @@ -0,0 +1,164 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoice.Builder.class) +public final class AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoice { + private final String mode; + + private final String id; + + private final Map additionalProperties; + + private AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoice( + String mode, String id, Map additionalProperties) { + this.mode = mode; + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return Cartesia voice mode + */ + @JsonProperty("mode") + public String getMode() { + return mode; + } + + /** + * @return Cartesia voice ID + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoice + && equalTo((AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoice) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoice other) { + return mode.equals(other.mode) && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.mode, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ModeStage builder() { + return new Builder(); + } + + public interface ModeStage { + /** + *

Cartesia voice mode

+ */ + IdStage mode(@NotNull String mode); + + Builder from(AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoice other); + } + + public interface IdStage { + /** + *

Cartesia voice ID

+ */ + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoice build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ModeStage, IdStage, _FinalStage { + private String mode; + + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoice other) { + mode(other.getMode()); + id(other.getId()); + return this; + } + + /** + *

Cartesia voice mode

+ *

Cartesia voice mode

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

Cartesia voice ID

+ *

Cartesia voice ID

+ * @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 AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoice build() { + return new AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoice(mode, id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel.java new file mode 100644 index 0000000..0d9c18a --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel.java @@ -0,0 +1,757 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel { + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA_ANGUS_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA_ANGUS_EN, "aura-angus-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2JUPITER_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2JUPITER_EN, "aura-2-jupiter-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2CORA_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2CORA_EN, "aura-2-cora-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA_STELLA_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA_STELLA_EN, "aura-stella-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2HELENA_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2HELENA_EN, "aura-2-helena-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2AQUILA_ES = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2AQUILA_ES, "aura-2-aquila-es"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2ATLAS_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2ATLAS_EN, "aura-2-atlas-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2ORION_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2ORION_EN, "aura-2-orion-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2DRACO_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2DRACO_EN, "aura-2-draco-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2HYPERION_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2HYPERION_EN, "aura-2-hyperion-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2JANUS_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2JANUS_EN, "aura-2-janus-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA_HELIOS_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA_HELIOS_EN, "aura-helios-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2PLUTO_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2PLUTO_EN, "aura-2-pluto-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2ARCAS_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2ARCAS_EN, "aura-2-arcas-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2NESTOR_ES = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2NESTOR_ES, "aura-2-nestor-es"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2NEPTUNE_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2NEPTUNE_EN, "aura-2-neptune-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2MINERVA_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2MINERVA_EN, "aura-2-minerva-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2ALVARO_ES = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2ALVARO_ES, "aura-2-alvaro-es"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA_ATHENA_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA_ATHENA_EN, "aura-athena-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA_PERSEUS_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA_PERSEUS_EN, "aura-perseus-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2ODYSSEUS_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2ODYSSEUS_EN, "aura-2-odysseus-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2PANDORA_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2PANDORA_EN, "aura-2-pandora-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2ZEUS_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2ZEUS_EN, "aura-2-zeus-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2ELECTRA_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2ELECTRA_EN, "aura-2-electra-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2ORPHEUS_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2ORPHEUS_EN, "aura-2-orpheus-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2THALIA_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2THALIA_EN, "aura-2-thalia-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2CELESTE_ES = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2CELESTE_ES, "aura-2-celeste-es"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA_ASTERIA_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA_ASTERIA_EN, "aura-asteria-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2ESTRELLA_ES = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2ESTRELLA_ES, "aura-2-estrella-es"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2HERA_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2HERA_EN, "aura-2-hera-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2MARS_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2MARS_EN, "aura-2-mars-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2SIRIO_ES = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2SIRIO_ES, "aura-2-sirio-es"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2ASTERIA_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2ASTERIA_EN, "aura-2-asteria-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2HERMES_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2HERMES_EN, "aura-2-hermes-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2VESTA_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2VESTA_EN, "aura-2-vesta-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2CARINA_ES = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2CARINA_ES, "aura-2-carina-es"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2CALLISTA_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2CALLISTA_EN, "aura-2-callista-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2HARMONIA_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2HARMONIA_EN, "aura-2-harmonia-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2SELENA_ES = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2SELENA_ES, "aura-2-selena-es"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2AURORA_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2AURORA_EN, "aura-2-aurora-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA_ZEUS_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA_ZEUS_EN, "aura-zeus-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2OPHELIA_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2OPHELIA_EN, "aura-2-ophelia-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2AMALTHEA_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2AMALTHEA_EN, "aura-2-amalthea-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA_ORPHEUS_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA_ORPHEUS_EN, "aura-orpheus-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2DELIA_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2DELIA_EN, "aura-2-delia-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA_LUNA_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA_LUNA_EN, "aura-luna-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2APOLLO_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2APOLLO_EN, "aura-2-apollo-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2SELENE_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2SELENE_EN, "aura-2-selene-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2THEIA_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2THEIA_EN, "aura-2-theia-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA_HERA_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA_HERA_EN, "aura-hera-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2CORDELIA_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2CORDELIA_EN, "aura-2-cordelia-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2ANDROMEDA_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2ANDROMEDA_EN, "aura-2-andromeda-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2ARIES_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2ARIES_EN, "aura-2-aries-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2JUNO_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2JUNO_EN, "aura-2-juno-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2LUNA_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2LUNA_EN, "aura-2-luna-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2DIANA_ES = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2DIANA_ES, "aura-2-diana-es"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2JAVIER_ES = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2JAVIER_ES, "aura-2-javier-es"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA_ORION_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA_ORION_EN, "aura-orion-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA_ARCAS_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA_ARCAS_EN, "aura-arcas-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2IRIS_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2IRIS_EN, "aura-2-iris-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2ATHENA_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2ATHENA_EN, "aura-2-athena-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2SATURN_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2SATURN_EN, "aura-2-saturn-en"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel AURA2PHOEBE_EN = + new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.AURA2PHOEBE_EN, "aura-2-phoebe-en"); + + private final Value value; + + private final String string; + + AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel + && this.string.equals(((AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case AURA_ANGUS_EN: + return visitor.visitAuraAngusEn(); + case AURA2JUPITER_EN: + return visitor.visitAura2JupiterEn(); + case AURA2CORA_EN: + return visitor.visitAura2CoraEn(); + case AURA_STELLA_EN: + return visitor.visitAuraStellaEn(); + case AURA2HELENA_EN: + return visitor.visitAura2HelenaEn(); + case AURA2AQUILA_ES: + return visitor.visitAura2AquilaEs(); + case AURA2ATLAS_EN: + return visitor.visitAura2AtlasEn(); + case AURA2ORION_EN: + return visitor.visitAura2OrionEn(); + case AURA2DRACO_EN: + return visitor.visitAura2DracoEn(); + case AURA2HYPERION_EN: + return visitor.visitAura2HyperionEn(); + case AURA2JANUS_EN: + return visitor.visitAura2JanusEn(); + case AURA_HELIOS_EN: + return visitor.visitAuraHeliosEn(); + case AURA2PLUTO_EN: + return visitor.visitAura2PlutoEn(); + case AURA2ARCAS_EN: + return visitor.visitAura2ArcasEn(); + case AURA2NESTOR_ES: + return visitor.visitAura2NestorEs(); + case AURA2NEPTUNE_EN: + return visitor.visitAura2NeptuneEn(); + case AURA2MINERVA_EN: + return visitor.visitAura2MinervaEn(); + case AURA2ALVARO_ES: + return visitor.visitAura2AlvaroEs(); + case AURA_ATHENA_EN: + return visitor.visitAuraAthenaEn(); + case AURA_PERSEUS_EN: + return visitor.visitAuraPerseusEn(); + case AURA2ODYSSEUS_EN: + return visitor.visitAura2OdysseusEn(); + case AURA2PANDORA_EN: + return visitor.visitAura2PandoraEn(); + case AURA2ZEUS_EN: + return visitor.visitAura2ZeusEn(); + case AURA2ELECTRA_EN: + return visitor.visitAura2ElectraEn(); + case AURA2ORPHEUS_EN: + return visitor.visitAura2OrpheusEn(); + case AURA2THALIA_EN: + return visitor.visitAura2ThaliaEn(); + case AURA2CELESTE_ES: + return visitor.visitAura2CelesteEs(); + case AURA_ASTERIA_EN: + return visitor.visitAuraAsteriaEn(); + case AURA2ESTRELLA_ES: + return visitor.visitAura2EstrellaEs(); + case AURA2HERA_EN: + return visitor.visitAura2HeraEn(); + case AURA2MARS_EN: + return visitor.visitAura2MarsEn(); + case AURA2SIRIO_ES: + return visitor.visitAura2SirioEs(); + case AURA2ASTERIA_EN: + return visitor.visitAura2AsteriaEn(); + case AURA2HERMES_EN: + return visitor.visitAura2HermesEn(); + case AURA2VESTA_EN: + return visitor.visitAura2VestaEn(); + case AURA2CARINA_ES: + return visitor.visitAura2CarinaEs(); + case AURA2CALLISTA_EN: + return visitor.visitAura2CallistaEn(); + case AURA2HARMONIA_EN: + return visitor.visitAura2HarmoniaEn(); + case AURA2SELENA_ES: + return visitor.visitAura2SelenaEs(); + case AURA2AURORA_EN: + return visitor.visitAura2AuroraEn(); + case AURA_ZEUS_EN: + return visitor.visitAuraZeusEn(); + case AURA2OPHELIA_EN: + return visitor.visitAura2OpheliaEn(); + case AURA2AMALTHEA_EN: + return visitor.visitAura2AmaltheaEn(); + case AURA_ORPHEUS_EN: + return visitor.visitAuraOrpheusEn(); + case AURA2DELIA_EN: + return visitor.visitAura2DeliaEn(); + case AURA_LUNA_EN: + return visitor.visitAuraLunaEn(); + case AURA2APOLLO_EN: + return visitor.visitAura2ApolloEn(); + case AURA2SELENE_EN: + return visitor.visitAura2SeleneEn(); + case AURA2THEIA_EN: + return visitor.visitAura2TheiaEn(); + case AURA_HERA_EN: + return visitor.visitAuraHeraEn(); + case AURA2CORDELIA_EN: + return visitor.visitAura2CordeliaEn(); + case AURA2ANDROMEDA_EN: + return visitor.visitAura2AndromedaEn(); + case AURA2ARIES_EN: + return visitor.visitAura2AriesEn(); + case AURA2JUNO_EN: + return visitor.visitAura2JunoEn(); + case AURA2LUNA_EN: + return visitor.visitAura2LunaEn(); + case AURA2DIANA_ES: + return visitor.visitAura2DianaEs(); + case AURA2JAVIER_ES: + return visitor.visitAura2JavierEs(); + case AURA_ORION_EN: + return visitor.visitAuraOrionEn(); + case AURA_ARCAS_EN: + return visitor.visitAuraArcasEn(); + case AURA2IRIS_EN: + return visitor.visitAura2IrisEn(); + case AURA2ATHENA_EN: + return visitor.visitAura2AthenaEn(); + case AURA2SATURN_EN: + return visitor.visitAura2SaturnEn(); + case AURA2PHOEBE_EN: + return visitor.visitAura2PhoebeEn(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel valueOf(String value) { + switch (value) { + case "aura-angus-en": + return AURA_ANGUS_EN; + case "aura-2-jupiter-en": + return AURA2JUPITER_EN; + case "aura-2-cora-en": + return AURA2CORA_EN; + case "aura-stella-en": + return AURA_STELLA_EN; + case "aura-2-helena-en": + return AURA2HELENA_EN; + case "aura-2-aquila-es": + return AURA2AQUILA_ES; + case "aura-2-atlas-en": + return AURA2ATLAS_EN; + case "aura-2-orion-en": + return AURA2ORION_EN; + case "aura-2-draco-en": + return AURA2DRACO_EN; + case "aura-2-hyperion-en": + return AURA2HYPERION_EN; + case "aura-2-janus-en": + return AURA2JANUS_EN; + case "aura-helios-en": + return AURA_HELIOS_EN; + case "aura-2-pluto-en": + return AURA2PLUTO_EN; + case "aura-2-arcas-en": + return AURA2ARCAS_EN; + case "aura-2-nestor-es": + return AURA2NESTOR_ES; + case "aura-2-neptune-en": + return AURA2NEPTUNE_EN; + case "aura-2-minerva-en": + return AURA2MINERVA_EN; + case "aura-2-alvaro-es": + return AURA2ALVARO_ES; + case "aura-athena-en": + return AURA_ATHENA_EN; + case "aura-perseus-en": + return AURA_PERSEUS_EN; + case "aura-2-odysseus-en": + return AURA2ODYSSEUS_EN; + case "aura-2-pandora-en": + return AURA2PANDORA_EN; + case "aura-2-zeus-en": + return AURA2ZEUS_EN; + case "aura-2-electra-en": + return AURA2ELECTRA_EN; + case "aura-2-orpheus-en": + return AURA2ORPHEUS_EN; + case "aura-2-thalia-en": + return AURA2THALIA_EN; + case "aura-2-celeste-es": + return AURA2CELESTE_ES; + case "aura-asteria-en": + return AURA_ASTERIA_EN; + case "aura-2-estrella-es": + return AURA2ESTRELLA_ES; + case "aura-2-hera-en": + return AURA2HERA_EN; + case "aura-2-mars-en": + return AURA2MARS_EN; + case "aura-2-sirio-es": + return AURA2SIRIO_ES; + case "aura-2-asteria-en": + return AURA2ASTERIA_EN; + case "aura-2-hermes-en": + return AURA2HERMES_EN; + case "aura-2-vesta-en": + return AURA2VESTA_EN; + case "aura-2-carina-es": + return AURA2CARINA_ES; + case "aura-2-callista-en": + return AURA2CALLISTA_EN; + case "aura-2-harmonia-en": + return AURA2HARMONIA_EN; + case "aura-2-selena-es": + return AURA2SELENA_ES; + case "aura-2-aurora-en": + return AURA2AURORA_EN; + case "aura-zeus-en": + return AURA_ZEUS_EN; + case "aura-2-ophelia-en": + return AURA2OPHELIA_EN; + case "aura-2-amalthea-en": + return AURA2AMALTHEA_EN; + case "aura-orpheus-en": + return AURA_ORPHEUS_EN; + case "aura-2-delia-en": + return AURA2DELIA_EN; + case "aura-luna-en": + return AURA_LUNA_EN; + case "aura-2-apollo-en": + return AURA2APOLLO_EN; + case "aura-2-selene-en": + return AURA2SELENE_EN; + case "aura-2-theia-en": + return AURA2THEIA_EN; + case "aura-hera-en": + return AURA_HERA_EN; + case "aura-2-cordelia-en": + return AURA2CORDELIA_EN; + case "aura-2-andromeda-en": + return AURA2ANDROMEDA_EN; + case "aura-2-aries-en": + return AURA2ARIES_EN; + case "aura-2-juno-en": + return AURA2JUNO_EN; + case "aura-2-luna-en": + return AURA2LUNA_EN; + case "aura-2-diana-es": + return AURA2DIANA_ES; + case "aura-2-javier-es": + return AURA2JAVIER_ES; + case "aura-orion-en": + return AURA_ORION_EN; + case "aura-arcas-en": + return AURA_ARCAS_EN; + case "aura-2-iris-en": + return AURA2IRIS_EN; + case "aura-2-athena-en": + return AURA2ATHENA_EN; + case "aura-2-saturn-en": + return AURA2SATURN_EN; + case "aura-2-phoebe-en": + return AURA2PHOEBE_EN; + default: + return new AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel(Value.UNKNOWN, value); + } + } + + public enum Value { + AURA_ASTERIA_EN, + + AURA_LUNA_EN, + + AURA_STELLA_EN, + + AURA_ATHENA_EN, + + AURA_HERA_EN, + + AURA_ORION_EN, + + AURA_ARCAS_EN, + + AURA_PERSEUS_EN, + + AURA_ANGUS_EN, + + AURA_ORPHEUS_EN, + + AURA_HELIOS_EN, + + AURA_ZEUS_EN, + + AURA2AMALTHEA_EN, + + AURA2ANDROMEDA_EN, + + AURA2APOLLO_EN, + + AURA2ARCAS_EN, + + AURA2ARIES_EN, + + AURA2ASTERIA_EN, + + AURA2ATHENA_EN, + + AURA2ATLAS_EN, + + AURA2AURORA_EN, + + AURA2CALLISTA_EN, + + AURA2CORA_EN, + + AURA2CORDELIA_EN, + + AURA2DELIA_EN, + + AURA2DRACO_EN, + + AURA2ELECTRA_EN, + + AURA2HARMONIA_EN, + + AURA2HELENA_EN, + + AURA2HERA_EN, + + AURA2HERMES_EN, + + AURA2HYPERION_EN, + + AURA2IRIS_EN, + + AURA2JANUS_EN, + + AURA2JUNO_EN, + + AURA2JUPITER_EN, + + AURA2LUNA_EN, + + AURA2MARS_EN, + + AURA2MINERVA_EN, + + AURA2NEPTUNE_EN, + + AURA2ODYSSEUS_EN, + + AURA2OPHELIA_EN, + + AURA2ORION_EN, + + AURA2ORPHEUS_EN, + + AURA2PANDORA_EN, + + AURA2PHOEBE_EN, + + AURA2PLUTO_EN, + + AURA2SATURN_EN, + + AURA2SELENE_EN, + + AURA2THALIA_EN, + + AURA2THEIA_EN, + + AURA2VESTA_EN, + + AURA2ZEUS_EN, + + AURA2SIRIO_ES, + + AURA2NESTOR_ES, + + AURA2CARINA_ES, + + AURA2CELESTE_ES, + + AURA2ALVARO_ES, + + AURA2DIANA_ES, + + AURA2AQUILA_ES, + + AURA2SELENA_ES, + + AURA2ESTRELLA_ES, + + AURA2JAVIER_ES, + + UNKNOWN + } + + public interface Visitor { + T visitAuraAsteriaEn(); + + T visitAuraLunaEn(); + + T visitAuraStellaEn(); + + T visitAuraAthenaEn(); + + T visitAuraHeraEn(); + + T visitAuraOrionEn(); + + T visitAuraArcasEn(); + + T visitAuraPerseusEn(); + + T visitAuraAngusEn(); + + T visitAuraOrpheusEn(); + + T visitAuraHeliosEn(); + + T visitAuraZeusEn(); + + T visitAura2AmaltheaEn(); + + T visitAura2AndromedaEn(); + + T visitAura2ApolloEn(); + + T visitAura2ArcasEn(); + + T visitAura2AriesEn(); + + T visitAura2AsteriaEn(); + + T visitAura2AthenaEn(); + + T visitAura2AtlasEn(); + + T visitAura2AuroraEn(); + + T visitAura2CallistaEn(); + + T visitAura2CoraEn(); + + T visitAura2CordeliaEn(); + + T visitAura2DeliaEn(); + + T visitAura2DracoEn(); + + T visitAura2ElectraEn(); + + T visitAura2HarmoniaEn(); + + T visitAura2HelenaEn(); + + T visitAura2HeraEn(); + + T visitAura2HermesEn(); + + T visitAura2HyperionEn(); + + T visitAura2IrisEn(); + + T visitAura2JanusEn(); + + T visitAura2JunoEn(); + + T visitAura2JupiterEn(); + + T visitAura2LunaEn(); + + T visitAura2MarsEn(); + + T visitAura2MinervaEn(); + + T visitAura2NeptuneEn(); + + T visitAura2OdysseusEn(); + + T visitAura2OpheliaEn(); + + T visitAura2OrionEn(); + + T visitAura2OrpheusEn(); + + T visitAura2PandoraEn(); + + T visitAura2PhoebeEn(); + + T visitAura2PlutoEn(); + + T visitAura2SaturnEn(); + + T visitAura2SeleneEn(); + + T visitAura2ThaliaEn(); + + T visitAura2TheiaEn(); + + T visitAura2VestaEn(); + + T visitAura2ZeusEn(); + + T visitAura2SirioEs(); + + T visitAura2NestorEs(); + + T visitAura2CarinaEs(); + + T visitAura2CelesteEs(); + + T visitAura2AlvaroEs(); + + T visitAura2DianaEs(); + + T visitAura2AquilaEs(); + + T visitAura2SelenaEs(); + + T visitAura2EstrellaEs(); + + T visitAura2JavierEs(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakOneItemProviderElevenLabsModelId.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakOneItemProviderElevenLabsModelId.java new file mode 100644 index 0000000..2eba0e3 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakOneItemProviderElevenLabsModelId.java @@ -0,0 +1,100 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AgentV1SettingsAgentSpeakOneItemProviderElevenLabsModelId { + public static final AgentV1SettingsAgentSpeakOneItemProviderElevenLabsModelId ELEVEN_TURBO_V25 = + new AgentV1SettingsAgentSpeakOneItemProviderElevenLabsModelId(Value.ELEVEN_TURBO_V25, "eleven_turbo_v2_5"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderElevenLabsModelId ELEVEN_MONOLINGUAL_V1 = + new AgentV1SettingsAgentSpeakOneItemProviderElevenLabsModelId( + Value.ELEVEN_MONOLINGUAL_V1, "eleven_monolingual_v1"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderElevenLabsModelId ELEVEN_MULTILINGUAL_V2 = + new AgentV1SettingsAgentSpeakOneItemProviderElevenLabsModelId( + Value.ELEVEN_MULTILINGUAL_V2, "eleven_multilingual_v2"); + + private final Value value; + + private final String string; + + AgentV1SettingsAgentSpeakOneItemProviderElevenLabsModelId(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AgentV1SettingsAgentSpeakOneItemProviderElevenLabsModelId + && this.string.equals( + ((AgentV1SettingsAgentSpeakOneItemProviderElevenLabsModelId) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ELEVEN_TURBO_V25: + return visitor.visitElevenTurboV25(); + case ELEVEN_MONOLINGUAL_V1: + return visitor.visitElevenMonolingualV1(); + case ELEVEN_MULTILINGUAL_V2: + return visitor.visitElevenMultilingualV2(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AgentV1SettingsAgentSpeakOneItemProviderElevenLabsModelId valueOf(String value) { + switch (value) { + case "eleven_turbo_v2_5": + return ELEVEN_TURBO_V25; + case "eleven_monolingual_v1": + return ELEVEN_MONOLINGUAL_V1; + case "eleven_multilingual_v2": + return ELEVEN_MULTILINGUAL_V2; + default: + return new AgentV1SettingsAgentSpeakOneItemProviderElevenLabsModelId(Value.UNKNOWN, value); + } + } + + public enum Value { + ELEVEN_TURBO_V25, + + ELEVEN_MONOLINGUAL_V1, + + ELEVEN_MULTILINGUAL_V2, + + UNKNOWN + } + + public interface Visitor { + T visitElevenTurboV25(); + + T visitElevenMonolingualV1(); + + T visitElevenMultilingualV2(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakOneItemProviderOpenAi.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakOneItemProviderOpenAi.java new file mode 100644 index 0000000..64893ff --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakOneItemProviderOpenAi.java @@ -0,0 +1,210 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = AgentV1SettingsAgentSpeakOneItemProviderOpenAi.Builder.class) +public final class AgentV1SettingsAgentSpeakOneItemProviderOpenAi { + private final Optional version; + + private final AgentV1SettingsAgentSpeakOneItemProviderOpenAiModel model; + + private final AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice voice; + + private final Map additionalProperties; + + private AgentV1SettingsAgentSpeakOneItemProviderOpenAi( + Optional version, + AgentV1SettingsAgentSpeakOneItemProviderOpenAiModel model, + AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice voice, + Map additionalProperties) { + this.version = version; + this.model = model; + this.voice = voice; + this.additionalProperties = additionalProperties; + } + + /** + * @return The REST API version for the OpenAI text-to-speech API + */ + @JsonProperty("version") + public Optional getVersion() { + return version; + } + + /** + * @return OpenAI TTS model + */ + @JsonProperty("model") + public AgentV1SettingsAgentSpeakOneItemProviderOpenAiModel getModel() { + return model; + } + + /** + * @return OpenAI voice + */ + @JsonProperty("voice") + public AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice getVoice() { + return voice; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1SettingsAgentSpeakOneItemProviderOpenAi + && equalTo((AgentV1SettingsAgentSpeakOneItemProviderOpenAi) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1SettingsAgentSpeakOneItemProviderOpenAi other) { + return version.equals(other.version) && model.equals(other.model) && voice.equals(other.voice); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.version, this.model, this.voice); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ModelStage builder() { + return new Builder(); + } + + public interface ModelStage { + /** + *

OpenAI TTS model

+ */ + VoiceStage model(@NotNull AgentV1SettingsAgentSpeakOneItemProviderOpenAiModel model); + + Builder from(AgentV1SettingsAgentSpeakOneItemProviderOpenAi other); + } + + public interface VoiceStage { + /** + *

OpenAI voice

+ */ + _FinalStage voice(@NotNull AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice voice); + } + + public interface _FinalStage { + AgentV1SettingsAgentSpeakOneItemProviderOpenAi build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The REST API version for the OpenAI text-to-speech API

+ */ + _FinalStage version(Optional version); + + _FinalStage version(String version); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ModelStage, VoiceStage, _FinalStage { + private AgentV1SettingsAgentSpeakOneItemProviderOpenAiModel model; + + private AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice voice; + + private Optional version = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentV1SettingsAgentSpeakOneItemProviderOpenAi other) { + version(other.getVersion()); + model(other.getModel()); + voice(other.getVoice()); + return this; + } + + /** + *

OpenAI TTS model

+ *

OpenAI TTS model

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

OpenAI voice

+ *

OpenAI voice

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

The REST API version for the OpenAI text-to-speech API

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage version(String version) { + this.version = Optional.ofNullable(version); + return this; + } + + /** + *

The REST API version for the OpenAI text-to-speech API

+ */ + @java.lang.Override + @JsonSetter(value = "version", nulls = Nulls.SKIP) + public _FinalStage version(Optional version) { + this.version = version; + return this; + } + + @java.lang.Override + public AgentV1SettingsAgentSpeakOneItemProviderOpenAi build() { + return new AgentV1SettingsAgentSpeakOneItemProviderOpenAi(version, model, voice, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakOneItemProviderOpenAiModel.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakOneItemProviderOpenAiModel.java new file mode 100644 index 0000000..29cf255 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakOneItemProviderOpenAiModel.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AgentV1SettingsAgentSpeakOneItemProviderOpenAiModel { + public static final AgentV1SettingsAgentSpeakOneItemProviderOpenAiModel TTS1HD = + new AgentV1SettingsAgentSpeakOneItemProviderOpenAiModel(Value.TTS1HD, "tts-1-hd"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderOpenAiModel TTS1 = + new AgentV1SettingsAgentSpeakOneItemProviderOpenAiModel(Value.TTS1, "tts-1"); + + private final Value value; + + private final String string; + + AgentV1SettingsAgentSpeakOneItemProviderOpenAiModel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AgentV1SettingsAgentSpeakOneItemProviderOpenAiModel + && this.string.equals(((AgentV1SettingsAgentSpeakOneItemProviderOpenAiModel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case TTS1HD: + return visitor.visitTts1Hd(); + case TTS1: + return visitor.visitTts1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AgentV1SettingsAgentSpeakOneItemProviderOpenAiModel valueOf(String value) { + switch (value) { + case "tts-1-hd": + return TTS1HD; + case "tts-1": + return TTS1; + default: + return new AgentV1SettingsAgentSpeakOneItemProviderOpenAiModel(Value.UNKNOWN, value); + } + } + + public enum Value { + TTS1, + + TTS1HD, + + UNKNOWN + } + + public interface Visitor { + T visitTts1(); + + T visitTts1Hd(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice.java new file mode 100644 index 0000000..dbd6f7e --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice { + public static final AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice SHIMMER = + new AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice(Value.SHIMMER, "shimmer"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice FABLE = + new AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice(Value.FABLE, "fable"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice ALLOY = + new AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice(Value.ALLOY, "alloy"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice ONYX = + new AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice(Value.ONYX, "onyx"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice NOVA = + new AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice(Value.NOVA, "nova"); + + public static final AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice ECHO = + new AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice(Value.ECHO, "echo"); + + private final Value value; + + private final String string; + + AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice + && this.string.equals(((AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SHIMMER: + return visitor.visitShimmer(); + case FABLE: + return visitor.visitFable(); + case ALLOY: + return visitor.visitAlloy(); + case ONYX: + return visitor.visitOnyx(); + case NOVA: + return visitor.visitNova(); + case ECHO: + return visitor.visitEcho(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice valueOf(String value) { + switch (value) { + case "shimmer": + return SHIMMER; + case "fable": + return FABLE; + case "alloy": + return ALLOY; + case "onyx": + return ONYX; + case "nova": + return NOVA; + case "echo": + return ECHO; + default: + return new AgentV1SettingsAgentSpeakOneItemProviderOpenAiVoice(Value.UNKNOWN, value); + } + } + + public enum Value { + ALLOY, + + ECHO, + + FABLE, + + ONYX, + + NOVA, + + SHIMMER, + + UNKNOWN + } + + public interface Visitor { + T visitAlloy(); + + T visitEcho(); + + T visitFable(); + + T visitOnyx(); + + T visitNova(); + + T visitShimmer(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentThink.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentThink.java new file mode 100644 index 0000000..4e53619 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentThink.java @@ -0,0 +1,99 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.deepgram.types.ThinkSettingsV1; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import java.io.IOException; +import java.util.List; +import java.util.Objects; + +@JsonDeserialize(using = AgentV1SettingsAgentThink.Deserializer.class) +public final class AgentV1SettingsAgentThink { + private final Object value; + + private final int type; + + private AgentV1SettingsAgentThink(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + @SuppressWarnings("unchecked") + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((ThinkSettingsV1) this.value); + } else if (this.type == 1) { + return visitor.visit((List) 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 AgentV1SettingsAgentThink && equalTo((AgentV1SettingsAgentThink) other); + } + + private boolean equalTo(AgentV1SettingsAgentThink 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 AgentV1SettingsAgentThink of(ThinkSettingsV1 value) { + return new AgentV1SettingsAgentThink(value, 0); + } + + public static AgentV1SettingsAgentThink of(List value) { + return new AgentV1SettingsAgentThink(value, 1); + } + + public interface Visitor { + T visit(ThinkSettingsV1 value); + + T visit(List value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(AgentV1SettingsAgentThink.class); + } + + @java.lang.Override + public AgentV1SettingsAgentThink deserialize(JsonParser p, DeserializationContext context) throws IOException { + Object value = p.readValueAs(Object.class); + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, ThinkSettingsV1.class)); + } catch (RuntimeException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue( + value, new TypeReference>() {})); + } catch (RuntimeException e) { + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentThinkOneItem.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentThinkOneItem.java new file mode 100644 index 0000000..f14c149 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentThinkOneItem.java @@ -0,0 +1,270 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = AgentV1SettingsAgentThinkOneItem.Builder.class) +public final class AgentV1SettingsAgentThinkOneItem { + private final AgentV1SettingsAgentThinkOneItemProvider provider; + + private final Optional endpoint; + + private final Optional> functions; + + private final Optional prompt; + + private final Optional contextLength; + + private final Map additionalProperties; + + private AgentV1SettingsAgentThinkOneItem( + AgentV1SettingsAgentThinkOneItemProvider provider, + Optional endpoint, + Optional> functions, + Optional prompt, + Optional contextLength, + Map additionalProperties) { + this.provider = provider; + this.endpoint = endpoint; + this.functions = functions; + this.prompt = prompt; + this.contextLength = contextLength; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public AgentV1SettingsAgentThinkOneItemProvider getProvider() { + return provider; + } + + /** + * @return Optional for non-Deepgram LLM providers. When present, must include url field and headers object + */ + @JsonProperty("endpoint") + public Optional getEndpoint() { + return endpoint; + } + + @JsonProperty("functions") + public Optional> getFunctions() { + return functions; + } + + @JsonProperty("prompt") + public Optional getPrompt() { + return prompt; + } + + /** + * @return Specifies the number of characters retained in context between user messages, agent responses, and function calls. This setting is only configurable when a custom think endpoint is used + */ + @JsonProperty("context_length") + public Optional getContextLength() { + return contextLength; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1SettingsAgentThinkOneItem && equalTo((AgentV1SettingsAgentThinkOneItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1SettingsAgentThinkOneItem other) { + return provider.equals(other.provider) + && endpoint.equals(other.endpoint) + && functions.equals(other.functions) + && prompt.equals(other.prompt) + && contextLength.equals(other.contextLength); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.provider, this.endpoint, this.functions, this.prompt, this.contextLength); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ProviderStage builder() { + return new Builder(); + } + + public interface ProviderStage { + _FinalStage provider(@NotNull AgentV1SettingsAgentThinkOneItemProvider provider); + + Builder from(AgentV1SettingsAgentThinkOneItem other); + } + + public interface _FinalStage { + AgentV1SettingsAgentThinkOneItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Optional for non-Deepgram LLM providers. When present, must include url field and headers object

+ */ + _FinalStage endpoint(Optional endpoint); + + _FinalStage endpoint(AgentV1SettingsAgentThinkOneItemEndpoint endpoint); + + _FinalStage functions(Optional> functions); + + _FinalStage functions(List functions); + + _FinalStage prompt(Optional prompt); + + _FinalStage prompt(String prompt); + + /** + *

Specifies the number of characters retained in context between user messages, agent responses, and function calls. This setting is only configurable when a custom think endpoint is used

+ */ + _FinalStage contextLength(Optional contextLength); + + _FinalStage contextLength(AgentV1SettingsAgentThinkOneItemContextLength contextLength); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ProviderStage, _FinalStage { + private AgentV1SettingsAgentThinkOneItemProvider provider; + + private Optional contextLength = Optional.empty(); + + private Optional prompt = Optional.empty(); + + private Optional> functions = Optional.empty(); + + private Optional endpoint = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentV1SettingsAgentThinkOneItem other) { + provider(other.getProvider()); + endpoint(other.getEndpoint()); + functions(other.getFunctions()); + prompt(other.getPrompt()); + contextLength(other.getContextLength()); + return this; + } + + @java.lang.Override + @JsonSetter("provider") + public _FinalStage provider(@NotNull AgentV1SettingsAgentThinkOneItemProvider provider) { + this.provider = Objects.requireNonNull(provider, "provider must not be null"); + return this; + } + + /** + *

Specifies the number of characters retained in context between user messages, agent responses, and function calls. This setting is only configurable when a custom think endpoint is used

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage contextLength(AgentV1SettingsAgentThinkOneItemContextLength contextLength) { + this.contextLength = Optional.ofNullable(contextLength); + return this; + } + + /** + *

Specifies the number of characters retained in context between user messages, agent responses, and function calls. This setting is only configurable when a custom think endpoint is used

+ */ + @java.lang.Override + @JsonSetter(value = "context_length", nulls = Nulls.SKIP) + public _FinalStage contextLength(Optional contextLength) { + this.contextLength = contextLength; + return this; + } + + @java.lang.Override + public _FinalStage prompt(String prompt) { + this.prompt = Optional.ofNullable(prompt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "prompt", nulls = Nulls.SKIP) + public _FinalStage prompt(Optional prompt) { + this.prompt = prompt; + return this; + } + + @java.lang.Override + public _FinalStage functions(List functions) { + this.functions = Optional.ofNullable(functions); + return this; + } + + @java.lang.Override + @JsonSetter(value = "functions", nulls = Nulls.SKIP) + public _FinalStage functions(Optional> functions) { + this.functions = functions; + return this; + } + + /** + *

Optional for non-Deepgram LLM providers. When present, must include url field and headers object

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage endpoint(AgentV1SettingsAgentThinkOneItemEndpoint endpoint) { + this.endpoint = Optional.ofNullable(endpoint); + return this; + } + + /** + *

Optional for non-Deepgram LLM providers. When present, must include url field and headers object

+ */ + @java.lang.Override + @JsonSetter(value = "endpoint", nulls = Nulls.SKIP) + public _FinalStage endpoint(Optional endpoint) { + this.endpoint = endpoint; + return this; + } + + @java.lang.Override + public AgentV1SettingsAgentThinkOneItem build() { + return new AgentV1SettingsAgentThinkOneItem( + provider, endpoint, functions, prompt, contextLength, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentThinkOneItemContextLength.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentThinkOneItemContextLength.java new file mode 100644 index 0000000..fc34f58 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentThinkOneItemContextLength.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +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 java.io.IOException; +import java.util.Objects; + +@JsonDeserialize(using = AgentV1SettingsAgentThinkOneItemContextLength.Deserializer.class) +public final class AgentV1SettingsAgentThinkOneItemContextLength { + private final Object value; + + private final int type; + + private AgentV1SettingsAgentThinkOneItemContextLength(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + @SuppressWarnings("unchecked") + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((String) this.value); + } else if (this.type == 1) { + return visitor.visit((double) 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 AgentV1SettingsAgentThinkOneItemContextLength + && equalTo((AgentV1SettingsAgentThinkOneItemContextLength) other); + } + + private boolean equalTo(AgentV1SettingsAgentThinkOneItemContextLength 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(); + } + + /** + * @param value must be one of the following: + *
    + *
  • "max"
  • + *
+ */ + public static AgentV1SettingsAgentThinkOneItemContextLength of(String value) { + return new AgentV1SettingsAgentThinkOneItemContextLength(value, 0); + } + + public static AgentV1SettingsAgentThinkOneItemContextLength of(double value) { + return new AgentV1SettingsAgentThinkOneItemContextLength(value, 1); + } + + public interface Visitor { + /** + * @param value must be one of the following: + *
    + *
  • "max"
  • + *
+ */ + T visit(String value); + + T visit(double value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(AgentV1SettingsAgentThinkOneItemContextLength.class); + } + + @java.lang.Override + public AgentV1SettingsAgentThinkOneItemContextLength deserialize(JsonParser p, DeserializationContext context) + throws IOException { + Object value = p.readValueAs(Object.class); + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, String.class)); + } catch (RuntimeException e) { + } + if (value instanceof Double) { + return of((Double) value); + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentThinkOneItemEndpoint.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentThinkOneItemEndpoint.java new file mode 100644 index 0000000..fcc2e7c --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentThinkOneItemEndpoint.java @@ -0,0 +1,141 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AgentV1SettingsAgentThinkOneItemEndpoint.Builder.class) +public final class AgentV1SettingsAgentThinkOneItemEndpoint { + private final Optional url; + + private final Optional> headers; + + private final Map additionalProperties; + + private AgentV1SettingsAgentThinkOneItemEndpoint( + Optional url, Optional> headers, Map additionalProperties) { + this.url = url; + this.headers = headers; + this.additionalProperties = additionalProperties; + } + + /** + * @return Custom LLM endpoint URL + */ + @JsonProperty("url") + public Optional getUrl() { + return url; + } + + /** + * @return Custom headers for the endpoint + */ + @JsonProperty("headers") + public Optional> getHeaders() { + return headers; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1SettingsAgentThinkOneItemEndpoint + && equalTo((AgentV1SettingsAgentThinkOneItemEndpoint) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1SettingsAgentThinkOneItemEndpoint other) { + return url.equals(other.url) && headers.equals(other.headers); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.url, this.headers); + } + + @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 url = Optional.empty(); + + private Optional> headers = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AgentV1SettingsAgentThinkOneItemEndpoint other) { + url(other.getUrl()); + headers(other.getHeaders()); + return this; + } + + /** + *

Custom LLM endpoint URL

+ */ + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public Builder url(Optional url) { + this.url = url; + return this; + } + + public Builder url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + /** + *

Custom headers for the endpoint

+ */ + @JsonSetter(value = "headers", nulls = Nulls.SKIP) + public Builder headers(Optional> headers) { + this.headers = headers; + return this; + } + + public Builder headers(Map headers) { + this.headers = Optional.ofNullable(headers); + return this; + } + + public AgentV1SettingsAgentThinkOneItemEndpoint build() { + return new AgentV1SettingsAgentThinkOneItemEndpoint(url, headers, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentThinkOneItemFunctionsItem.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentThinkOneItemFunctionsItem.java new file mode 100644 index 0000000..a6393b5 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentThinkOneItemFunctionsItem.java @@ -0,0 +1,205 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AgentV1SettingsAgentThinkOneItemFunctionsItem.Builder.class) +public final class AgentV1SettingsAgentThinkOneItemFunctionsItem { + private final Optional name; + + private final Optional description; + + private final Optional> parameters; + + private final Optional endpoint; + + private final Map additionalProperties; + + private AgentV1SettingsAgentThinkOneItemFunctionsItem( + Optional name, + Optional description, + Optional> parameters, + Optional endpoint, + Map additionalProperties) { + this.name = name; + this.description = description; + this.parameters = parameters; + this.endpoint = endpoint; + this.additionalProperties = additionalProperties; + } + + /** + * @return Function name + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return Function description + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return Function parameters + */ + @JsonProperty("parameters") + public Optional> getParameters() { + return parameters; + } + + /** + * @return The Function endpoint to call. if not passed, function is called client-side + */ + @JsonProperty("endpoint") + public Optional getEndpoint() { + return endpoint; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1SettingsAgentThinkOneItemFunctionsItem + && equalTo((AgentV1SettingsAgentThinkOneItemFunctionsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1SettingsAgentThinkOneItemFunctionsItem other) { + return name.equals(other.name) + && description.equals(other.description) + && parameters.equals(other.parameters) + && endpoint.equals(other.endpoint); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.name, this.description, this.parameters, this.endpoint); + } + + @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 description = Optional.empty(); + + private Optional> parameters = Optional.empty(); + + private Optional endpoint = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AgentV1SettingsAgentThinkOneItemFunctionsItem other) { + name(other.getName()); + description(other.getDescription()); + parameters(other.getParameters()); + endpoint(other.getEndpoint()); + return this; + } + + /** + *

Function name

+ */ + @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; + } + + /** + *

Function description

+ */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

Function parameters

+ */ + @JsonSetter(value = "parameters", nulls = Nulls.SKIP) + public Builder parameters(Optional> parameters) { + this.parameters = parameters; + return this; + } + + public Builder parameters(Map parameters) { + this.parameters = Optional.ofNullable(parameters); + return this; + } + + /** + *

The Function endpoint to call. if not passed, function is called client-side

+ */ + @JsonSetter(value = "endpoint", nulls = Nulls.SKIP) + public Builder endpoint(Optional endpoint) { + this.endpoint = endpoint; + return this; + } + + public Builder endpoint(AgentV1SettingsAgentThinkOneItemFunctionsItemEndpoint endpoint) { + this.endpoint = Optional.ofNullable(endpoint); + return this; + } + + public AgentV1SettingsAgentThinkOneItemFunctionsItem build() { + return new AgentV1SettingsAgentThinkOneItemFunctionsItem( + name, description, parameters, endpoint, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentThinkOneItemFunctionsItemEndpoint.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentThinkOneItemFunctionsItemEndpoint.java new file mode 100644 index 0000000..389da57 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentThinkOneItemFunctionsItemEndpoint.java @@ -0,0 +1,167 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AgentV1SettingsAgentThinkOneItemFunctionsItemEndpoint.Builder.class) +public final class AgentV1SettingsAgentThinkOneItemFunctionsItemEndpoint { + private final Optional url; + + private final Optional method; + + private final Optional> headers; + + private final Map additionalProperties; + + private AgentV1SettingsAgentThinkOneItemFunctionsItemEndpoint( + Optional url, + Optional method, + Optional> headers, + Map additionalProperties) { + this.url = url; + this.method = method; + this.headers = headers; + this.additionalProperties = additionalProperties; + } + + /** + * @return Endpoint URL + */ + @JsonProperty("url") + public Optional getUrl() { + return url; + } + + /** + * @return HTTP method + */ + @JsonProperty("method") + public Optional getMethod() { + return method; + } + + @JsonProperty("headers") + public Optional> getHeaders() { + return headers; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1SettingsAgentThinkOneItemFunctionsItemEndpoint + && equalTo((AgentV1SettingsAgentThinkOneItemFunctionsItemEndpoint) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1SettingsAgentThinkOneItemFunctionsItemEndpoint other) { + return url.equals(other.url) && method.equals(other.method) && headers.equals(other.headers); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.url, this.method, this.headers); + } + + @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 url = Optional.empty(); + + private Optional method = Optional.empty(); + + private Optional> headers = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AgentV1SettingsAgentThinkOneItemFunctionsItemEndpoint other) { + url(other.getUrl()); + method(other.getMethod()); + headers(other.getHeaders()); + return this; + } + + /** + *

Endpoint URL

+ */ + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public Builder url(Optional url) { + this.url = url; + return this; + } + + public Builder url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + /** + *

HTTP method

+ */ + @JsonSetter(value = "method", nulls = Nulls.SKIP) + public Builder method(Optional method) { + this.method = method; + return this; + } + + public Builder method(String method) { + this.method = Optional.ofNullable(method); + return this; + } + + @JsonSetter(value = "headers", nulls = Nulls.SKIP) + public Builder headers(Optional> headers) { + this.headers = headers; + return this; + } + + public Builder headers(Map headers) { + this.headers = Optional.ofNullable(headers); + return this; + } + + public AgentV1SettingsAgentThinkOneItemFunctionsItemEndpoint build() { + return new AgentV1SettingsAgentThinkOneItemFunctionsItemEndpoint( + url, method, headers, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentThinkOneItemProvider.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentThinkOneItemProvider.java new file mode 100644 index 0000000..2747dff --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAgentThinkOneItemProvider.java @@ -0,0 +1,138 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.deepgram.types.Anthropic; +import com.deepgram.types.AwsBedrockThinkProvider; +import com.deepgram.types.Google; +import com.deepgram.types.Groq; +import com.deepgram.types.OpenAiThinkProvider; +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 java.io.IOException; +import java.util.Objects; + +@JsonDeserialize(using = AgentV1SettingsAgentThinkOneItemProvider.Deserializer.class) +public final class AgentV1SettingsAgentThinkOneItemProvider { + private final Object value; + + private final int type; + + private AgentV1SettingsAgentThinkOneItemProvider(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + @SuppressWarnings("unchecked") + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((OpenAiThinkProvider) this.value); + } else if (this.type == 1) { + return visitor.visit((AwsBedrockThinkProvider) this.value); + } else if (this.type == 2) { + return visitor.visit((Anthropic) this.value); + } else if (this.type == 3) { + return visitor.visit((Google) this.value); + } else if (this.type == 4) { + return visitor.visit((Groq) 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 AgentV1SettingsAgentThinkOneItemProvider + && equalTo((AgentV1SettingsAgentThinkOneItemProvider) other); + } + + private boolean equalTo(AgentV1SettingsAgentThinkOneItemProvider 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 AgentV1SettingsAgentThinkOneItemProvider of(OpenAiThinkProvider value) { + return new AgentV1SettingsAgentThinkOneItemProvider(value, 0); + } + + public static AgentV1SettingsAgentThinkOneItemProvider of(AwsBedrockThinkProvider value) { + return new AgentV1SettingsAgentThinkOneItemProvider(value, 1); + } + + public static AgentV1SettingsAgentThinkOneItemProvider of(Anthropic value) { + return new AgentV1SettingsAgentThinkOneItemProvider(value, 2); + } + + public static AgentV1SettingsAgentThinkOneItemProvider of(Google value) { + return new AgentV1SettingsAgentThinkOneItemProvider(value, 3); + } + + public static AgentV1SettingsAgentThinkOneItemProvider of(Groq value) { + return new AgentV1SettingsAgentThinkOneItemProvider(value, 4); + } + + public interface Visitor { + T visit(OpenAiThinkProvider value); + + T visit(AwsBedrockThinkProvider value); + + T visit(Anthropic value); + + T visit(Google value); + + T visit(Groq value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(AgentV1SettingsAgentThinkOneItemProvider.class); + } + + @java.lang.Override + public AgentV1SettingsAgentThinkOneItemProvider deserialize(JsonParser p, DeserializationContext context) + throws IOException { + Object value = p.readValueAs(Object.class); + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, OpenAiThinkProvider.class)); + } catch (RuntimeException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, AwsBedrockThinkProvider.class)); + } catch (RuntimeException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, Anthropic.class)); + } catch (RuntimeException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, Google.class)); + } catch (RuntimeException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, Groq.class)); + } catch (RuntimeException e) { + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsApplied.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsApplied.java new file mode 100644 index 0000000..0d60b72 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsApplied.java @@ -0,0 +1,78 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AgentV1SettingsApplied.Builder.class) +public final class AgentV1SettingsApplied { + private final Map additionalProperties; + + private AgentV1SettingsApplied(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + /** + * @return Message type identifier for settings applied confirmation + */ + @JsonProperty("type") + public String getType() { + return "SettingsApplied"; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1SettingsApplied; + } + + @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(AgentV1SettingsApplied other) { + return this; + } + + public AgentV1SettingsApplied build() { + return new AgentV1SettingsApplied(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAudio.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAudio.java new file mode 100644 index 0000000..eeb690c --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAudio.java @@ -0,0 +1,142 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AgentV1SettingsAudio.Builder.class) +public final class AgentV1SettingsAudio { + private final Optional input; + + private final Optional output; + + private final Map additionalProperties; + + private AgentV1SettingsAudio( + Optional input, + Optional output, + Map additionalProperties) { + this.input = input; + this.output = output; + this.additionalProperties = additionalProperties; + } + + /** + * @return Audio input configuration settings. If omitted, defaults to encoding=linear16 and sample_rate=24000. Higher sample rates like 44100 Hz provide better audio quality. + */ + @JsonProperty("input") + public Optional getInput() { + return input; + } + + /** + * @return Audio output configuration settings + */ + @JsonProperty("output") + public Optional getOutput() { + return output; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1SettingsAudio && equalTo((AgentV1SettingsAudio) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1SettingsAudio other) { + return input.equals(other.input) && output.equals(other.output); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.input, 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 input = Optional.empty(); + + private Optional output = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AgentV1SettingsAudio other) { + input(other.getInput()); + output(other.getOutput()); + return this; + } + + /** + *

Audio input configuration settings. If omitted, defaults to encoding=linear16 and sample_rate=24000. Higher sample rates like 44100 Hz provide better audio quality.

+ */ + @JsonSetter(value = "input", nulls = Nulls.SKIP) + public Builder input(Optional input) { + this.input = input; + return this; + } + + public Builder input(AgentV1SettingsAudioInput input) { + this.input = Optional.ofNullable(input); + return this; + } + + /** + *

Audio output configuration settings

+ */ + @JsonSetter(value = "output", nulls = Nulls.SKIP) + public Builder output(Optional output) { + this.output = output; + return this; + } + + public Builder output(AgentV1SettingsAudioOutput output) { + this.output = Optional.ofNullable(output); + return this; + } + + public AgentV1SettingsAudio build() { + return new AgentV1SettingsAudio(input, output, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAudioInput.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAudioInput.java new file mode 100644 index 0000000..65d7ae3 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAudioInput.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AgentV1SettingsAudioInput.Builder.class) +public final class AgentV1SettingsAudioInput { + private final AgentV1SettingsAudioInputEncoding encoding; + + private final double sampleRate; + + private final Map additionalProperties; + + private AgentV1SettingsAudioInput( + AgentV1SettingsAudioInputEncoding encoding, double sampleRate, Map additionalProperties) { + this.encoding = encoding; + this.sampleRate = sampleRate; + this.additionalProperties = additionalProperties; + } + + /** + * @return Audio encoding format + */ + @JsonProperty("encoding") + public AgentV1SettingsAudioInputEncoding getEncoding() { + return encoding; + } + + /** + * @return Sample rate in Hz. Common values are 16000, 24000, 44100, 48000 + */ + @JsonProperty("sample_rate") + public double getSampleRate() { + return sampleRate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1SettingsAudioInput && equalTo((AgentV1SettingsAudioInput) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1SettingsAudioInput other) { + return encoding.equals(other.encoding) && sampleRate == other.sampleRate; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.encoding, this.sampleRate); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static EncodingStage builder() { + return new Builder(); + } + + public interface EncodingStage { + /** + *

Audio encoding format

+ */ + SampleRateStage encoding(@NotNull AgentV1SettingsAudioInputEncoding encoding); + + Builder from(AgentV1SettingsAudioInput other); + } + + public interface SampleRateStage { + /** + *

Sample rate in Hz. Common values are 16000, 24000, 44100, 48000

+ */ + _FinalStage sampleRate(double sampleRate); + } + + public interface _FinalStage { + AgentV1SettingsAudioInput build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements EncodingStage, SampleRateStage, _FinalStage { + private AgentV1SettingsAudioInputEncoding encoding; + + private double sampleRate; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentV1SettingsAudioInput other) { + encoding(other.getEncoding()); + sampleRate(other.getSampleRate()); + return this; + } + + /** + *

Audio encoding format

+ *

Audio encoding format

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

Sample rate in Hz. Common values are 16000, 24000, 44100, 48000

+ *

Sample rate in Hz. Common values are 16000, 24000, 44100, 48000

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("sample_rate") + public _FinalStage sampleRate(double sampleRate) { + this.sampleRate = sampleRate; + return this; + } + + @java.lang.Override + public AgentV1SettingsAudioInput build() { + return new AgentV1SettingsAudioInput(encoding, sampleRate, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAudioInputEncoding.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAudioInputEncoding.java new file mode 100644 index 0000000..a80a2b3 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAudioInputEncoding.java @@ -0,0 +1,185 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AgentV1SettingsAudioInputEncoding { + public static final AgentV1SettingsAudioInputEncoding MULAW = + new AgentV1SettingsAudioInputEncoding(Value.MULAW, "mulaw"); + + public static final AgentV1SettingsAudioInputEncoding AMR_WB = + new AgentV1SettingsAudioInputEncoding(Value.AMR_WB, "amr-wb"); + + public static final AgentV1SettingsAudioInputEncoding LINEAR32 = + new AgentV1SettingsAudioInputEncoding(Value.LINEAR32, "linear32"); + + public static final AgentV1SettingsAudioInputEncoding OGG_OPUS = + new AgentV1SettingsAudioInputEncoding(Value.OGG_OPUS, "ogg-opus"); + + public static final AgentV1SettingsAudioInputEncoding FLAC = + new AgentV1SettingsAudioInputEncoding(Value.FLAC, "flac"); + + public static final AgentV1SettingsAudioInputEncoding SPEEX = + new AgentV1SettingsAudioInputEncoding(Value.SPEEX, "speex"); + + public static final AgentV1SettingsAudioInputEncoding LINEAR16 = + new AgentV1SettingsAudioInputEncoding(Value.LINEAR16, "linear16"); + + public static final AgentV1SettingsAudioInputEncoding OPUS = + new AgentV1SettingsAudioInputEncoding(Value.OPUS, "opus"); + + public static final AgentV1SettingsAudioInputEncoding ALAW = + new AgentV1SettingsAudioInputEncoding(Value.ALAW, "alaw"); + + public static final AgentV1SettingsAudioInputEncoding AMR_NB = + new AgentV1SettingsAudioInputEncoding(Value.AMR_NB, "amr-nb"); + + public static final AgentV1SettingsAudioInputEncoding G729 = + new AgentV1SettingsAudioInputEncoding(Value.G729, "g729"); + + private final Value value; + + private final String string; + + AgentV1SettingsAudioInputEncoding(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AgentV1SettingsAudioInputEncoding + && this.string.equals(((AgentV1SettingsAudioInputEncoding) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MULAW: + return visitor.visitMulaw(); + case AMR_WB: + return visitor.visitAmrWb(); + case LINEAR32: + return visitor.visitLinear32(); + case OGG_OPUS: + return visitor.visitOggOpus(); + case FLAC: + return visitor.visitFlac(); + case SPEEX: + return visitor.visitSpeex(); + case LINEAR16: + return visitor.visitLinear16(); + case OPUS: + return visitor.visitOpus(); + case ALAW: + return visitor.visitAlaw(); + case AMR_NB: + return visitor.visitAmrNb(); + case G729: + return visitor.visitG729(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AgentV1SettingsAudioInputEncoding valueOf(String value) { + switch (value) { + case "mulaw": + return MULAW; + case "amr-wb": + return AMR_WB; + case "linear32": + return LINEAR32; + case "ogg-opus": + return OGG_OPUS; + case "flac": + return FLAC; + case "speex": + return SPEEX; + case "linear16": + return LINEAR16; + case "opus": + return OPUS; + case "alaw": + return ALAW; + case "amr-nb": + return AMR_NB; + case "g729": + return G729; + default: + return new AgentV1SettingsAudioInputEncoding(Value.UNKNOWN, value); + } + } + + public enum Value { + LINEAR16, + + LINEAR32, + + FLAC, + + ALAW, + + MULAW, + + AMR_NB, + + AMR_WB, + + OPUS, + + OGG_OPUS, + + SPEEX, + + G729, + + UNKNOWN + } + + public interface Visitor { + T visitLinear16(); + + T visitLinear32(); + + T visitFlac(); + + T visitAlaw(); + + T visitMulaw(); + + T visitAmrNb(); + + T visitAmrWb(); + + T visitOpus(); + + T visitOggOpus(); + + T visitSpeex(); + + T visitG729(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAudioOutput.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAudioOutput.java new file mode 100644 index 0000000..560236d --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAudioOutput.java @@ -0,0 +1,203 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AgentV1SettingsAudioOutput.Builder.class) +public final class AgentV1SettingsAudioOutput { + private final Optional encoding; + + private final Optional sampleRate; + + private final Optional bitrate; + + private final Optional container; + + private final Map additionalProperties; + + private AgentV1SettingsAudioOutput( + Optional encoding, + Optional sampleRate, + Optional bitrate, + Optional container, + Map additionalProperties) { + this.encoding = encoding; + this.sampleRate = sampleRate; + this.bitrate = bitrate; + this.container = container; + this.additionalProperties = additionalProperties; + } + + /** + * @return Audio encoding format for streaming TTS output + */ + @JsonProperty("encoding") + public Optional getEncoding() { + return encoding; + } + + /** + * @return Sample rate in Hz + */ + @JsonProperty("sample_rate") + public Optional getSampleRate() { + return sampleRate; + } + + /** + * @return Audio bitrate in bits per second + */ + @JsonProperty("bitrate") + public Optional getBitrate() { + return bitrate; + } + + /** + * @return Audio container format. If omitted, defaults to 'none' + */ + @JsonProperty("container") + public Optional getContainer() { + return container; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1SettingsAudioOutput && equalTo((AgentV1SettingsAudioOutput) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1SettingsAudioOutput other) { + return encoding.equals(other.encoding) + && sampleRate.equals(other.sampleRate) + && bitrate.equals(other.bitrate) + && container.equals(other.container); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.encoding, this.sampleRate, this.bitrate, this.container); + } + + @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 encoding = Optional.empty(); + + private Optional sampleRate = Optional.empty(); + + private Optional bitrate = Optional.empty(); + + private Optional container = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AgentV1SettingsAudioOutput other) { + encoding(other.getEncoding()); + sampleRate(other.getSampleRate()); + bitrate(other.getBitrate()); + container(other.getContainer()); + return this; + } + + /** + *

Audio encoding format for streaming TTS output

+ */ + @JsonSetter(value = "encoding", nulls = Nulls.SKIP) + public Builder encoding(Optional encoding) { + this.encoding = encoding; + return this; + } + + public Builder encoding(AgentV1SettingsAudioOutputEncoding encoding) { + this.encoding = Optional.ofNullable(encoding); + return this; + } + + /** + *

Sample rate in Hz

+ */ + @JsonSetter(value = "sample_rate", nulls = Nulls.SKIP) + public Builder sampleRate(Optional sampleRate) { + this.sampleRate = sampleRate; + return this; + } + + public Builder sampleRate(Double sampleRate) { + this.sampleRate = Optional.ofNullable(sampleRate); + return this; + } + + /** + *

Audio bitrate in bits per second

+ */ + @JsonSetter(value = "bitrate", nulls = Nulls.SKIP) + public Builder bitrate(Optional bitrate) { + this.bitrate = bitrate; + return this; + } + + public Builder bitrate(Double bitrate) { + this.bitrate = Optional.ofNullable(bitrate); + return this; + } + + /** + *

Audio container format. If omitted, defaults to 'none'

+ */ + @JsonSetter(value = "container", nulls = Nulls.SKIP) + public Builder container(Optional container) { + this.container = container; + return this; + } + + public Builder container(String container) { + this.container = Optional.ofNullable(container); + return this; + } + + public AgentV1SettingsAudioOutput build() { + return new AgentV1SettingsAudioOutput(encoding, sampleRate, bitrate, container, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAudioOutputEncoding.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAudioOutputEncoding.java new file mode 100644 index 0000000..1aeda37 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsAudioOutputEncoding.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AgentV1SettingsAudioOutputEncoding { + public static final AgentV1SettingsAudioOutputEncoding MULAW = + new AgentV1SettingsAudioOutputEncoding(Value.MULAW, "mulaw"); + + public static final AgentV1SettingsAudioOutputEncoding LINEAR16 = + new AgentV1SettingsAudioOutputEncoding(Value.LINEAR16, "linear16"); + + public static final AgentV1SettingsAudioOutputEncoding ALAW = + new AgentV1SettingsAudioOutputEncoding(Value.ALAW, "alaw"); + + private final Value value; + + private final String string; + + AgentV1SettingsAudioOutputEncoding(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AgentV1SettingsAudioOutputEncoding + && this.string.equals(((AgentV1SettingsAudioOutputEncoding) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MULAW: + return visitor.visitMulaw(); + case LINEAR16: + return visitor.visitLinear16(); + case ALAW: + return visitor.visitAlaw(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AgentV1SettingsAudioOutputEncoding valueOf(String value) { + switch (value) { + case "mulaw": + return MULAW; + case "linear16": + return LINEAR16; + case "alaw": + return ALAW; + default: + return new AgentV1SettingsAudioOutputEncoding(Value.UNKNOWN, value); + } + } + + public enum Value { + LINEAR16, + + MULAW, + + ALAW, + + UNKNOWN + } + + public interface Visitor { + T visitLinear16(); + + T visitMulaw(); + + T visitAlaw(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsFlags.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsFlags.java new file mode 100644 index 0000000..8883193 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SettingsFlags.java @@ -0,0 +1,111 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AgentV1SettingsFlags.Builder.class) +public final class AgentV1SettingsFlags { + private final Optional history; + + private final Map additionalProperties; + + private AgentV1SettingsFlags(Optional history, Map additionalProperties) { + this.history = history; + this.additionalProperties = additionalProperties; + } + + /** + * @return Enable or disable history message reporting + */ + @JsonProperty("history") + public Optional getHistory() { + return history; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1SettingsFlags && equalTo((AgentV1SettingsFlags) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1SettingsFlags other) { + return history.equals(other.history); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.history); + } + + @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 history = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AgentV1SettingsFlags other) { + history(other.getHistory()); + return this; + } + + /** + *

Enable or disable history message reporting

+ */ + @JsonSetter(value = "history", nulls = Nulls.SKIP) + public Builder history(Optional history) { + this.history = history; + return this; + } + + public Builder history(Boolean history) { + this.history = Optional.ofNullable(history); + return this; + } + + public AgentV1SettingsFlags build() { + return new AgentV1SettingsFlags(history, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SpeakUpdated.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SpeakUpdated.java new file mode 100644 index 0000000..747aa9d --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1SpeakUpdated.java @@ -0,0 +1,78 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AgentV1SpeakUpdated.Builder.class) +public final class AgentV1SpeakUpdated { + private final Map additionalProperties; + + private AgentV1SpeakUpdated(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + /** + * @return Message type identifier for speak update confirmation + */ + @JsonProperty("type") + public String getType() { + return "SpeakUpdated"; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1SpeakUpdated; + } + + @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(AgentV1SpeakUpdated other) { + return this; + } + + public AgentV1SpeakUpdated build() { + return new AgentV1SpeakUpdated(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdatePrompt.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdatePrompt.java new file mode 100644 index 0000000..adbd18f --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdatePrompt.java @@ -0,0 +1,137 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AgentV1UpdatePrompt.Builder.class) +public final class AgentV1UpdatePrompt { + private final String prompt; + + private final Map additionalProperties; + + private AgentV1UpdatePrompt(String prompt, Map additionalProperties) { + this.prompt = prompt; + this.additionalProperties = additionalProperties; + } + + /** + * @return Message type identifier for prompt update request + */ + @JsonProperty("type") + public String getType() { + return "UpdatePrompt"; + } + + /** + * @return The new system prompt to be used by the agent + */ + @JsonProperty("prompt") + public String getPrompt() { + return prompt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1UpdatePrompt && equalTo((AgentV1UpdatePrompt) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1UpdatePrompt other) { + return prompt.equals(other.prompt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.prompt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PromptStage builder() { + return new Builder(); + } + + public interface PromptStage { + /** + *

The new system prompt to be used by the agent

+ */ + _FinalStage prompt(@NotNull String prompt); + + Builder from(AgentV1UpdatePrompt other); + } + + public interface _FinalStage { + AgentV1UpdatePrompt build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PromptStage, _FinalStage { + private String prompt; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentV1UpdatePrompt other) { + prompt(other.getPrompt()); + return this; + } + + /** + *

The new system prompt to be used by the agent

+ *

The new system prompt to be used by the agent

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("prompt") + public _FinalStage prompt(@NotNull String prompt) { + this.prompt = Objects.requireNonNull(prompt, "prompt must not be null"); + return this; + } + + @java.lang.Override + public AgentV1UpdatePrompt build() { + return new AgentV1UpdatePrompt(prompt, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeak.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeak.java new file mode 100644 index 0000000..e7fe474 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeak.java @@ -0,0 +1,126 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AgentV1UpdateSpeak.Builder.class) +public final class AgentV1UpdateSpeak { + private final AgentV1UpdateSpeakSpeak speak; + + private final Map additionalProperties; + + private AgentV1UpdateSpeak(AgentV1UpdateSpeakSpeak speak, Map additionalProperties) { + this.speak = speak; + this.additionalProperties = additionalProperties; + } + + /** + * @return Message type identifier for updating the speak model + */ + @JsonProperty("type") + public String getType() { + return "UpdateSpeak"; + } + + @JsonProperty("speak") + public AgentV1UpdateSpeakSpeak getSpeak() { + return speak; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1UpdateSpeak && equalTo((AgentV1UpdateSpeak) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1UpdateSpeak other) { + return speak.equals(other.speak); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.speak); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static SpeakStage builder() { + return new Builder(); + } + + public interface SpeakStage { + _FinalStage speak(@NotNull AgentV1UpdateSpeakSpeak speak); + + Builder from(AgentV1UpdateSpeak other); + } + + public interface _FinalStage { + AgentV1UpdateSpeak build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements SpeakStage, _FinalStage { + private AgentV1UpdateSpeakSpeak speak; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentV1UpdateSpeak other) { + speak(other.getSpeak()); + return this; + } + + @java.lang.Override + @JsonSetter("speak") + public _FinalStage speak(@NotNull AgentV1UpdateSpeakSpeak speak) { + this.speak = Objects.requireNonNull(speak, "speak must not be null"); + return this; + } + + @java.lang.Override + public AgentV1UpdateSpeak build() { + return new AgentV1UpdateSpeak(speak, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeak.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeak.java new file mode 100644 index 0000000..7fc43b5 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeak.java @@ -0,0 +1,98 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import java.io.IOException; +import java.util.List; +import java.util.Objects; + +@JsonDeserialize(using = AgentV1UpdateSpeakSpeak.Deserializer.class) +public final class AgentV1UpdateSpeakSpeak { + private final Object value; + + private final int type; + + private AgentV1UpdateSpeakSpeak(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + @SuppressWarnings("unchecked") + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((AgentV1UpdateSpeakSpeakEndpoint) this.value); + } else if (this.type == 1) { + return visitor.visit((List) 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 AgentV1UpdateSpeakSpeak && equalTo((AgentV1UpdateSpeakSpeak) other); + } + + private boolean equalTo(AgentV1UpdateSpeakSpeak 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 AgentV1UpdateSpeakSpeak of(AgentV1UpdateSpeakSpeakEndpoint value) { + return new AgentV1UpdateSpeakSpeak(value, 0); + } + + public static AgentV1UpdateSpeakSpeak of(List value) { + return new AgentV1UpdateSpeakSpeak(value, 1); + } + + public interface Visitor { + T visit(AgentV1UpdateSpeakSpeakEndpoint value); + + T visit(List value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(AgentV1UpdateSpeakSpeak.class); + } + + @java.lang.Override + public AgentV1UpdateSpeakSpeak deserialize(JsonParser p, DeserializationContext context) throws IOException { + Object value = p.readValueAs(Object.class); + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, AgentV1UpdateSpeakSpeakEndpoint.class)); + } catch (RuntimeException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue( + value, new TypeReference>() {})); + } catch (RuntimeException e) { + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpoint.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpoint.java new file mode 100644 index 0000000..107312f --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpoint.java @@ -0,0 +1,168 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = AgentV1UpdateSpeakSpeakEndpoint.Builder.class) +public final class AgentV1UpdateSpeakSpeakEndpoint { + private final AgentV1UpdateSpeakSpeakEndpointProvider provider; + + private final Optional endpoint; + + private final Map additionalProperties; + + private AgentV1UpdateSpeakSpeakEndpoint( + AgentV1UpdateSpeakSpeakEndpointProvider provider, + Optional endpoint, + Map additionalProperties) { + this.provider = provider; + this.endpoint = endpoint; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public AgentV1UpdateSpeakSpeakEndpointProvider getProvider() { + return provider; + } + + /** + * @return Optional if provider is Deepgram. Required for non-Deepgram TTS providers. + * When present, must include url field and headers object. Valid schemes are https and wss with wss only supported for Eleven Labs. + */ + @JsonProperty("endpoint") + public Optional getEndpoint() { + return endpoint; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1UpdateSpeakSpeakEndpoint && equalTo((AgentV1UpdateSpeakSpeakEndpoint) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1UpdateSpeakSpeakEndpoint other) { + return provider.equals(other.provider) && endpoint.equals(other.endpoint); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.provider, this.endpoint); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ProviderStage builder() { + return new Builder(); + } + + public interface ProviderStage { + _FinalStage provider(@NotNull AgentV1UpdateSpeakSpeakEndpointProvider provider); + + Builder from(AgentV1UpdateSpeakSpeakEndpoint other); + } + + public interface _FinalStage { + AgentV1UpdateSpeakSpeakEndpoint build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Optional if provider is Deepgram. Required for non-Deepgram TTS providers. + * When present, must include url field and headers object. Valid schemes are https and wss with wss only supported for Eleven Labs.

+ */ + _FinalStage endpoint(Optional endpoint); + + _FinalStage endpoint(AgentV1UpdateSpeakSpeakEndpointEndpoint endpoint); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ProviderStage, _FinalStage { + private AgentV1UpdateSpeakSpeakEndpointProvider provider; + + private Optional endpoint = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentV1UpdateSpeakSpeakEndpoint other) { + provider(other.getProvider()); + endpoint(other.getEndpoint()); + return this; + } + + @java.lang.Override + @JsonSetter("provider") + public _FinalStage provider(@NotNull AgentV1UpdateSpeakSpeakEndpointProvider provider) { + this.provider = Objects.requireNonNull(provider, "provider must not be null"); + return this; + } + + /** + *

Optional if provider is Deepgram. Required for non-Deepgram TTS providers. + * When present, must include url field and headers object. Valid schemes are https and wss with wss only supported for Eleven Labs.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage endpoint(AgentV1UpdateSpeakSpeakEndpointEndpoint endpoint) { + this.endpoint = Optional.ofNullable(endpoint); + return this; + } + + /** + *

Optional if provider is Deepgram. Required for non-Deepgram TTS providers. + * When present, must include url field and headers object. Valid schemes are https and wss with wss only supported for Eleven Labs.

+ */ + @java.lang.Override + @JsonSetter(value = "endpoint", nulls = Nulls.SKIP) + public _FinalStage endpoint(Optional endpoint) { + this.endpoint = endpoint; + return this; + } + + @java.lang.Override + public AgentV1UpdateSpeakSpeakEndpoint build() { + return new AgentV1UpdateSpeakSpeakEndpoint(provider, endpoint, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointEndpoint.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointEndpoint.java new file mode 100644 index 0000000..4f40542 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointEndpoint.java @@ -0,0 +1,135 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AgentV1UpdateSpeakSpeakEndpointEndpoint.Builder.class) +public final class AgentV1UpdateSpeakSpeakEndpointEndpoint { + private final Optional url; + + private final Optional> headers; + + private final Map additionalProperties; + + private AgentV1UpdateSpeakSpeakEndpointEndpoint( + Optional url, Optional> headers, Map additionalProperties) { + this.url = url; + this.headers = headers; + this.additionalProperties = additionalProperties; + } + + /** + * @return Custom TTS endpoint URL. Cannot contain output_format or model_id query parameters when the provider is Eleven Labs. + */ + @JsonProperty("url") + public Optional getUrl() { + return url; + } + + @JsonProperty("headers") + public Optional> getHeaders() { + return headers; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1UpdateSpeakSpeakEndpointEndpoint + && equalTo((AgentV1UpdateSpeakSpeakEndpointEndpoint) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1UpdateSpeakSpeakEndpointEndpoint other) { + return url.equals(other.url) && headers.equals(other.headers); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.url, this.headers); + } + + @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 url = Optional.empty(); + + private Optional> headers = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AgentV1UpdateSpeakSpeakEndpointEndpoint other) { + url(other.getUrl()); + headers(other.getHeaders()); + return this; + } + + /** + *

Custom TTS endpoint URL. Cannot contain output_format or model_id query parameters when the provider is Eleven Labs.

+ */ + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public Builder url(Optional url) { + this.url = url; + return this; + } + + public Builder url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + @JsonSetter(value = "headers", nulls = Nulls.SKIP) + public Builder headers(Optional> headers) { + this.headers = headers; + return this; + } + + public Builder headers(Map headers) { + this.headers = Optional.ofNullable(headers); + return this; + } + + public AgentV1UpdateSpeakSpeakEndpointEndpoint build() { + return new AgentV1UpdateSpeakSpeakEndpointEndpoint(url, headers, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProvider.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProvider.java new file mode 100644 index 0000000..5fd9d94 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProvider.java @@ -0,0 +1,403 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.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 AgentV1UpdateSpeakSpeakEndpointProvider { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private AgentV1UpdateSpeakSpeakEndpointProvider(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static AgentV1UpdateSpeakSpeakEndpointProvider deepgram( + AgentV1UpdateSpeakSpeakEndpointProviderDeepgram value) { + return new AgentV1UpdateSpeakSpeakEndpointProvider(new DeepgramValue(value)); + } + + public static AgentV1UpdateSpeakSpeakEndpointProvider elevenLabs( + AgentV1UpdateSpeakSpeakEndpointProviderElevenLabs value) { + return new AgentV1UpdateSpeakSpeakEndpointProvider(new ElevenLabsValue(value)); + } + + public static AgentV1UpdateSpeakSpeakEndpointProvider cartesia( + AgentV1UpdateSpeakSpeakEndpointProviderCartesia value) { + return new AgentV1UpdateSpeakSpeakEndpointProvider(new CartesiaValue(value)); + } + + public static AgentV1UpdateSpeakSpeakEndpointProvider openAi(AgentV1UpdateSpeakSpeakEndpointProviderOpenAi value) { + return new AgentV1UpdateSpeakSpeakEndpointProvider(new OpenAiValue(value)); + } + + public static AgentV1UpdateSpeakSpeakEndpointProvider awsPolly( + AgentV1UpdateSpeakSpeakEndpointProviderAwsPolly value) { + return new AgentV1UpdateSpeakSpeakEndpointProvider(new AwsPollyValue(value)); + } + + public boolean isDeepgram() { + return value instanceof DeepgramValue; + } + + public boolean isElevenLabs() { + return value instanceof ElevenLabsValue; + } + + public boolean isCartesia() { + return value instanceof CartesiaValue; + } + + public boolean isOpenAi() { + return value instanceof OpenAiValue; + } + + public boolean isAwsPolly() { + return value instanceof AwsPollyValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getDeepgram() { + if (isDeepgram()) { + return Optional.of(((DeepgramValue) value).value); + } + return Optional.empty(); + } + + public Optional getElevenLabs() { + if (isElevenLabs()) { + return Optional.of(((ElevenLabsValue) value).value); + } + return Optional.empty(); + } + + public Optional getCartesia() { + if (isCartesia()) { + return Optional.of(((CartesiaValue) value).value); + } + return Optional.empty(); + } + + public Optional getOpenAi() { + if (isOpenAi()) { + return Optional.of(((OpenAiValue) value).value); + } + return Optional.empty(); + } + + public Optional getAwsPolly() { + if (isAwsPolly()) { + return Optional.of(((AwsPollyValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1UpdateSpeakSpeakEndpointProvider + && value.equals(((AgentV1UpdateSpeakSpeakEndpointProvider) other).value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + return value.toString(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitDeepgram(AgentV1UpdateSpeakSpeakEndpointProviderDeepgram deepgram); + + T visitElevenLabs(AgentV1UpdateSpeakSpeakEndpointProviderElevenLabs elevenLabs); + + T visitCartesia(AgentV1UpdateSpeakSpeakEndpointProviderCartesia cartesia); + + T visitOpenAi(AgentV1UpdateSpeakSpeakEndpointProviderOpenAi openAi); + + T visitAwsPolly(AgentV1UpdateSpeakSpeakEndpointProviderAwsPolly awsPolly); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(DeepgramValue.class), + @JsonSubTypes.Type(ElevenLabsValue.class), + @JsonSubTypes.Type(CartesiaValue.class), + @JsonSubTypes.Type(OpenAiValue.class), + @JsonSubTypes.Type(AwsPollyValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("deepgram") + @JsonIgnoreProperties("type") + private static final class DeepgramValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "type", allowSetters = true) + private AgentV1UpdateSpeakSpeakEndpointProviderDeepgram value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private DeepgramValue() {} + + private DeepgramValue(AgentV1UpdateSpeakSpeakEndpointProviderDeepgram 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 "AgentV1UpdateSpeakSpeakEndpointProvider{" + "value: " + value + "}"; + } + } + + @JsonTypeName("eleven_labs") + @JsonIgnoreProperties("type") + private static final class ElevenLabsValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "type", allowSetters = true) + private AgentV1UpdateSpeakSpeakEndpointProviderElevenLabs value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ElevenLabsValue() {} + + private ElevenLabsValue(AgentV1UpdateSpeakSpeakEndpointProviderElevenLabs value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitElevenLabs(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ElevenLabsValue && equalTo((ElevenLabsValue) other); + } + + private boolean equalTo(ElevenLabsValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AgentV1UpdateSpeakSpeakEndpointProvider{" + "value: " + value + "}"; + } + } + + @JsonTypeName("cartesia") + @JsonIgnoreProperties("type") + private static final class CartesiaValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "type", allowSetters = true) + private AgentV1UpdateSpeakSpeakEndpointProviderCartesia value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private CartesiaValue() {} + + private CartesiaValue(AgentV1UpdateSpeakSpeakEndpointProviderCartesia 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 "AgentV1UpdateSpeakSpeakEndpointProvider{" + "value: " + value + "}"; + } + } + + @JsonTypeName("open_ai") + @JsonIgnoreProperties("type") + private static final class OpenAiValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "type", allowSetters = true) + private AgentV1UpdateSpeakSpeakEndpointProviderOpenAi value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private OpenAiValue() {} + + private OpenAiValue(AgentV1UpdateSpeakSpeakEndpointProviderOpenAi 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 "AgentV1UpdateSpeakSpeakEndpointProvider{" + "value: " + value + "}"; + } + } + + @JsonTypeName("aws_polly") + @JsonIgnoreProperties("type") + private static final class AwsPollyValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "type", allowSetters = true) + private AgentV1UpdateSpeakSpeakEndpointProviderAwsPolly value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private AwsPollyValue() {} + + private AwsPollyValue(AgentV1UpdateSpeakSpeakEndpointProviderAwsPolly value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitAwsPolly(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AwsPollyValue && equalTo((AwsPollyValue) other); + } + + private boolean equalTo(AwsPollyValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AgentV1UpdateSpeakSpeakEndpointProvider{" + "value: " + value + "}"; + } + } + + @JsonIgnoreProperties("type") + 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 "AgentV1UpdateSpeakSpeakEndpointProvider{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProviderAwsPolly.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProviderAwsPolly.java new file mode 100644 index 0000000..43e8831 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProviderAwsPolly.java @@ -0,0 +1,262 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = AgentV1UpdateSpeakSpeakEndpointProviderAwsPolly.Builder.class) +public final class AgentV1UpdateSpeakSpeakEndpointProviderAwsPolly { + private final AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyVoice voice; + + private final String language; + + private final Optional languageCode; + + private final AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyEngine engine; + + private final AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyCredentials credentials; + + private final Map additionalProperties; + + private AgentV1UpdateSpeakSpeakEndpointProviderAwsPolly( + AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyVoice voice, + String language, + Optional languageCode, + AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyEngine engine, + AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyCredentials credentials, + Map additionalProperties) { + this.voice = voice; + this.language = language; + this.languageCode = languageCode; + this.engine = engine; + this.credentials = credentials; + this.additionalProperties = additionalProperties; + } + + /** + * @return AWS Polly voice name + */ + @JsonProperty("voice") + public AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyVoice getVoice() { + return voice; + } + + /** + * @return Language code to use, e.g. 'en-US'. Corresponds to the language_code parameter in the AWS Polly API + */ + @JsonProperty("language") + public String getLanguage() { + return language; + } + + /** + * @return Use the language field instead. + */ + @JsonProperty("language_code") + public Optional getLanguageCode() { + return languageCode; + } + + @JsonProperty("engine") + public AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyEngine getEngine() { + return engine; + } + + @JsonProperty("credentials") + public AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyCredentials getCredentials() { + return credentials; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1UpdateSpeakSpeakEndpointProviderAwsPolly + && equalTo((AgentV1UpdateSpeakSpeakEndpointProviderAwsPolly) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1UpdateSpeakSpeakEndpointProviderAwsPolly other) { + return voice.equals(other.voice) + && language.equals(other.language) + && languageCode.equals(other.languageCode) + && engine.equals(other.engine) + && credentials.equals(other.credentials); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.voice, this.language, this.languageCode, this.engine, this.credentials); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static VoiceStage builder() { + return new Builder(); + } + + public interface VoiceStage { + /** + *

AWS Polly voice name

+ */ + LanguageStage voice(@NotNull AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyVoice voice); + + Builder from(AgentV1UpdateSpeakSpeakEndpointProviderAwsPolly other); + } + + public interface LanguageStage { + /** + *

Language code to use, e.g. 'en-US'. Corresponds to the language_code parameter in the AWS Polly API

+ */ + EngineStage language(@NotNull String language); + } + + public interface EngineStage { + CredentialsStage engine(@NotNull AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyEngine engine); + } + + public interface CredentialsStage { + _FinalStage credentials(@NotNull AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyCredentials credentials); + } + + public interface _FinalStage { + AgentV1UpdateSpeakSpeakEndpointProviderAwsPolly build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Use the language field instead.

+ */ + _FinalStage languageCode(Optional languageCode); + + _FinalStage languageCode(String languageCode); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements VoiceStage, LanguageStage, EngineStage, CredentialsStage, _FinalStage { + private AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyVoice voice; + + private String language; + + private AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyEngine engine; + + private AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyCredentials credentials; + + private Optional languageCode = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentV1UpdateSpeakSpeakEndpointProviderAwsPolly other) { + voice(other.getVoice()); + language(other.getLanguage()); + languageCode(other.getLanguageCode()); + engine(other.getEngine()); + credentials(other.getCredentials()); + return this; + } + + /** + *

AWS Polly voice name

+ *

AWS Polly voice name

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

Language code to use, e.g. 'en-US'. Corresponds to the language_code parameter in the AWS Polly API

+ *

Language code to use, e.g. 'en-US'. Corresponds to the language_code parameter in the AWS Polly API

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

Use the language field instead.

+ * @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; + } + + /** + *

Use the language field instead.

+ */ + @java.lang.Override + @JsonSetter(value = "language_code", nulls = Nulls.SKIP) + public _FinalStage languageCode(Optional languageCode) { + this.languageCode = languageCode; + return this; + } + + @java.lang.Override + public AgentV1UpdateSpeakSpeakEndpointProviderAwsPolly build() { + return new AgentV1UpdateSpeakSpeakEndpointProviderAwsPolly( + voice, language, languageCode, engine, credentials, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyCredentials.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyCredentials.java new file mode 100644 index 0000000..41e6438 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyCredentials.java @@ -0,0 +1,240 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyCredentials.Builder.class) +public final class AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyCredentials { + private final AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyCredentialsType type; + + private final String region; + + private final String accessKeyId; + + private final String secretAccessKey; + + private final Optional sessionToken; + + private final Map additionalProperties; + + private AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyCredentials( + AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyCredentialsType type, + String region, + String accessKeyId, + String secretAccessKey, + Optional sessionToken, + Map additionalProperties) { + this.type = type; + this.region = region; + this.accessKeyId = accessKeyId; + this.secretAccessKey = secretAccessKey; + this.sessionToken = sessionToken; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("type") + public AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyCredentialsType getType() { + return type; + } + + @JsonProperty("region") + public String getRegion() { + return region; + } + + @JsonProperty("access_key_id") + public String getAccessKeyId() { + return accessKeyId; + } + + @JsonProperty("secret_access_key") + public String getSecretAccessKey() { + return secretAccessKey; + } + + /** + * @return Required for STS only + */ + @JsonProperty("session_token") + public Optional getSessionToken() { + return sessionToken; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyCredentials + && equalTo((AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyCredentials) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyCredentials other) { + return type.equals(other.type) + && region.equals(other.region) + && accessKeyId.equals(other.accessKeyId) + && secretAccessKey.equals(other.secretAccessKey) + && sessionToken.equals(other.sessionToken); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.region, this.accessKeyId, this.secretAccessKey, this.sessionToken); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TypeStage builder() { + return new Builder(); + } + + public interface TypeStage { + RegionStage type(@NotNull AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyCredentialsType type); + + Builder from(AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyCredentials other); + } + + public interface RegionStage { + AccessKeyIdStage region(@NotNull String region); + } + + public interface AccessKeyIdStage { + SecretAccessKeyStage accessKeyId(@NotNull String accessKeyId); + } + + public interface SecretAccessKeyStage { + _FinalStage secretAccessKey(@NotNull String secretAccessKey); + } + + public interface _FinalStage { + AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyCredentials build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Required for STS only

+ */ + _FinalStage sessionToken(Optional sessionToken); + + _FinalStage sessionToken(String sessionToken); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements TypeStage, RegionStage, AccessKeyIdStage, SecretAccessKeyStage, _FinalStage { + private AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyCredentialsType type; + + private String region; + + private String accessKeyId; + + private String secretAccessKey; + + private Optional sessionToken = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyCredentials other) { + type(other.getType()); + region(other.getRegion()); + accessKeyId(other.getAccessKeyId()); + secretAccessKey(other.getSecretAccessKey()); + sessionToken(other.getSessionToken()); + return this; + } + + @java.lang.Override + @JsonSetter("type") + public RegionStage type(@NotNull AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyCredentialsType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("region") + public AccessKeyIdStage region(@NotNull String region) { + this.region = Objects.requireNonNull(region, "region must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("access_key_id") + public SecretAccessKeyStage accessKeyId(@NotNull String accessKeyId) { + this.accessKeyId = Objects.requireNonNull(accessKeyId, "accessKeyId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("secret_access_key") + public _FinalStage secretAccessKey(@NotNull String secretAccessKey) { + this.secretAccessKey = Objects.requireNonNull(secretAccessKey, "secretAccessKey must not be null"); + return this; + } + + /** + *

Required for STS only

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sessionToken(String sessionToken) { + this.sessionToken = Optional.ofNullable(sessionToken); + return this; + } + + /** + *

Required for STS only

+ */ + @java.lang.Override + @JsonSetter(value = "session_token", nulls = Nulls.SKIP) + public _FinalStage sessionToken(Optional sessionToken) { + this.sessionToken = sessionToken; + return this; + } + + @java.lang.Override + public AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyCredentials build() { + return new AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyCredentials( + type, region, accessKeyId, secretAccessKey, sessionToken, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyCredentialsType.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyCredentialsType.java new file mode 100644 index 0000000..0c36aaf --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyCredentialsType.java @@ -0,0 +1,87 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyCredentialsType { + public static final AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyCredentialsType IAM = + new AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyCredentialsType(Value.IAM, "iam"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyCredentialsType STS = + new AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyCredentialsType(Value.STS, "sts"); + + private final Value value; + + private final String string; + + AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyCredentialsType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyCredentialsType + && this.string.equals( + ((AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyCredentialsType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case IAM: + return visitor.visitIam(); + case STS: + return visitor.visitSts(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyCredentialsType valueOf(String value) { + switch (value) { + case "iam": + return IAM; + case "sts": + return STS; + default: + return new AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyCredentialsType(Value.UNKNOWN, value); + } + } + + public enum Value { + STS, + + IAM, + + UNKNOWN + } + + public interface Visitor { + T visitSts(); + + T visitIam(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyEngine.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyEngine.java new file mode 100644 index 0000000..06ed8d8 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyEngine.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyEngine { + public static final AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyEngine LONG_FORM = + new AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyEngine(Value.LONG_FORM, "long-form"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyEngine STANDARD = + new AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyEngine(Value.STANDARD, "standard"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyEngine GENERATIVE = + new AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyEngine(Value.GENERATIVE, "generative"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyEngine NEURAL = + new AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyEngine(Value.NEURAL, "neural"); + + private final Value value; + + private final String string; + + AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyEngine(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyEngine + && this.string.equals(((AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyEngine) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case LONG_FORM: + return visitor.visitLongForm(); + case STANDARD: + return visitor.visitStandard(); + case GENERATIVE: + return visitor.visitGenerative(); + case NEURAL: + return visitor.visitNeural(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyEngine valueOf(String value) { + switch (value) { + case "long-form": + return LONG_FORM; + case "standard": + return STANDARD; + case "generative": + return GENERATIVE; + case "neural": + return NEURAL; + default: + return new AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyEngine(Value.UNKNOWN, value); + } + } + + public enum Value { + GENERATIVE, + + LONG_FORM, + + STANDARD, + + NEURAL, + + UNKNOWN + } + + public interface Visitor { + T visitGenerative(); + + T visitLongForm(); + + T visitStandard(); + + T visitNeural(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyVoice.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyVoice.java new file mode 100644 index 0000000..39fdec6 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyVoice.java @@ -0,0 +1,152 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyVoice { + public static final AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyVoice ARTHUR = + new AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyVoice(Value.ARTHUR, "Arthur"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyVoice JOANNA = + new AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyVoice(Value.JOANNA, "Joanna"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyVoice BRIAN = + new AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyVoice(Value.BRIAN, "Brian"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyVoice AMY = + new AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyVoice(Value.AMY, "Amy"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyVoice EMMA = + new AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyVoice(Value.EMMA, "Emma"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyVoice MATTHEW = + new AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyVoice(Value.MATTHEW, "Matthew"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyVoice ARIA = + new AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyVoice(Value.ARIA, "Aria"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyVoice AYANDA = + new AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyVoice(Value.AYANDA, "Ayanda"); + + private final Value value; + + private final String string; + + AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyVoice(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyVoice + && this.string.equals(((AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyVoice) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ARTHUR: + return visitor.visitArthur(); + case JOANNA: + return visitor.visitJoanna(); + case BRIAN: + return visitor.visitBrian(); + case AMY: + return visitor.visitAmy(); + case EMMA: + return visitor.visitEmma(); + case MATTHEW: + return visitor.visitMatthew(); + case ARIA: + return visitor.visitAria(); + case AYANDA: + return visitor.visitAyanda(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyVoice valueOf(String value) { + switch (value) { + case "Arthur": + return ARTHUR; + case "Joanna": + return JOANNA; + case "Brian": + return BRIAN; + case "Amy": + return AMY; + case "Emma": + return EMMA; + case "Matthew": + return MATTHEW; + case "Aria": + return ARIA; + case "Ayanda": + return AYANDA; + default: + return new AgentV1UpdateSpeakSpeakEndpointProviderAwsPollyVoice(Value.UNKNOWN, value); + } + } + + public enum Value { + MATTHEW, + + JOANNA, + + AMY, + + EMMA, + + BRIAN, + + ARTHUR, + + ARIA, + + AYANDA, + + UNKNOWN + } + + public interface Visitor { + T visitMatthew(); + + T visitJoanna(); + + T visitAmy(); + + T visitEmma(); + + T visitBrian(); + + T visitArthur(); + + T visitAria(); + + T visitAyanda(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProviderCartesia.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProviderCartesia.java new file mode 100644 index 0000000..f35c958 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProviderCartesia.java @@ -0,0 +1,245 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = AgentV1UpdateSpeakSpeakEndpointProviderCartesia.Builder.class) +public final class AgentV1UpdateSpeakSpeakEndpointProviderCartesia { + private final Optional version; + + private final AgentV1UpdateSpeakSpeakEndpointProviderCartesiaModelId modelId; + + private final AgentV1UpdateSpeakSpeakEndpointProviderCartesiaVoice voice; + + private final Optional language; + + private final Map additionalProperties; + + private AgentV1UpdateSpeakSpeakEndpointProviderCartesia( + Optional version, + AgentV1UpdateSpeakSpeakEndpointProviderCartesiaModelId modelId, + AgentV1UpdateSpeakSpeakEndpointProviderCartesiaVoice voice, + Optional language, + Map additionalProperties) { + this.version = version; + this.modelId = modelId; + this.voice = voice; + this.language = language; + this.additionalProperties = additionalProperties; + } + + /** + * @return The API version header for the Cartesia text-to-speech API + */ + @JsonProperty("version") + public Optional getVersion() { + return version; + } + + /** + * @return Cartesia model ID + */ + @JsonProperty("model_id") + public AgentV1UpdateSpeakSpeakEndpointProviderCartesiaModelId getModelId() { + return modelId; + } + + @JsonProperty("voice") + public AgentV1UpdateSpeakSpeakEndpointProviderCartesiaVoice getVoice() { + return voice; + } + + /** + * @return Cartesia language code + */ + @JsonProperty("language") + public Optional getLanguage() { + return language; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1UpdateSpeakSpeakEndpointProviderCartesia + && equalTo((AgentV1UpdateSpeakSpeakEndpointProviderCartesia) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1UpdateSpeakSpeakEndpointProviderCartesia other) { + return version.equals(other.version) + && modelId.equals(other.modelId) + && voice.equals(other.voice) + && language.equals(other.language); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.version, this.modelId, this.voice, this.language); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ModelIdStage builder() { + return new Builder(); + } + + public interface ModelIdStage { + /** + *

Cartesia model ID

+ */ + VoiceStage modelId(@NotNull AgentV1UpdateSpeakSpeakEndpointProviderCartesiaModelId modelId); + + Builder from(AgentV1UpdateSpeakSpeakEndpointProviderCartesia other); + } + + public interface VoiceStage { + _FinalStage voice(@NotNull AgentV1UpdateSpeakSpeakEndpointProviderCartesiaVoice voice); + } + + public interface _FinalStage { + AgentV1UpdateSpeakSpeakEndpointProviderCartesia build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The API version header for the Cartesia text-to-speech API

+ */ + _FinalStage version(Optional version); + + _FinalStage version(String version); + + /** + *

Cartesia language code

+ */ + _FinalStage language(Optional language); + + _FinalStage language(String language); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ModelIdStage, VoiceStage, _FinalStage { + private AgentV1UpdateSpeakSpeakEndpointProviderCartesiaModelId modelId; + + private AgentV1UpdateSpeakSpeakEndpointProviderCartesiaVoice voice; + + private Optional language = Optional.empty(); + + private Optional version = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentV1UpdateSpeakSpeakEndpointProviderCartesia other) { + version(other.getVersion()); + modelId(other.getModelId()); + voice(other.getVoice()); + language(other.getLanguage()); + return this; + } + + /** + *

Cartesia model ID

+ *

Cartesia model ID

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

Cartesia language code

+ * @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; + } + + /** + *

Cartesia language code

+ */ + @java.lang.Override + @JsonSetter(value = "language", nulls = Nulls.SKIP) + public _FinalStage language(Optional language) { + this.language = language; + return this; + } + + /** + *

The API version header for the Cartesia text-to-speech API

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage version(String version) { + this.version = Optional.ofNullable(version); + return this; + } + + /** + *

The API version header for the Cartesia text-to-speech API

+ */ + @java.lang.Override + @JsonSetter(value = "version", nulls = Nulls.SKIP) + public _FinalStage version(Optional version) { + this.version = version; + return this; + } + + @java.lang.Override + public AgentV1UpdateSpeakSpeakEndpointProviderCartesia build() { + return new AgentV1UpdateSpeakSpeakEndpointProviderCartesia( + version, modelId, voice, language, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProviderCartesiaModelId.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProviderCartesiaModelId.java new file mode 100644 index 0000000..dbd6547 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProviderCartesiaModelId.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AgentV1UpdateSpeakSpeakEndpointProviderCartesiaModelId { + public static final AgentV1UpdateSpeakSpeakEndpointProviderCartesiaModelId SONIC_MULTILINGUAL = + new AgentV1UpdateSpeakSpeakEndpointProviderCartesiaModelId(Value.SONIC_MULTILINGUAL, "sonic-multilingual"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderCartesiaModelId SONIC2 = + new AgentV1UpdateSpeakSpeakEndpointProviderCartesiaModelId(Value.SONIC2, "sonic-2"); + + private final Value value; + + private final String string; + + AgentV1UpdateSpeakSpeakEndpointProviderCartesiaModelId(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AgentV1UpdateSpeakSpeakEndpointProviderCartesiaModelId + && this.string.equals(((AgentV1UpdateSpeakSpeakEndpointProviderCartesiaModelId) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SONIC_MULTILINGUAL: + return visitor.visitSonicMultilingual(); + case SONIC2: + return visitor.visitSonic2(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AgentV1UpdateSpeakSpeakEndpointProviderCartesiaModelId valueOf(String value) { + switch (value) { + case "sonic-multilingual": + return SONIC_MULTILINGUAL; + case "sonic-2": + return SONIC2; + default: + return new AgentV1UpdateSpeakSpeakEndpointProviderCartesiaModelId(Value.UNKNOWN, value); + } + } + + public enum Value { + SONIC2, + + SONIC_MULTILINGUAL, + + UNKNOWN + } + + public interface Visitor { + T visitSonic2(); + + T visitSonicMultilingual(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProviderCartesiaVoice.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProviderCartesiaVoice.java new file mode 100644 index 0000000..fbb9642 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProviderCartesiaVoice.java @@ -0,0 +1,164 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AgentV1UpdateSpeakSpeakEndpointProviderCartesiaVoice.Builder.class) +public final class AgentV1UpdateSpeakSpeakEndpointProviderCartesiaVoice { + private final String mode; + + private final String id; + + private final Map additionalProperties; + + private AgentV1UpdateSpeakSpeakEndpointProviderCartesiaVoice( + String mode, String id, Map additionalProperties) { + this.mode = mode; + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return Cartesia voice mode + */ + @JsonProperty("mode") + public String getMode() { + return mode; + } + + /** + * @return Cartesia voice ID + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1UpdateSpeakSpeakEndpointProviderCartesiaVoice + && equalTo((AgentV1UpdateSpeakSpeakEndpointProviderCartesiaVoice) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1UpdateSpeakSpeakEndpointProviderCartesiaVoice other) { + return mode.equals(other.mode) && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.mode, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ModeStage builder() { + return new Builder(); + } + + public interface ModeStage { + /** + *

Cartesia voice mode

+ */ + IdStage mode(@NotNull String mode); + + Builder from(AgentV1UpdateSpeakSpeakEndpointProviderCartesiaVoice other); + } + + public interface IdStage { + /** + *

Cartesia voice ID

+ */ + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + AgentV1UpdateSpeakSpeakEndpointProviderCartesiaVoice build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ModeStage, IdStage, _FinalStage { + private String mode; + + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentV1UpdateSpeakSpeakEndpointProviderCartesiaVoice other) { + mode(other.getMode()); + id(other.getId()); + return this; + } + + /** + *

Cartesia voice mode

+ *

Cartesia voice mode

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

Cartesia voice ID

+ *

Cartesia voice ID

+ * @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 AgentV1UpdateSpeakSpeakEndpointProviderCartesiaVoice build() { + return new AgentV1UpdateSpeakSpeakEndpointProviderCartesiaVoice(mode, id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProviderDeepgram.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProviderDeepgram.java new file mode 100644 index 0000000..073fb1a --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProviderDeepgram.java @@ -0,0 +1,176 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = AgentV1UpdateSpeakSpeakEndpointProviderDeepgram.Builder.class) +public final class AgentV1UpdateSpeakSpeakEndpointProviderDeepgram { + private final Optional version; + + private final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel model; + + private final Map additionalProperties; + + private AgentV1UpdateSpeakSpeakEndpointProviderDeepgram( + Optional version, + AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel model, + Map additionalProperties) { + this.version = version; + this.model = model; + this.additionalProperties = additionalProperties; + } + + /** + * @return The REST API version for the Deepgram text-to-speech API + */ + @JsonProperty("version") + public Optional getVersion() { + return version; + } + + /** + * @return Deepgram TTS model + */ + @JsonProperty("model") + public AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel getModel() { + return model; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1UpdateSpeakSpeakEndpointProviderDeepgram + && equalTo((AgentV1UpdateSpeakSpeakEndpointProviderDeepgram) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1UpdateSpeakSpeakEndpointProviderDeepgram other) { + return version.equals(other.version) && model.equals(other.model); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.version, this.model); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ModelStage builder() { + return new Builder(); + } + + public interface ModelStage { + /** + *

Deepgram TTS model

+ */ + _FinalStage model(@NotNull AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel model); + + Builder from(AgentV1UpdateSpeakSpeakEndpointProviderDeepgram other); + } + + public interface _FinalStage { + AgentV1UpdateSpeakSpeakEndpointProviderDeepgram build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The REST API version for the Deepgram text-to-speech API

+ */ + _FinalStage version(Optional version); + + _FinalStage version(String version); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ModelStage, _FinalStage { + private AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel model; + + private Optional version = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentV1UpdateSpeakSpeakEndpointProviderDeepgram other) { + version(other.getVersion()); + model(other.getModel()); + return this; + } + + /** + *

Deepgram TTS model

+ *

Deepgram TTS model

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

The REST API version for the Deepgram text-to-speech API

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage version(String version) { + this.version = Optional.ofNullable(version); + return this; + } + + /** + *

The REST API version for the Deepgram text-to-speech API

+ */ + @java.lang.Override + @JsonSetter(value = "version", nulls = Nulls.SKIP) + public _FinalStage version(Optional version) { + this.version = version; + return this; + } + + @java.lang.Override + public AgentV1UpdateSpeakSpeakEndpointProviderDeepgram build() { + return new AgentV1UpdateSpeakSpeakEndpointProviderDeepgram(version, model, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel.java new file mode 100644 index 0000000..166a133 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel.java @@ -0,0 +1,757 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel { + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA_ANGUS_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA_ANGUS_EN, "aura-angus-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2JUPITER_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2JUPITER_EN, "aura-2-jupiter-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2CORA_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2CORA_EN, "aura-2-cora-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA_STELLA_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA_STELLA_EN, "aura-stella-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2HELENA_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2HELENA_EN, "aura-2-helena-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2AQUILA_ES = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2AQUILA_ES, "aura-2-aquila-es"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2ATLAS_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2ATLAS_EN, "aura-2-atlas-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2ORION_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2ORION_EN, "aura-2-orion-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2DRACO_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2DRACO_EN, "aura-2-draco-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2HYPERION_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2HYPERION_EN, "aura-2-hyperion-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2JANUS_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2JANUS_EN, "aura-2-janus-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA_HELIOS_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA_HELIOS_EN, "aura-helios-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2PLUTO_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2PLUTO_EN, "aura-2-pluto-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2ARCAS_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2ARCAS_EN, "aura-2-arcas-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2NESTOR_ES = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2NESTOR_ES, "aura-2-nestor-es"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2NEPTUNE_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2NEPTUNE_EN, "aura-2-neptune-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2MINERVA_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2MINERVA_EN, "aura-2-minerva-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2ALVARO_ES = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2ALVARO_ES, "aura-2-alvaro-es"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA_ATHENA_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA_ATHENA_EN, "aura-athena-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA_PERSEUS_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA_PERSEUS_EN, "aura-perseus-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2ODYSSEUS_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2ODYSSEUS_EN, "aura-2-odysseus-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2PANDORA_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2PANDORA_EN, "aura-2-pandora-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2ZEUS_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2ZEUS_EN, "aura-2-zeus-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2ELECTRA_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2ELECTRA_EN, "aura-2-electra-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2ORPHEUS_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2ORPHEUS_EN, "aura-2-orpheus-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2THALIA_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2THALIA_EN, "aura-2-thalia-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2CELESTE_ES = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2CELESTE_ES, "aura-2-celeste-es"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA_ASTERIA_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA_ASTERIA_EN, "aura-asteria-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2ESTRELLA_ES = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2ESTRELLA_ES, "aura-2-estrella-es"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2HERA_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2HERA_EN, "aura-2-hera-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2MARS_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2MARS_EN, "aura-2-mars-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2SIRIO_ES = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2SIRIO_ES, "aura-2-sirio-es"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2ASTERIA_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2ASTERIA_EN, "aura-2-asteria-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2HERMES_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2HERMES_EN, "aura-2-hermes-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2VESTA_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2VESTA_EN, "aura-2-vesta-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2CARINA_ES = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2CARINA_ES, "aura-2-carina-es"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2CALLISTA_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2CALLISTA_EN, "aura-2-callista-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2HARMONIA_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2HARMONIA_EN, "aura-2-harmonia-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2SELENA_ES = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2SELENA_ES, "aura-2-selena-es"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2AURORA_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2AURORA_EN, "aura-2-aurora-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA_ZEUS_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA_ZEUS_EN, "aura-zeus-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2OPHELIA_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2OPHELIA_EN, "aura-2-ophelia-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2AMALTHEA_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2AMALTHEA_EN, "aura-2-amalthea-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA_ORPHEUS_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA_ORPHEUS_EN, "aura-orpheus-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2DELIA_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2DELIA_EN, "aura-2-delia-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA_LUNA_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA_LUNA_EN, "aura-luna-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2APOLLO_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2APOLLO_EN, "aura-2-apollo-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2SELENE_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2SELENE_EN, "aura-2-selene-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2THEIA_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2THEIA_EN, "aura-2-theia-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA_HERA_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA_HERA_EN, "aura-hera-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2CORDELIA_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2CORDELIA_EN, "aura-2-cordelia-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2ANDROMEDA_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2ANDROMEDA_EN, "aura-2-andromeda-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2ARIES_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2ARIES_EN, "aura-2-aries-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2JUNO_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2JUNO_EN, "aura-2-juno-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2LUNA_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2LUNA_EN, "aura-2-luna-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2DIANA_ES = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2DIANA_ES, "aura-2-diana-es"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2JAVIER_ES = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2JAVIER_ES, "aura-2-javier-es"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA_ORION_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA_ORION_EN, "aura-orion-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA_ARCAS_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA_ARCAS_EN, "aura-arcas-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2IRIS_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2IRIS_EN, "aura-2-iris-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2ATHENA_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2ATHENA_EN, "aura-2-athena-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2SATURN_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2SATURN_EN, "aura-2-saturn-en"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel AURA2PHOEBE_EN = + new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.AURA2PHOEBE_EN, "aura-2-phoebe-en"); + + private final Value value; + + private final String string; + + AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel + && this.string.equals(((AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case AURA_ANGUS_EN: + return visitor.visitAuraAngusEn(); + case AURA2JUPITER_EN: + return visitor.visitAura2JupiterEn(); + case AURA2CORA_EN: + return visitor.visitAura2CoraEn(); + case AURA_STELLA_EN: + return visitor.visitAuraStellaEn(); + case AURA2HELENA_EN: + return visitor.visitAura2HelenaEn(); + case AURA2AQUILA_ES: + return visitor.visitAura2AquilaEs(); + case AURA2ATLAS_EN: + return visitor.visitAura2AtlasEn(); + case AURA2ORION_EN: + return visitor.visitAura2OrionEn(); + case AURA2DRACO_EN: + return visitor.visitAura2DracoEn(); + case AURA2HYPERION_EN: + return visitor.visitAura2HyperionEn(); + case AURA2JANUS_EN: + return visitor.visitAura2JanusEn(); + case AURA_HELIOS_EN: + return visitor.visitAuraHeliosEn(); + case AURA2PLUTO_EN: + return visitor.visitAura2PlutoEn(); + case AURA2ARCAS_EN: + return visitor.visitAura2ArcasEn(); + case AURA2NESTOR_ES: + return visitor.visitAura2NestorEs(); + case AURA2NEPTUNE_EN: + return visitor.visitAura2NeptuneEn(); + case AURA2MINERVA_EN: + return visitor.visitAura2MinervaEn(); + case AURA2ALVARO_ES: + return visitor.visitAura2AlvaroEs(); + case AURA_ATHENA_EN: + return visitor.visitAuraAthenaEn(); + case AURA_PERSEUS_EN: + return visitor.visitAuraPerseusEn(); + case AURA2ODYSSEUS_EN: + return visitor.visitAura2OdysseusEn(); + case AURA2PANDORA_EN: + return visitor.visitAura2PandoraEn(); + case AURA2ZEUS_EN: + return visitor.visitAura2ZeusEn(); + case AURA2ELECTRA_EN: + return visitor.visitAura2ElectraEn(); + case AURA2ORPHEUS_EN: + return visitor.visitAura2OrpheusEn(); + case AURA2THALIA_EN: + return visitor.visitAura2ThaliaEn(); + case AURA2CELESTE_ES: + return visitor.visitAura2CelesteEs(); + case AURA_ASTERIA_EN: + return visitor.visitAuraAsteriaEn(); + case AURA2ESTRELLA_ES: + return visitor.visitAura2EstrellaEs(); + case AURA2HERA_EN: + return visitor.visitAura2HeraEn(); + case AURA2MARS_EN: + return visitor.visitAura2MarsEn(); + case AURA2SIRIO_ES: + return visitor.visitAura2SirioEs(); + case AURA2ASTERIA_EN: + return visitor.visitAura2AsteriaEn(); + case AURA2HERMES_EN: + return visitor.visitAura2HermesEn(); + case AURA2VESTA_EN: + return visitor.visitAura2VestaEn(); + case AURA2CARINA_ES: + return visitor.visitAura2CarinaEs(); + case AURA2CALLISTA_EN: + return visitor.visitAura2CallistaEn(); + case AURA2HARMONIA_EN: + return visitor.visitAura2HarmoniaEn(); + case AURA2SELENA_ES: + return visitor.visitAura2SelenaEs(); + case AURA2AURORA_EN: + return visitor.visitAura2AuroraEn(); + case AURA_ZEUS_EN: + return visitor.visitAuraZeusEn(); + case AURA2OPHELIA_EN: + return visitor.visitAura2OpheliaEn(); + case AURA2AMALTHEA_EN: + return visitor.visitAura2AmaltheaEn(); + case AURA_ORPHEUS_EN: + return visitor.visitAuraOrpheusEn(); + case AURA2DELIA_EN: + return visitor.visitAura2DeliaEn(); + case AURA_LUNA_EN: + return visitor.visitAuraLunaEn(); + case AURA2APOLLO_EN: + return visitor.visitAura2ApolloEn(); + case AURA2SELENE_EN: + return visitor.visitAura2SeleneEn(); + case AURA2THEIA_EN: + return visitor.visitAura2TheiaEn(); + case AURA_HERA_EN: + return visitor.visitAuraHeraEn(); + case AURA2CORDELIA_EN: + return visitor.visitAura2CordeliaEn(); + case AURA2ANDROMEDA_EN: + return visitor.visitAura2AndromedaEn(); + case AURA2ARIES_EN: + return visitor.visitAura2AriesEn(); + case AURA2JUNO_EN: + return visitor.visitAura2JunoEn(); + case AURA2LUNA_EN: + return visitor.visitAura2LunaEn(); + case AURA2DIANA_ES: + return visitor.visitAura2DianaEs(); + case AURA2JAVIER_ES: + return visitor.visitAura2JavierEs(); + case AURA_ORION_EN: + return visitor.visitAuraOrionEn(); + case AURA_ARCAS_EN: + return visitor.visitAuraArcasEn(); + case AURA2IRIS_EN: + return visitor.visitAura2IrisEn(); + case AURA2ATHENA_EN: + return visitor.visitAura2AthenaEn(); + case AURA2SATURN_EN: + return visitor.visitAura2SaturnEn(); + case AURA2PHOEBE_EN: + return visitor.visitAura2PhoebeEn(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel valueOf(String value) { + switch (value) { + case "aura-angus-en": + return AURA_ANGUS_EN; + case "aura-2-jupiter-en": + return AURA2JUPITER_EN; + case "aura-2-cora-en": + return AURA2CORA_EN; + case "aura-stella-en": + return AURA_STELLA_EN; + case "aura-2-helena-en": + return AURA2HELENA_EN; + case "aura-2-aquila-es": + return AURA2AQUILA_ES; + case "aura-2-atlas-en": + return AURA2ATLAS_EN; + case "aura-2-orion-en": + return AURA2ORION_EN; + case "aura-2-draco-en": + return AURA2DRACO_EN; + case "aura-2-hyperion-en": + return AURA2HYPERION_EN; + case "aura-2-janus-en": + return AURA2JANUS_EN; + case "aura-helios-en": + return AURA_HELIOS_EN; + case "aura-2-pluto-en": + return AURA2PLUTO_EN; + case "aura-2-arcas-en": + return AURA2ARCAS_EN; + case "aura-2-nestor-es": + return AURA2NESTOR_ES; + case "aura-2-neptune-en": + return AURA2NEPTUNE_EN; + case "aura-2-minerva-en": + return AURA2MINERVA_EN; + case "aura-2-alvaro-es": + return AURA2ALVARO_ES; + case "aura-athena-en": + return AURA_ATHENA_EN; + case "aura-perseus-en": + return AURA_PERSEUS_EN; + case "aura-2-odysseus-en": + return AURA2ODYSSEUS_EN; + case "aura-2-pandora-en": + return AURA2PANDORA_EN; + case "aura-2-zeus-en": + return AURA2ZEUS_EN; + case "aura-2-electra-en": + return AURA2ELECTRA_EN; + case "aura-2-orpheus-en": + return AURA2ORPHEUS_EN; + case "aura-2-thalia-en": + return AURA2THALIA_EN; + case "aura-2-celeste-es": + return AURA2CELESTE_ES; + case "aura-asteria-en": + return AURA_ASTERIA_EN; + case "aura-2-estrella-es": + return AURA2ESTRELLA_ES; + case "aura-2-hera-en": + return AURA2HERA_EN; + case "aura-2-mars-en": + return AURA2MARS_EN; + case "aura-2-sirio-es": + return AURA2SIRIO_ES; + case "aura-2-asteria-en": + return AURA2ASTERIA_EN; + case "aura-2-hermes-en": + return AURA2HERMES_EN; + case "aura-2-vesta-en": + return AURA2VESTA_EN; + case "aura-2-carina-es": + return AURA2CARINA_ES; + case "aura-2-callista-en": + return AURA2CALLISTA_EN; + case "aura-2-harmonia-en": + return AURA2HARMONIA_EN; + case "aura-2-selena-es": + return AURA2SELENA_ES; + case "aura-2-aurora-en": + return AURA2AURORA_EN; + case "aura-zeus-en": + return AURA_ZEUS_EN; + case "aura-2-ophelia-en": + return AURA2OPHELIA_EN; + case "aura-2-amalthea-en": + return AURA2AMALTHEA_EN; + case "aura-orpheus-en": + return AURA_ORPHEUS_EN; + case "aura-2-delia-en": + return AURA2DELIA_EN; + case "aura-luna-en": + return AURA_LUNA_EN; + case "aura-2-apollo-en": + return AURA2APOLLO_EN; + case "aura-2-selene-en": + return AURA2SELENE_EN; + case "aura-2-theia-en": + return AURA2THEIA_EN; + case "aura-hera-en": + return AURA_HERA_EN; + case "aura-2-cordelia-en": + return AURA2CORDELIA_EN; + case "aura-2-andromeda-en": + return AURA2ANDROMEDA_EN; + case "aura-2-aries-en": + return AURA2ARIES_EN; + case "aura-2-juno-en": + return AURA2JUNO_EN; + case "aura-2-luna-en": + return AURA2LUNA_EN; + case "aura-2-diana-es": + return AURA2DIANA_ES; + case "aura-2-javier-es": + return AURA2JAVIER_ES; + case "aura-orion-en": + return AURA_ORION_EN; + case "aura-arcas-en": + return AURA_ARCAS_EN; + case "aura-2-iris-en": + return AURA2IRIS_EN; + case "aura-2-athena-en": + return AURA2ATHENA_EN; + case "aura-2-saturn-en": + return AURA2SATURN_EN; + case "aura-2-phoebe-en": + return AURA2PHOEBE_EN; + default: + return new AgentV1UpdateSpeakSpeakEndpointProviderDeepgramModel(Value.UNKNOWN, value); + } + } + + public enum Value { + AURA_ASTERIA_EN, + + AURA_LUNA_EN, + + AURA_STELLA_EN, + + AURA_ATHENA_EN, + + AURA_HERA_EN, + + AURA_ORION_EN, + + AURA_ARCAS_EN, + + AURA_PERSEUS_EN, + + AURA_ANGUS_EN, + + AURA_ORPHEUS_EN, + + AURA_HELIOS_EN, + + AURA_ZEUS_EN, + + AURA2AMALTHEA_EN, + + AURA2ANDROMEDA_EN, + + AURA2APOLLO_EN, + + AURA2ARCAS_EN, + + AURA2ARIES_EN, + + AURA2ASTERIA_EN, + + AURA2ATHENA_EN, + + AURA2ATLAS_EN, + + AURA2AURORA_EN, + + AURA2CALLISTA_EN, + + AURA2CORA_EN, + + AURA2CORDELIA_EN, + + AURA2DELIA_EN, + + AURA2DRACO_EN, + + AURA2ELECTRA_EN, + + AURA2HARMONIA_EN, + + AURA2HELENA_EN, + + AURA2HERA_EN, + + AURA2HERMES_EN, + + AURA2HYPERION_EN, + + AURA2IRIS_EN, + + AURA2JANUS_EN, + + AURA2JUNO_EN, + + AURA2JUPITER_EN, + + AURA2LUNA_EN, + + AURA2MARS_EN, + + AURA2MINERVA_EN, + + AURA2NEPTUNE_EN, + + AURA2ODYSSEUS_EN, + + AURA2OPHELIA_EN, + + AURA2ORION_EN, + + AURA2ORPHEUS_EN, + + AURA2PANDORA_EN, + + AURA2PHOEBE_EN, + + AURA2PLUTO_EN, + + AURA2SATURN_EN, + + AURA2SELENE_EN, + + AURA2THALIA_EN, + + AURA2THEIA_EN, + + AURA2VESTA_EN, + + AURA2ZEUS_EN, + + AURA2SIRIO_ES, + + AURA2NESTOR_ES, + + AURA2CARINA_ES, + + AURA2CELESTE_ES, + + AURA2ALVARO_ES, + + AURA2DIANA_ES, + + AURA2AQUILA_ES, + + AURA2SELENA_ES, + + AURA2ESTRELLA_ES, + + AURA2JAVIER_ES, + + UNKNOWN + } + + public interface Visitor { + T visitAuraAsteriaEn(); + + T visitAuraLunaEn(); + + T visitAuraStellaEn(); + + T visitAuraAthenaEn(); + + T visitAuraHeraEn(); + + T visitAuraOrionEn(); + + T visitAuraArcasEn(); + + T visitAuraPerseusEn(); + + T visitAuraAngusEn(); + + T visitAuraOrpheusEn(); + + T visitAuraHeliosEn(); + + T visitAuraZeusEn(); + + T visitAura2AmaltheaEn(); + + T visitAura2AndromedaEn(); + + T visitAura2ApolloEn(); + + T visitAura2ArcasEn(); + + T visitAura2AriesEn(); + + T visitAura2AsteriaEn(); + + T visitAura2AthenaEn(); + + T visitAura2AtlasEn(); + + T visitAura2AuroraEn(); + + T visitAura2CallistaEn(); + + T visitAura2CoraEn(); + + T visitAura2CordeliaEn(); + + T visitAura2DeliaEn(); + + T visitAura2DracoEn(); + + T visitAura2ElectraEn(); + + T visitAura2HarmoniaEn(); + + T visitAura2HelenaEn(); + + T visitAura2HeraEn(); + + T visitAura2HermesEn(); + + T visitAura2HyperionEn(); + + T visitAura2IrisEn(); + + T visitAura2JanusEn(); + + T visitAura2JunoEn(); + + T visitAura2JupiterEn(); + + T visitAura2LunaEn(); + + T visitAura2MarsEn(); + + T visitAura2MinervaEn(); + + T visitAura2NeptuneEn(); + + T visitAura2OdysseusEn(); + + T visitAura2OpheliaEn(); + + T visitAura2OrionEn(); + + T visitAura2OrpheusEn(); + + T visitAura2PandoraEn(); + + T visitAura2PhoebeEn(); + + T visitAura2PlutoEn(); + + T visitAura2SaturnEn(); + + T visitAura2SeleneEn(); + + T visitAura2ThaliaEn(); + + T visitAura2TheiaEn(); + + T visitAura2VestaEn(); + + T visitAura2ZeusEn(); + + T visitAura2SirioEs(); + + T visitAura2NestorEs(); + + T visitAura2CarinaEs(); + + T visitAura2CelesteEs(); + + T visitAura2AlvaroEs(); + + T visitAura2DianaEs(); + + T visitAura2AquilaEs(); + + T visitAura2SelenaEs(); + + T visitAura2EstrellaEs(); + + T visitAura2JavierEs(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProviderElevenLabs.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProviderElevenLabs.java new file mode 100644 index 0000000..442b57a --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProviderElevenLabs.java @@ -0,0 +1,264 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = AgentV1UpdateSpeakSpeakEndpointProviderElevenLabs.Builder.class) +public final class AgentV1UpdateSpeakSpeakEndpointProviderElevenLabs { + private final Optional version; + + private final AgentV1UpdateSpeakSpeakEndpointProviderElevenLabsModelId modelId; + + private final Optional language; + + private final Optional languageCode; + + private final Map additionalProperties; + + private AgentV1UpdateSpeakSpeakEndpointProviderElevenLabs( + Optional version, + AgentV1UpdateSpeakSpeakEndpointProviderElevenLabsModelId modelId, + Optional language, + Optional languageCode, + Map additionalProperties) { + this.version = version; + this.modelId = modelId; + this.language = language; + this.languageCode = languageCode; + this.additionalProperties = additionalProperties; + } + + /** + * @return The REST API version for the ElevenLabs text-to-speech API + */ + @JsonProperty("version") + public Optional getVersion() { + return version; + } + + /** + * @return Eleven Labs model ID + */ + @JsonProperty("model_id") + public AgentV1UpdateSpeakSpeakEndpointProviderElevenLabsModelId getModelId() { + return modelId; + } + + /** + * @return Optional language to use, e.g. 'en-US'. Corresponds to the language_code parameter in the ElevenLabs API + */ + @JsonProperty("language") + public Optional getLanguage() { + return language; + } + + /** + * @return Use the language field instead. + */ + @JsonProperty("language_code") + public Optional getLanguageCode() { + return languageCode; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1UpdateSpeakSpeakEndpointProviderElevenLabs + && equalTo((AgentV1UpdateSpeakSpeakEndpointProviderElevenLabs) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1UpdateSpeakSpeakEndpointProviderElevenLabs other) { + return version.equals(other.version) + && modelId.equals(other.modelId) + && language.equals(other.language) + && languageCode.equals(other.languageCode); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.version, this.modelId, this.language, this.languageCode); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ModelIdStage builder() { + return new Builder(); + } + + public interface ModelIdStage { + /** + *

Eleven Labs model ID

+ */ + _FinalStage modelId(@NotNull AgentV1UpdateSpeakSpeakEndpointProviderElevenLabsModelId modelId); + + Builder from(AgentV1UpdateSpeakSpeakEndpointProviderElevenLabs other); + } + + public interface _FinalStage { + AgentV1UpdateSpeakSpeakEndpointProviderElevenLabs build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The REST API version for the ElevenLabs text-to-speech API

+ */ + _FinalStage version(Optional version); + + _FinalStage version(String version); + + /** + *

Optional language to use, e.g. 'en-US'. Corresponds to the language_code parameter in the ElevenLabs API

+ */ + _FinalStage language(Optional language); + + _FinalStage language(String language); + + /** + *

Use the language field instead.

+ */ + _FinalStage languageCode(Optional languageCode); + + _FinalStage languageCode(String languageCode); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ModelIdStage, _FinalStage { + private AgentV1UpdateSpeakSpeakEndpointProviderElevenLabsModelId modelId; + + private Optional languageCode = Optional.empty(); + + private Optional language = Optional.empty(); + + private Optional version = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentV1UpdateSpeakSpeakEndpointProviderElevenLabs other) { + version(other.getVersion()); + modelId(other.getModelId()); + language(other.getLanguage()); + languageCode(other.getLanguageCode()); + return this; + } + + /** + *

Eleven Labs model ID

+ *

Eleven Labs model ID

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

Use the language field instead.

+ * @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; + } + + /** + *

Use the language field instead.

+ */ + @java.lang.Override + @JsonSetter(value = "language_code", nulls = Nulls.SKIP) + public _FinalStage languageCode(Optional languageCode) { + this.languageCode = languageCode; + return this; + } + + /** + *

Optional language to use, e.g. 'en-US'. Corresponds to the language_code parameter in the ElevenLabs API

+ * @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; + } + + /** + *

Optional language to use, e.g. 'en-US'. Corresponds to the language_code parameter in the ElevenLabs API

+ */ + @java.lang.Override + @JsonSetter(value = "language", nulls = Nulls.SKIP) + public _FinalStage language(Optional language) { + this.language = language; + return this; + } + + /** + *

The REST API version for the ElevenLabs text-to-speech API

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage version(String version) { + this.version = Optional.ofNullable(version); + return this; + } + + /** + *

The REST API version for the ElevenLabs text-to-speech API

+ */ + @java.lang.Override + @JsonSetter(value = "version", nulls = Nulls.SKIP) + public _FinalStage version(Optional version) { + this.version = version; + return this; + } + + @java.lang.Override + public AgentV1UpdateSpeakSpeakEndpointProviderElevenLabs build() { + return new AgentV1UpdateSpeakSpeakEndpointProviderElevenLabs( + version, modelId, language, languageCode, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProviderElevenLabsModelId.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProviderElevenLabsModelId.java new file mode 100644 index 0000000..87aa009 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProviderElevenLabsModelId.java @@ -0,0 +1,100 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AgentV1UpdateSpeakSpeakEndpointProviderElevenLabsModelId { + public static final AgentV1UpdateSpeakSpeakEndpointProviderElevenLabsModelId ELEVEN_TURBO_V25 = + new AgentV1UpdateSpeakSpeakEndpointProviderElevenLabsModelId(Value.ELEVEN_TURBO_V25, "eleven_turbo_v2_5"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderElevenLabsModelId ELEVEN_MONOLINGUAL_V1 = + new AgentV1UpdateSpeakSpeakEndpointProviderElevenLabsModelId( + Value.ELEVEN_MONOLINGUAL_V1, "eleven_monolingual_v1"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderElevenLabsModelId ELEVEN_MULTILINGUAL_V2 = + new AgentV1UpdateSpeakSpeakEndpointProviderElevenLabsModelId( + Value.ELEVEN_MULTILINGUAL_V2, "eleven_multilingual_v2"); + + private final Value value; + + private final String string; + + AgentV1UpdateSpeakSpeakEndpointProviderElevenLabsModelId(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AgentV1UpdateSpeakSpeakEndpointProviderElevenLabsModelId + && this.string.equals( + ((AgentV1UpdateSpeakSpeakEndpointProviderElevenLabsModelId) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ELEVEN_TURBO_V25: + return visitor.visitElevenTurboV25(); + case ELEVEN_MONOLINGUAL_V1: + return visitor.visitElevenMonolingualV1(); + case ELEVEN_MULTILINGUAL_V2: + return visitor.visitElevenMultilingualV2(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AgentV1UpdateSpeakSpeakEndpointProviderElevenLabsModelId valueOf(String value) { + switch (value) { + case "eleven_turbo_v2_5": + return ELEVEN_TURBO_V25; + case "eleven_monolingual_v1": + return ELEVEN_MONOLINGUAL_V1; + case "eleven_multilingual_v2": + return ELEVEN_MULTILINGUAL_V2; + default: + return new AgentV1UpdateSpeakSpeakEndpointProviderElevenLabsModelId(Value.UNKNOWN, value); + } + } + + public enum Value { + ELEVEN_TURBO_V25, + + ELEVEN_MONOLINGUAL_V1, + + ELEVEN_MULTILINGUAL_V2, + + UNKNOWN + } + + public interface Visitor { + T visitElevenTurboV25(); + + T visitElevenMonolingualV1(); + + T visitElevenMultilingualV2(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProviderOpenAi.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProviderOpenAi.java new file mode 100644 index 0000000..7782900 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProviderOpenAi.java @@ -0,0 +1,210 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = AgentV1UpdateSpeakSpeakEndpointProviderOpenAi.Builder.class) +public final class AgentV1UpdateSpeakSpeakEndpointProviderOpenAi { + private final Optional version; + + private final AgentV1UpdateSpeakSpeakEndpointProviderOpenAiModel model; + + private final AgentV1UpdateSpeakSpeakEndpointProviderOpenAiVoice voice; + + private final Map additionalProperties; + + private AgentV1UpdateSpeakSpeakEndpointProviderOpenAi( + Optional version, + AgentV1UpdateSpeakSpeakEndpointProviderOpenAiModel model, + AgentV1UpdateSpeakSpeakEndpointProviderOpenAiVoice voice, + Map additionalProperties) { + this.version = version; + this.model = model; + this.voice = voice; + this.additionalProperties = additionalProperties; + } + + /** + * @return The REST API version for the OpenAI text-to-speech API + */ + @JsonProperty("version") + public Optional getVersion() { + return version; + } + + /** + * @return OpenAI TTS model + */ + @JsonProperty("model") + public AgentV1UpdateSpeakSpeakEndpointProviderOpenAiModel getModel() { + return model; + } + + /** + * @return OpenAI voice + */ + @JsonProperty("voice") + public AgentV1UpdateSpeakSpeakEndpointProviderOpenAiVoice getVoice() { + return voice; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1UpdateSpeakSpeakEndpointProviderOpenAi + && equalTo((AgentV1UpdateSpeakSpeakEndpointProviderOpenAi) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1UpdateSpeakSpeakEndpointProviderOpenAi other) { + return version.equals(other.version) && model.equals(other.model) && voice.equals(other.voice); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.version, this.model, this.voice); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ModelStage builder() { + return new Builder(); + } + + public interface ModelStage { + /** + *

OpenAI TTS model

+ */ + VoiceStage model(@NotNull AgentV1UpdateSpeakSpeakEndpointProviderOpenAiModel model); + + Builder from(AgentV1UpdateSpeakSpeakEndpointProviderOpenAi other); + } + + public interface VoiceStage { + /** + *

OpenAI voice

+ */ + _FinalStage voice(@NotNull AgentV1UpdateSpeakSpeakEndpointProviderOpenAiVoice voice); + } + + public interface _FinalStage { + AgentV1UpdateSpeakSpeakEndpointProviderOpenAi build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The REST API version for the OpenAI text-to-speech API

+ */ + _FinalStage version(Optional version); + + _FinalStage version(String version); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ModelStage, VoiceStage, _FinalStage { + private AgentV1UpdateSpeakSpeakEndpointProviderOpenAiModel model; + + private AgentV1UpdateSpeakSpeakEndpointProviderOpenAiVoice voice; + + private Optional version = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentV1UpdateSpeakSpeakEndpointProviderOpenAi other) { + version(other.getVersion()); + model(other.getModel()); + voice(other.getVoice()); + return this; + } + + /** + *

OpenAI TTS model

+ *

OpenAI TTS model

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

OpenAI voice

+ *

OpenAI voice

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

The REST API version for the OpenAI text-to-speech API

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage version(String version) { + this.version = Optional.ofNullable(version); + return this; + } + + /** + *

The REST API version for the OpenAI text-to-speech API

+ */ + @java.lang.Override + @JsonSetter(value = "version", nulls = Nulls.SKIP) + public _FinalStage version(Optional version) { + this.version = version; + return this; + } + + @java.lang.Override + public AgentV1UpdateSpeakSpeakEndpointProviderOpenAi build() { + return new AgentV1UpdateSpeakSpeakEndpointProviderOpenAi(version, model, voice, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProviderOpenAiModel.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProviderOpenAiModel.java new file mode 100644 index 0000000..890ac90 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProviderOpenAiModel.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AgentV1UpdateSpeakSpeakEndpointProviderOpenAiModel { + public static final AgentV1UpdateSpeakSpeakEndpointProviderOpenAiModel TTS1HD = + new AgentV1UpdateSpeakSpeakEndpointProviderOpenAiModel(Value.TTS1HD, "tts-1-hd"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderOpenAiModel TTS1 = + new AgentV1UpdateSpeakSpeakEndpointProviderOpenAiModel(Value.TTS1, "tts-1"); + + private final Value value; + + private final String string; + + AgentV1UpdateSpeakSpeakEndpointProviderOpenAiModel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AgentV1UpdateSpeakSpeakEndpointProviderOpenAiModel + && this.string.equals(((AgentV1UpdateSpeakSpeakEndpointProviderOpenAiModel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case TTS1HD: + return visitor.visitTts1Hd(); + case TTS1: + return visitor.visitTts1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AgentV1UpdateSpeakSpeakEndpointProviderOpenAiModel valueOf(String value) { + switch (value) { + case "tts-1-hd": + return TTS1HD; + case "tts-1": + return TTS1; + default: + return new AgentV1UpdateSpeakSpeakEndpointProviderOpenAiModel(Value.UNKNOWN, value); + } + } + + public enum Value { + TTS1, + + TTS1HD, + + UNKNOWN + } + + public interface Visitor { + T visitTts1(); + + T visitTts1Hd(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProviderOpenAiVoice.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProviderOpenAiVoice.java new file mode 100644 index 0000000..300da31 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakEndpointProviderOpenAiVoice.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AgentV1UpdateSpeakSpeakEndpointProviderOpenAiVoice { + public static final AgentV1UpdateSpeakSpeakEndpointProviderOpenAiVoice SHIMMER = + new AgentV1UpdateSpeakSpeakEndpointProviderOpenAiVoice(Value.SHIMMER, "shimmer"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderOpenAiVoice FABLE = + new AgentV1UpdateSpeakSpeakEndpointProviderOpenAiVoice(Value.FABLE, "fable"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderOpenAiVoice ALLOY = + new AgentV1UpdateSpeakSpeakEndpointProviderOpenAiVoice(Value.ALLOY, "alloy"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderOpenAiVoice ONYX = + new AgentV1UpdateSpeakSpeakEndpointProviderOpenAiVoice(Value.ONYX, "onyx"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderOpenAiVoice NOVA = + new AgentV1UpdateSpeakSpeakEndpointProviderOpenAiVoice(Value.NOVA, "nova"); + + public static final AgentV1UpdateSpeakSpeakEndpointProviderOpenAiVoice ECHO = + new AgentV1UpdateSpeakSpeakEndpointProviderOpenAiVoice(Value.ECHO, "echo"); + + private final Value value; + + private final String string; + + AgentV1UpdateSpeakSpeakEndpointProviderOpenAiVoice(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AgentV1UpdateSpeakSpeakEndpointProviderOpenAiVoice + && this.string.equals(((AgentV1UpdateSpeakSpeakEndpointProviderOpenAiVoice) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SHIMMER: + return visitor.visitShimmer(); + case FABLE: + return visitor.visitFable(); + case ALLOY: + return visitor.visitAlloy(); + case ONYX: + return visitor.visitOnyx(); + case NOVA: + return visitor.visitNova(); + case ECHO: + return visitor.visitEcho(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AgentV1UpdateSpeakSpeakEndpointProviderOpenAiVoice valueOf(String value) { + switch (value) { + case "shimmer": + return SHIMMER; + case "fable": + return FABLE; + case "alloy": + return ALLOY; + case "onyx": + return ONYX; + case "nova": + return NOVA; + case "echo": + return ECHO; + default: + return new AgentV1UpdateSpeakSpeakEndpointProviderOpenAiVoice(Value.UNKNOWN, value); + } + } + + public enum Value { + ALLOY, + + ECHO, + + FABLE, + + ONYX, + + NOVA, + + SHIMMER, + + UNKNOWN + } + + public interface Visitor { + T visitAlloy(); + + T visitEcho(); + + T visitFable(); + + T visitOnyx(); + + T visitNova(); + + T visitShimmer(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItem.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItem.java new file mode 100644 index 0000000..40d5ae4 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItem.java @@ -0,0 +1,168 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = AgentV1UpdateSpeakSpeakOneItem.Builder.class) +public final class AgentV1UpdateSpeakSpeakOneItem { + private final AgentV1UpdateSpeakSpeakOneItemProvider provider; + + private final Optional endpoint; + + private final Map additionalProperties; + + private AgentV1UpdateSpeakSpeakOneItem( + AgentV1UpdateSpeakSpeakOneItemProvider provider, + Optional endpoint, + Map additionalProperties) { + this.provider = provider; + this.endpoint = endpoint; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public AgentV1UpdateSpeakSpeakOneItemProvider getProvider() { + return provider; + } + + /** + * @return Optional if provider is Deepgram. Required for non-Deepgram TTS providers. + * When present, must include url field and headers object. Valid schemes are https and wss with wss only supported for Eleven Labs. + */ + @JsonProperty("endpoint") + public Optional getEndpoint() { + return endpoint; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1UpdateSpeakSpeakOneItem && equalTo((AgentV1UpdateSpeakSpeakOneItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1UpdateSpeakSpeakOneItem other) { + return provider.equals(other.provider) && endpoint.equals(other.endpoint); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.provider, this.endpoint); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ProviderStage builder() { + return new Builder(); + } + + public interface ProviderStage { + _FinalStage provider(@NotNull AgentV1UpdateSpeakSpeakOneItemProvider provider); + + Builder from(AgentV1UpdateSpeakSpeakOneItem other); + } + + public interface _FinalStage { + AgentV1UpdateSpeakSpeakOneItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Optional if provider is Deepgram. Required for non-Deepgram TTS providers. + * When present, must include url field and headers object. Valid schemes are https and wss with wss only supported for Eleven Labs.

+ */ + _FinalStage endpoint(Optional endpoint); + + _FinalStage endpoint(AgentV1UpdateSpeakSpeakOneItemEndpoint endpoint); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ProviderStage, _FinalStage { + private AgentV1UpdateSpeakSpeakOneItemProvider provider; + + private Optional endpoint = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentV1UpdateSpeakSpeakOneItem other) { + provider(other.getProvider()); + endpoint(other.getEndpoint()); + return this; + } + + @java.lang.Override + @JsonSetter("provider") + public _FinalStage provider(@NotNull AgentV1UpdateSpeakSpeakOneItemProvider provider) { + this.provider = Objects.requireNonNull(provider, "provider must not be null"); + return this; + } + + /** + *

Optional if provider is Deepgram. Required for non-Deepgram TTS providers. + * When present, must include url field and headers object. Valid schemes are https and wss with wss only supported for Eleven Labs.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage endpoint(AgentV1UpdateSpeakSpeakOneItemEndpoint endpoint) { + this.endpoint = Optional.ofNullable(endpoint); + return this; + } + + /** + *

Optional if provider is Deepgram. Required for non-Deepgram TTS providers. + * When present, must include url field and headers object. Valid schemes are https and wss with wss only supported for Eleven Labs.

+ */ + @java.lang.Override + @JsonSetter(value = "endpoint", nulls = Nulls.SKIP) + public _FinalStage endpoint(Optional endpoint) { + this.endpoint = endpoint; + return this; + } + + @java.lang.Override + public AgentV1UpdateSpeakSpeakOneItem build() { + return new AgentV1UpdateSpeakSpeakOneItem(provider, endpoint, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemEndpoint.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemEndpoint.java new file mode 100644 index 0000000..5af2ddd --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemEndpoint.java @@ -0,0 +1,135 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AgentV1UpdateSpeakSpeakOneItemEndpoint.Builder.class) +public final class AgentV1UpdateSpeakSpeakOneItemEndpoint { + private final Optional url; + + private final Optional> headers; + + private final Map additionalProperties; + + private AgentV1UpdateSpeakSpeakOneItemEndpoint( + Optional url, Optional> headers, Map additionalProperties) { + this.url = url; + this.headers = headers; + this.additionalProperties = additionalProperties; + } + + /** + * @return Custom TTS endpoint URL. Cannot contain output_format or model_id query parameters when the provider is Eleven Labs. + */ + @JsonProperty("url") + public Optional getUrl() { + return url; + } + + @JsonProperty("headers") + public Optional> getHeaders() { + return headers; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1UpdateSpeakSpeakOneItemEndpoint + && equalTo((AgentV1UpdateSpeakSpeakOneItemEndpoint) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1UpdateSpeakSpeakOneItemEndpoint other) { + return url.equals(other.url) && headers.equals(other.headers); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.url, this.headers); + } + + @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 url = Optional.empty(); + + private Optional> headers = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AgentV1UpdateSpeakSpeakOneItemEndpoint other) { + url(other.getUrl()); + headers(other.getHeaders()); + return this; + } + + /** + *

Custom TTS endpoint URL. Cannot contain output_format or model_id query parameters when the provider is Eleven Labs.

+ */ + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public Builder url(Optional url) { + this.url = url; + return this; + } + + public Builder url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + @JsonSetter(value = "headers", nulls = Nulls.SKIP) + public Builder headers(Optional> headers) { + this.headers = headers; + return this; + } + + public Builder headers(Map headers) { + this.headers = Optional.ofNullable(headers); + return this; + } + + public AgentV1UpdateSpeakSpeakOneItemEndpoint build() { + return new AgentV1UpdateSpeakSpeakOneItemEndpoint(url, headers, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProvider.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProvider.java new file mode 100644 index 0000000..c208bd5 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProvider.java @@ -0,0 +1,403 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.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 AgentV1UpdateSpeakSpeakOneItemProvider { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private AgentV1UpdateSpeakSpeakOneItemProvider(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static AgentV1UpdateSpeakSpeakOneItemProvider deepgram( + AgentV1UpdateSpeakSpeakOneItemProviderDeepgram value) { + return new AgentV1UpdateSpeakSpeakOneItemProvider(new DeepgramValue(value)); + } + + public static AgentV1UpdateSpeakSpeakOneItemProvider elevenLabs( + AgentV1UpdateSpeakSpeakOneItemProviderElevenLabs value) { + return new AgentV1UpdateSpeakSpeakOneItemProvider(new ElevenLabsValue(value)); + } + + public static AgentV1UpdateSpeakSpeakOneItemProvider cartesia( + AgentV1UpdateSpeakSpeakOneItemProviderCartesia value) { + return new AgentV1UpdateSpeakSpeakOneItemProvider(new CartesiaValue(value)); + } + + public static AgentV1UpdateSpeakSpeakOneItemProvider openAi(AgentV1UpdateSpeakSpeakOneItemProviderOpenAi value) { + return new AgentV1UpdateSpeakSpeakOneItemProvider(new OpenAiValue(value)); + } + + public static AgentV1UpdateSpeakSpeakOneItemProvider awsPolly( + AgentV1UpdateSpeakSpeakOneItemProviderAwsPolly value) { + return new AgentV1UpdateSpeakSpeakOneItemProvider(new AwsPollyValue(value)); + } + + public boolean isDeepgram() { + return value instanceof DeepgramValue; + } + + public boolean isElevenLabs() { + return value instanceof ElevenLabsValue; + } + + public boolean isCartesia() { + return value instanceof CartesiaValue; + } + + public boolean isOpenAi() { + return value instanceof OpenAiValue; + } + + public boolean isAwsPolly() { + return value instanceof AwsPollyValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getDeepgram() { + if (isDeepgram()) { + return Optional.of(((DeepgramValue) value).value); + } + return Optional.empty(); + } + + public Optional getElevenLabs() { + if (isElevenLabs()) { + return Optional.of(((ElevenLabsValue) value).value); + } + return Optional.empty(); + } + + public Optional getCartesia() { + if (isCartesia()) { + return Optional.of(((CartesiaValue) value).value); + } + return Optional.empty(); + } + + public Optional getOpenAi() { + if (isOpenAi()) { + return Optional.of(((OpenAiValue) value).value); + } + return Optional.empty(); + } + + public Optional getAwsPolly() { + if (isAwsPolly()) { + return Optional.of(((AwsPollyValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1UpdateSpeakSpeakOneItemProvider + && value.equals(((AgentV1UpdateSpeakSpeakOneItemProvider) other).value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + return value.toString(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitDeepgram(AgentV1UpdateSpeakSpeakOneItemProviderDeepgram deepgram); + + T visitElevenLabs(AgentV1UpdateSpeakSpeakOneItemProviderElevenLabs elevenLabs); + + T visitCartesia(AgentV1UpdateSpeakSpeakOneItemProviderCartesia cartesia); + + T visitOpenAi(AgentV1UpdateSpeakSpeakOneItemProviderOpenAi openAi); + + T visitAwsPolly(AgentV1UpdateSpeakSpeakOneItemProviderAwsPolly awsPolly); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(DeepgramValue.class), + @JsonSubTypes.Type(ElevenLabsValue.class), + @JsonSubTypes.Type(CartesiaValue.class), + @JsonSubTypes.Type(OpenAiValue.class), + @JsonSubTypes.Type(AwsPollyValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("deepgram") + @JsonIgnoreProperties("type") + private static final class DeepgramValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "type", allowSetters = true) + private AgentV1UpdateSpeakSpeakOneItemProviderDeepgram value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private DeepgramValue() {} + + private DeepgramValue(AgentV1UpdateSpeakSpeakOneItemProviderDeepgram 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 "AgentV1UpdateSpeakSpeakOneItemProvider{" + "value: " + value + "}"; + } + } + + @JsonTypeName("eleven_labs") + @JsonIgnoreProperties("type") + private static final class ElevenLabsValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "type", allowSetters = true) + private AgentV1UpdateSpeakSpeakOneItemProviderElevenLabs value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ElevenLabsValue() {} + + private ElevenLabsValue(AgentV1UpdateSpeakSpeakOneItemProviderElevenLabs value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitElevenLabs(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ElevenLabsValue && equalTo((ElevenLabsValue) other); + } + + private boolean equalTo(ElevenLabsValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AgentV1UpdateSpeakSpeakOneItemProvider{" + "value: " + value + "}"; + } + } + + @JsonTypeName("cartesia") + @JsonIgnoreProperties("type") + private static final class CartesiaValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "type", allowSetters = true) + private AgentV1UpdateSpeakSpeakOneItemProviderCartesia value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private CartesiaValue() {} + + private CartesiaValue(AgentV1UpdateSpeakSpeakOneItemProviderCartesia 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 "AgentV1UpdateSpeakSpeakOneItemProvider{" + "value: " + value + "}"; + } + } + + @JsonTypeName("open_ai") + @JsonIgnoreProperties("type") + private static final class OpenAiValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "type", allowSetters = true) + private AgentV1UpdateSpeakSpeakOneItemProviderOpenAi value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private OpenAiValue() {} + + private OpenAiValue(AgentV1UpdateSpeakSpeakOneItemProviderOpenAi 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 "AgentV1UpdateSpeakSpeakOneItemProvider{" + "value: " + value + "}"; + } + } + + @JsonTypeName("aws_polly") + @JsonIgnoreProperties("type") + private static final class AwsPollyValue implements Value { + @JsonUnwrapped + @JsonIgnoreProperties(value = "type", allowSetters = true) + private AgentV1UpdateSpeakSpeakOneItemProviderAwsPolly value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private AwsPollyValue() {} + + private AwsPollyValue(AgentV1UpdateSpeakSpeakOneItemProviderAwsPolly value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitAwsPolly(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AwsPollyValue && equalTo((AwsPollyValue) other); + } + + private boolean equalTo(AwsPollyValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AgentV1UpdateSpeakSpeakOneItemProvider{" + "value: " + value + "}"; + } + } + + @JsonIgnoreProperties("type") + 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 "AgentV1UpdateSpeakSpeakOneItemProvider{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProviderAwsPolly.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProviderAwsPolly.java new file mode 100644 index 0000000..b11159a --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProviderAwsPolly.java @@ -0,0 +1,261 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = AgentV1UpdateSpeakSpeakOneItemProviderAwsPolly.Builder.class) +public final class AgentV1UpdateSpeakSpeakOneItemProviderAwsPolly { + private final AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyVoice voice; + + private final String language; + + private final Optional languageCode; + + private final AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyEngine engine; + + private final AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyCredentials credentials; + + private final Map additionalProperties; + + private AgentV1UpdateSpeakSpeakOneItemProviderAwsPolly( + AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyVoice voice, + String language, + Optional languageCode, + AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyEngine engine, + AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyCredentials credentials, + Map additionalProperties) { + this.voice = voice; + this.language = language; + this.languageCode = languageCode; + this.engine = engine; + this.credentials = credentials; + this.additionalProperties = additionalProperties; + } + + /** + * @return AWS Polly voice name + */ + @JsonProperty("voice") + public AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyVoice getVoice() { + return voice; + } + + /** + * @return Language code to use, e.g. 'en-US'. Corresponds to the language_code parameter in the AWS Polly API + */ + @JsonProperty("language") + public String getLanguage() { + return language; + } + + /** + * @return Use the language field instead. + */ + @JsonProperty("language_code") + public Optional getLanguageCode() { + return languageCode; + } + + @JsonProperty("engine") + public AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyEngine getEngine() { + return engine; + } + + @JsonProperty("credentials") + public AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyCredentials getCredentials() { + return credentials; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1UpdateSpeakSpeakOneItemProviderAwsPolly + && equalTo((AgentV1UpdateSpeakSpeakOneItemProviderAwsPolly) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1UpdateSpeakSpeakOneItemProviderAwsPolly other) { + return voice.equals(other.voice) + && language.equals(other.language) + && languageCode.equals(other.languageCode) + && engine.equals(other.engine) + && credentials.equals(other.credentials); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.voice, this.language, this.languageCode, this.engine, this.credentials); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static VoiceStage builder() { + return new Builder(); + } + + public interface VoiceStage { + /** + *

AWS Polly voice name

+ */ + LanguageStage voice(@NotNull AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyVoice voice); + + Builder from(AgentV1UpdateSpeakSpeakOneItemProviderAwsPolly other); + } + + public interface LanguageStage { + /** + *

Language code to use, e.g. 'en-US'. Corresponds to the language_code parameter in the AWS Polly API

+ */ + EngineStage language(@NotNull String language); + } + + public interface EngineStage { + CredentialsStage engine(@NotNull AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyEngine engine); + } + + public interface CredentialsStage { + _FinalStage credentials(@NotNull AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyCredentials credentials); + } + + public interface _FinalStage { + AgentV1UpdateSpeakSpeakOneItemProviderAwsPolly build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Use the language field instead.

+ */ + _FinalStage languageCode(Optional languageCode); + + _FinalStage languageCode(String languageCode); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements VoiceStage, LanguageStage, EngineStage, CredentialsStage, _FinalStage { + private AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyVoice voice; + + private String language; + + private AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyEngine engine; + + private AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyCredentials credentials; + + private Optional languageCode = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentV1UpdateSpeakSpeakOneItemProviderAwsPolly other) { + voice(other.getVoice()); + language(other.getLanguage()); + languageCode(other.getLanguageCode()); + engine(other.getEngine()); + credentials(other.getCredentials()); + return this; + } + + /** + *

AWS Polly voice name

+ *

AWS Polly voice name

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

Language code to use, e.g. 'en-US'. Corresponds to the language_code parameter in the AWS Polly API

+ *

Language code to use, e.g. 'en-US'. Corresponds to the language_code parameter in the AWS Polly API

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

Use the language field instead.

+ * @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; + } + + /** + *

Use the language field instead.

+ */ + @java.lang.Override + @JsonSetter(value = "language_code", nulls = Nulls.SKIP) + public _FinalStage languageCode(Optional languageCode) { + this.languageCode = languageCode; + return this; + } + + @java.lang.Override + public AgentV1UpdateSpeakSpeakOneItemProviderAwsPolly build() { + return new AgentV1UpdateSpeakSpeakOneItemProviderAwsPolly( + voice, language, languageCode, engine, credentials, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyCredentials.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyCredentials.java new file mode 100644 index 0000000..3437a9c --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyCredentials.java @@ -0,0 +1,240 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyCredentials.Builder.class) +public final class AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyCredentials { + private final AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyCredentialsType type; + + private final String region; + + private final String accessKeyId; + + private final String secretAccessKey; + + private final Optional sessionToken; + + private final Map additionalProperties; + + private AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyCredentials( + AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyCredentialsType type, + String region, + String accessKeyId, + String secretAccessKey, + Optional sessionToken, + Map additionalProperties) { + this.type = type; + this.region = region; + this.accessKeyId = accessKeyId; + this.secretAccessKey = secretAccessKey; + this.sessionToken = sessionToken; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("type") + public AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyCredentialsType getType() { + return type; + } + + @JsonProperty("region") + public String getRegion() { + return region; + } + + @JsonProperty("access_key_id") + public String getAccessKeyId() { + return accessKeyId; + } + + @JsonProperty("secret_access_key") + public String getSecretAccessKey() { + return secretAccessKey; + } + + /** + * @return Required for STS only + */ + @JsonProperty("session_token") + public Optional getSessionToken() { + return sessionToken; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyCredentials + && equalTo((AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyCredentials) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyCredentials other) { + return type.equals(other.type) + && region.equals(other.region) + && accessKeyId.equals(other.accessKeyId) + && secretAccessKey.equals(other.secretAccessKey) + && sessionToken.equals(other.sessionToken); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.region, this.accessKeyId, this.secretAccessKey, this.sessionToken); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TypeStage builder() { + return new Builder(); + } + + public interface TypeStage { + RegionStage type(@NotNull AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyCredentialsType type); + + Builder from(AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyCredentials other); + } + + public interface RegionStage { + AccessKeyIdStage region(@NotNull String region); + } + + public interface AccessKeyIdStage { + SecretAccessKeyStage accessKeyId(@NotNull String accessKeyId); + } + + public interface SecretAccessKeyStage { + _FinalStage secretAccessKey(@NotNull String secretAccessKey); + } + + public interface _FinalStage { + AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyCredentials build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Required for STS only

+ */ + _FinalStage sessionToken(Optional sessionToken); + + _FinalStage sessionToken(String sessionToken); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements TypeStage, RegionStage, AccessKeyIdStage, SecretAccessKeyStage, _FinalStage { + private AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyCredentialsType type; + + private String region; + + private String accessKeyId; + + private String secretAccessKey; + + private Optional sessionToken = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyCredentials other) { + type(other.getType()); + region(other.getRegion()); + accessKeyId(other.getAccessKeyId()); + secretAccessKey(other.getSecretAccessKey()); + sessionToken(other.getSessionToken()); + return this; + } + + @java.lang.Override + @JsonSetter("type") + public RegionStage type(@NotNull AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyCredentialsType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("region") + public AccessKeyIdStage region(@NotNull String region) { + this.region = Objects.requireNonNull(region, "region must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("access_key_id") + public SecretAccessKeyStage accessKeyId(@NotNull String accessKeyId) { + this.accessKeyId = Objects.requireNonNull(accessKeyId, "accessKeyId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("secret_access_key") + public _FinalStage secretAccessKey(@NotNull String secretAccessKey) { + this.secretAccessKey = Objects.requireNonNull(secretAccessKey, "secretAccessKey must not be null"); + return this; + } + + /** + *

Required for STS only

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sessionToken(String sessionToken) { + this.sessionToken = Optional.ofNullable(sessionToken); + return this; + } + + /** + *

Required for STS only

+ */ + @java.lang.Override + @JsonSetter(value = "session_token", nulls = Nulls.SKIP) + public _FinalStage sessionToken(Optional sessionToken) { + this.sessionToken = sessionToken; + return this; + } + + @java.lang.Override + public AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyCredentials build() { + return new AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyCredentials( + type, region, accessKeyId, secretAccessKey, sessionToken, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyCredentialsType.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyCredentialsType.java new file mode 100644 index 0000000..89ae0b0 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyCredentialsType.java @@ -0,0 +1,87 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyCredentialsType { + public static final AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyCredentialsType IAM = + new AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyCredentialsType(Value.IAM, "iam"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyCredentialsType STS = + new AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyCredentialsType(Value.STS, "sts"); + + private final Value value; + + private final String string; + + AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyCredentialsType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyCredentialsType + && this.string.equals( + ((AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyCredentialsType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case IAM: + return visitor.visitIam(); + case STS: + return visitor.visitSts(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyCredentialsType valueOf(String value) { + switch (value) { + case "iam": + return IAM; + case "sts": + return STS; + default: + return new AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyCredentialsType(Value.UNKNOWN, value); + } + } + + public enum Value { + STS, + + IAM, + + UNKNOWN + } + + public interface Visitor { + T visitSts(); + + T visitIam(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyEngine.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyEngine.java new file mode 100644 index 0000000..8ac142f --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyEngine.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyEngine { + public static final AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyEngine LONG_FORM = + new AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyEngine(Value.LONG_FORM, "long-form"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyEngine STANDARD = + new AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyEngine(Value.STANDARD, "standard"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyEngine GENERATIVE = + new AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyEngine(Value.GENERATIVE, "generative"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyEngine NEURAL = + new AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyEngine(Value.NEURAL, "neural"); + + private final Value value; + + private final String string; + + AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyEngine(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyEngine + && this.string.equals(((AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyEngine) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case LONG_FORM: + return visitor.visitLongForm(); + case STANDARD: + return visitor.visitStandard(); + case GENERATIVE: + return visitor.visitGenerative(); + case NEURAL: + return visitor.visitNeural(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyEngine valueOf(String value) { + switch (value) { + case "long-form": + return LONG_FORM; + case "standard": + return STANDARD; + case "generative": + return GENERATIVE; + case "neural": + return NEURAL; + default: + return new AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyEngine(Value.UNKNOWN, value); + } + } + + public enum Value { + GENERATIVE, + + LONG_FORM, + + STANDARD, + + NEURAL, + + UNKNOWN + } + + public interface Visitor { + T visitGenerative(); + + T visitLongForm(); + + T visitStandard(); + + T visitNeural(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyVoice.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyVoice.java new file mode 100644 index 0000000..9768429 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyVoice.java @@ -0,0 +1,152 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyVoice { + public static final AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyVoice ARTHUR = + new AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyVoice(Value.ARTHUR, "Arthur"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyVoice JOANNA = + new AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyVoice(Value.JOANNA, "Joanna"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyVoice BRIAN = + new AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyVoice(Value.BRIAN, "Brian"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyVoice AMY = + new AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyVoice(Value.AMY, "Amy"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyVoice EMMA = + new AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyVoice(Value.EMMA, "Emma"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyVoice MATTHEW = + new AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyVoice(Value.MATTHEW, "Matthew"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyVoice ARIA = + new AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyVoice(Value.ARIA, "Aria"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyVoice AYANDA = + new AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyVoice(Value.AYANDA, "Ayanda"); + + private final Value value; + + private final String string; + + AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyVoice(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyVoice + && this.string.equals(((AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyVoice) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ARTHUR: + return visitor.visitArthur(); + case JOANNA: + return visitor.visitJoanna(); + case BRIAN: + return visitor.visitBrian(); + case AMY: + return visitor.visitAmy(); + case EMMA: + return visitor.visitEmma(); + case MATTHEW: + return visitor.visitMatthew(); + case ARIA: + return visitor.visitAria(); + case AYANDA: + return visitor.visitAyanda(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyVoice valueOf(String value) { + switch (value) { + case "Arthur": + return ARTHUR; + case "Joanna": + return JOANNA; + case "Brian": + return BRIAN; + case "Amy": + return AMY; + case "Emma": + return EMMA; + case "Matthew": + return MATTHEW; + case "Aria": + return ARIA; + case "Ayanda": + return AYANDA; + default: + return new AgentV1UpdateSpeakSpeakOneItemProviderAwsPollyVoice(Value.UNKNOWN, value); + } + } + + public enum Value { + MATTHEW, + + JOANNA, + + AMY, + + EMMA, + + BRIAN, + + ARTHUR, + + ARIA, + + AYANDA, + + UNKNOWN + } + + public interface Visitor { + T visitMatthew(); + + T visitJoanna(); + + T visitAmy(); + + T visitEmma(); + + T visitBrian(); + + T visitArthur(); + + T visitAria(); + + T visitAyanda(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProviderCartesia.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProviderCartesia.java new file mode 100644 index 0000000..c4509cb --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProviderCartesia.java @@ -0,0 +1,245 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = AgentV1UpdateSpeakSpeakOneItemProviderCartesia.Builder.class) +public final class AgentV1UpdateSpeakSpeakOneItemProviderCartesia { + private final Optional version; + + private final AgentV1UpdateSpeakSpeakOneItemProviderCartesiaModelId modelId; + + private final AgentV1UpdateSpeakSpeakOneItemProviderCartesiaVoice voice; + + private final Optional language; + + private final Map additionalProperties; + + private AgentV1UpdateSpeakSpeakOneItemProviderCartesia( + Optional version, + AgentV1UpdateSpeakSpeakOneItemProviderCartesiaModelId modelId, + AgentV1UpdateSpeakSpeakOneItemProviderCartesiaVoice voice, + Optional language, + Map additionalProperties) { + this.version = version; + this.modelId = modelId; + this.voice = voice; + this.language = language; + this.additionalProperties = additionalProperties; + } + + /** + * @return The API version header for the Cartesia text-to-speech API + */ + @JsonProperty("version") + public Optional getVersion() { + return version; + } + + /** + * @return Cartesia model ID + */ + @JsonProperty("model_id") + public AgentV1UpdateSpeakSpeakOneItemProviderCartesiaModelId getModelId() { + return modelId; + } + + @JsonProperty("voice") + public AgentV1UpdateSpeakSpeakOneItemProviderCartesiaVoice getVoice() { + return voice; + } + + /** + * @return Cartesia language code + */ + @JsonProperty("language") + public Optional getLanguage() { + return language; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1UpdateSpeakSpeakOneItemProviderCartesia + && equalTo((AgentV1UpdateSpeakSpeakOneItemProviderCartesia) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1UpdateSpeakSpeakOneItemProviderCartesia other) { + return version.equals(other.version) + && modelId.equals(other.modelId) + && voice.equals(other.voice) + && language.equals(other.language); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.version, this.modelId, this.voice, this.language); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ModelIdStage builder() { + return new Builder(); + } + + public interface ModelIdStage { + /** + *

Cartesia model ID

+ */ + VoiceStage modelId(@NotNull AgentV1UpdateSpeakSpeakOneItemProviderCartesiaModelId modelId); + + Builder from(AgentV1UpdateSpeakSpeakOneItemProviderCartesia other); + } + + public interface VoiceStage { + _FinalStage voice(@NotNull AgentV1UpdateSpeakSpeakOneItemProviderCartesiaVoice voice); + } + + public interface _FinalStage { + AgentV1UpdateSpeakSpeakOneItemProviderCartesia build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The API version header for the Cartesia text-to-speech API

+ */ + _FinalStage version(Optional version); + + _FinalStage version(String version); + + /** + *

Cartesia language code

+ */ + _FinalStage language(Optional language); + + _FinalStage language(String language); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ModelIdStage, VoiceStage, _FinalStage { + private AgentV1UpdateSpeakSpeakOneItemProviderCartesiaModelId modelId; + + private AgentV1UpdateSpeakSpeakOneItemProviderCartesiaVoice voice; + + private Optional language = Optional.empty(); + + private Optional version = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentV1UpdateSpeakSpeakOneItemProviderCartesia other) { + version(other.getVersion()); + modelId(other.getModelId()); + voice(other.getVoice()); + language(other.getLanguage()); + return this; + } + + /** + *

Cartesia model ID

+ *

Cartesia model ID

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

Cartesia language code

+ * @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; + } + + /** + *

Cartesia language code

+ */ + @java.lang.Override + @JsonSetter(value = "language", nulls = Nulls.SKIP) + public _FinalStage language(Optional language) { + this.language = language; + return this; + } + + /** + *

The API version header for the Cartesia text-to-speech API

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage version(String version) { + this.version = Optional.ofNullable(version); + return this; + } + + /** + *

The API version header for the Cartesia text-to-speech API

+ */ + @java.lang.Override + @JsonSetter(value = "version", nulls = Nulls.SKIP) + public _FinalStage version(Optional version) { + this.version = version; + return this; + } + + @java.lang.Override + public AgentV1UpdateSpeakSpeakOneItemProviderCartesia build() { + return new AgentV1UpdateSpeakSpeakOneItemProviderCartesia( + version, modelId, voice, language, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProviderCartesiaModelId.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProviderCartesiaModelId.java new file mode 100644 index 0000000..e276fea --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProviderCartesiaModelId.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AgentV1UpdateSpeakSpeakOneItemProviderCartesiaModelId { + public static final AgentV1UpdateSpeakSpeakOneItemProviderCartesiaModelId SONIC_MULTILINGUAL = + new AgentV1UpdateSpeakSpeakOneItemProviderCartesiaModelId(Value.SONIC_MULTILINGUAL, "sonic-multilingual"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderCartesiaModelId SONIC2 = + new AgentV1UpdateSpeakSpeakOneItemProviderCartesiaModelId(Value.SONIC2, "sonic-2"); + + private final Value value; + + private final String string; + + AgentV1UpdateSpeakSpeakOneItemProviderCartesiaModelId(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AgentV1UpdateSpeakSpeakOneItemProviderCartesiaModelId + && this.string.equals(((AgentV1UpdateSpeakSpeakOneItemProviderCartesiaModelId) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SONIC_MULTILINGUAL: + return visitor.visitSonicMultilingual(); + case SONIC2: + return visitor.visitSonic2(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AgentV1UpdateSpeakSpeakOneItemProviderCartesiaModelId valueOf(String value) { + switch (value) { + case "sonic-multilingual": + return SONIC_MULTILINGUAL; + case "sonic-2": + return SONIC2; + default: + return new AgentV1UpdateSpeakSpeakOneItemProviderCartesiaModelId(Value.UNKNOWN, value); + } + } + + public enum Value { + SONIC2, + + SONIC_MULTILINGUAL, + + UNKNOWN + } + + public interface Visitor { + T visitSonic2(); + + T visitSonicMultilingual(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProviderCartesiaVoice.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProviderCartesiaVoice.java new file mode 100644 index 0000000..35e747d --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProviderCartesiaVoice.java @@ -0,0 +1,164 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AgentV1UpdateSpeakSpeakOneItemProviderCartesiaVoice.Builder.class) +public final class AgentV1UpdateSpeakSpeakOneItemProviderCartesiaVoice { + private final String mode; + + private final String id; + + private final Map additionalProperties; + + private AgentV1UpdateSpeakSpeakOneItemProviderCartesiaVoice( + String mode, String id, Map additionalProperties) { + this.mode = mode; + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return Cartesia voice mode + */ + @JsonProperty("mode") + public String getMode() { + return mode; + } + + /** + * @return Cartesia voice ID + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1UpdateSpeakSpeakOneItemProviderCartesiaVoice + && equalTo((AgentV1UpdateSpeakSpeakOneItemProviderCartesiaVoice) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1UpdateSpeakSpeakOneItemProviderCartesiaVoice other) { + return mode.equals(other.mode) && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.mode, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ModeStage builder() { + return new Builder(); + } + + public interface ModeStage { + /** + *

Cartesia voice mode

+ */ + IdStage mode(@NotNull String mode); + + Builder from(AgentV1UpdateSpeakSpeakOneItemProviderCartesiaVoice other); + } + + public interface IdStage { + /** + *

Cartesia voice ID

+ */ + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + AgentV1UpdateSpeakSpeakOneItemProviderCartesiaVoice build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ModeStage, IdStage, _FinalStage { + private String mode; + + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentV1UpdateSpeakSpeakOneItemProviderCartesiaVoice other) { + mode(other.getMode()); + id(other.getId()); + return this; + } + + /** + *

Cartesia voice mode

+ *

Cartesia voice mode

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

Cartesia voice ID

+ *

Cartesia voice ID

+ * @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 AgentV1UpdateSpeakSpeakOneItemProviderCartesiaVoice build() { + return new AgentV1UpdateSpeakSpeakOneItemProviderCartesiaVoice(mode, id, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProviderDeepgram.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProviderDeepgram.java new file mode 100644 index 0000000..47ec66d --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProviderDeepgram.java @@ -0,0 +1,176 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = AgentV1UpdateSpeakSpeakOneItemProviderDeepgram.Builder.class) +public final class AgentV1UpdateSpeakSpeakOneItemProviderDeepgram { + private final Optional version; + + private final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel model; + + private final Map additionalProperties; + + private AgentV1UpdateSpeakSpeakOneItemProviderDeepgram( + Optional version, + AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel model, + Map additionalProperties) { + this.version = version; + this.model = model; + this.additionalProperties = additionalProperties; + } + + /** + * @return The REST API version for the Deepgram text-to-speech API + */ + @JsonProperty("version") + public Optional getVersion() { + return version; + } + + /** + * @return Deepgram TTS model + */ + @JsonProperty("model") + public AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel getModel() { + return model; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1UpdateSpeakSpeakOneItemProviderDeepgram + && equalTo((AgentV1UpdateSpeakSpeakOneItemProviderDeepgram) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1UpdateSpeakSpeakOneItemProviderDeepgram other) { + return version.equals(other.version) && model.equals(other.model); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.version, this.model); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ModelStage builder() { + return new Builder(); + } + + public interface ModelStage { + /** + *

Deepgram TTS model

+ */ + _FinalStage model(@NotNull AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel model); + + Builder from(AgentV1UpdateSpeakSpeakOneItemProviderDeepgram other); + } + + public interface _FinalStage { + AgentV1UpdateSpeakSpeakOneItemProviderDeepgram build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The REST API version for the Deepgram text-to-speech API

+ */ + _FinalStage version(Optional version); + + _FinalStage version(String version); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ModelStage, _FinalStage { + private AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel model; + + private Optional version = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentV1UpdateSpeakSpeakOneItemProviderDeepgram other) { + version(other.getVersion()); + model(other.getModel()); + return this; + } + + /** + *

Deepgram TTS model

+ *

Deepgram TTS model

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

The REST API version for the Deepgram text-to-speech API

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage version(String version) { + this.version = Optional.ofNullable(version); + return this; + } + + /** + *

The REST API version for the Deepgram text-to-speech API

+ */ + @java.lang.Override + @JsonSetter(value = "version", nulls = Nulls.SKIP) + public _FinalStage version(Optional version) { + this.version = version; + return this; + } + + @java.lang.Override + public AgentV1UpdateSpeakSpeakOneItemProviderDeepgram build() { + return new AgentV1UpdateSpeakSpeakOneItemProviderDeepgram(version, model, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel.java new file mode 100644 index 0000000..1a5b35a --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel.java @@ -0,0 +1,757 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel { + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA_ANGUS_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA_ANGUS_EN, "aura-angus-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2JUPITER_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2JUPITER_EN, "aura-2-jupiter-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2CORA_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2CORA_EN, "aura-2-cora-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA_STELLA_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA_STELLA_EN, "aura-stella-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2HELENA_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2HELENA_EN, "aura-2-helena-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2AQUILA_ES = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2AQUILA_ES, "aura-2-aquila-es"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2ATLAS_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2ATLAS_EN, "aura-2-atlas-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2ORION_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2ORION_EN, "aura-2-orion-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2DRACO_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2DRACO_EN, "aura-2-draco-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2HYPERION_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2HYPERION_EN, "aura-2-hyperion-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2JANUS_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2JANUS_EN, "aura-2-janus-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA_HELIOS_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA_HELIOS_EN, "aura-helios-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2PLUTO_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2PLUTO_EN, "aura-2-pluto-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2ARCAS_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2ARCAS_EN, "aura-2-arcas-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2NESTOR_ES = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2NESTOR_ES, "aura-2-nestor-es"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2NEPTUNE_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2NEPTUNE_EN, "aura-2-neptune-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2MINERVA_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2MINERVA_EN, "aura-2-minerva-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2ALVARO_ES = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2ALVARO_ES, "aura-2-alvaro-es"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA_ATHENA_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA_ATHENA_EN, "aura-athena-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA_PERSEUS_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA_PERSEUS_EN, "aura-perseus-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2ODYSSEUS_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2ODYSSEUS_EN, "aura-2-odysseus-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2PANDORA_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2PANDORA_EN, "aura-2-pandora-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2ZEUS_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2ZEUS_EN, "aura-2-zeus-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2ELECTRA_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2ELECTRA_EN, "aura-2-electra-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2ORPHEUS_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2ORPHEUS_EN, "aura-2-orpheus-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2THALIA_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2THALIA_EN, "aura-2-thalia-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2CELESTE_ES = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2CELESTE_ES, "aura-2-celeste-es"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA_ASTERIA_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA_ASTERIA_EN, "aura-asteria-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2ESTRELLA_ES = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2ESTRELLA_ES, "aura-2-estrella-es"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2HERA_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2HERA_EN, "aura-2-hera-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2MARS_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2MARS_EN, "aura-2-mars-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2SIRIO_ES = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2SIRIO_ES, "aura-2-sirio-es"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2ASTERIA_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2ASTERIA_EN, "aura-2-asteria-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2HERMES_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2HERMES_EN, "aura-2-hermes-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2VESTA_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2VESTA_EN, "aura-2-vesta-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2CARINA_ES = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2CARINA_ES, "aura-2-carina-es"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2CALLISTA_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2CALLISTA_EN, "aura-2-callista-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2HARMONIA_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2HARMONIA_EN, "aura-2-harmonia-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2SELENA_ES = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2SELENA_ES, "aura-2-selena-es"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2AURORA_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2AURORA_EN, "aura-2-aurora-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA_ZEUS_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA_ZEUS_EN, "aura-zeus-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2OPHELIA_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2OPHELIA_EN, "aura-2-ophelia-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2AMALTHEA_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2AMALTHEA_EN, "aura-2-amalthea-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA_ORPHEUS_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA_ORPHEUS_EN, "aura-orpheus-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2DELIA_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2DELIA_EN, "aura-2-delia-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA_LUNA_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA_LUNA_EN, "aura-luna-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2APOLLO_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2APOLLO_EN, "aura-2-apollo-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2SELENE_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2SELENE_EN, "aura-2-selene-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2THEIA_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2THEIA_EN, "aura-2-theia-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA_HERA_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA_HERA_EN, "aura-hera-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2CORDELIA_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2CORDELIA_EN, "aura-2-cordelia-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2ANDROMEDA_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2ANDROMEDA_EN, "aura-2-andromeda-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2ARIES_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2ARIES_EN, "aura-2-aries-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2JUNO_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2JUNO_EN, "aura-2-juno-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2LUNA_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2LUNA_EN, "aura-2-luna-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2DIANA_ES = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2DIANA_ES, "aura-2-diana-es"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2JAVIER_ES = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2JAVIER_ES, "aura-2-javier-es"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA_ORION_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA_ORION_EN, "aura-orion-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA_ARCAS_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA_ARCAS_EN, "aura-arcas-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2IRIS_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2IRIS_EN, "aura-2-iris-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2ATHENA_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2ATHENA_EN, "aura-2-athena-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2SATURN_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2SATURN_EN, "aura-2-saturn-en"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel AURA2PHOEBE_EN = + new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.AURA2PHOEBE_EN, "aura-2-phoebe-en"); + + private final Value value; + + private final String string; + + AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel + && this.string.equals(((AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case AURA_ANGUS_EN: + return visitor.visitAuraAngusEn(); + case AURA2JUPITER_EN: + return visitor.visitAura2JupiterEn(); + case AURA2CORA_EN: + return visitor.visitAura2CoraEn(); + case AURA_STELLA_EN: + return visitor.visitAuraStellaEn(); + case AURA2HELENA_EN: + return visitor.visitAura2HelenaEn(); + case AURA2AQUILA_ES: + return visitor.visitAura2AquilaEs(); + case AURA2ATLAS_EN: + return visitor.visitAura2AtlasEn(); + case AURA2ORION_EN: + return visitor.visitAura2OrionEn(); + case AURA2DRACO_EN: + return visitor.visitAura2DracoEn(); + case AURA2HYPERION_EN: + return visitor.visitAura2HyperionEn(); + case AURA2JANUS_EN: + return visitor.visitAura2JanusEn(); + case AURA_HELIOS_EN: + return visitor.visitAuraHeliosEn(); + case AURA2PLUTO_EN: + return visitor.visitAura2PlutoEn(); + case AURA2ARCAS_EN: + return visitor.visitAura2ArcasEn(); + case AURA2NESTOR_ES: + return visitor.visitAura2NestorEs(); + case AURA2NEPTUNE_EN: + return visitor.visitAura2NeptuneEn(); + case AURA2MINERVA_EN: + return visitor.visitAura2MinervaEn(); + case AURA2ALVARO_ES: + return visitor.visitAura2AlvaroEs(); + case AURA_ATHENA_EN: + return visitor.visitAuraAthenaEn(); + case AURA_PERSEUS_EN: + return visitor.visitAuraPerseusEn(); + case AURA2ODYSSEUS_EN: + return visitor.visitAura2OdysseusEn(); + case AURA2PANDORA_EN: + return visitor.visitAura2PandoraEn(); + case AURA2ZEUS_EN: + return visitor.visitAura2ZeusEn(); + case AURA2ELECTRA_EN: + return visitor.visitAura2ElectraEn(); + case AURA2ORPHEUS_EN: + return visitor.visitAura2OrpheusEn(); + case AURA2THALIA_EN: + return visitor.visitAura2ThaliaEn(); + case AURA2CELESTE_ES: + return visitor.visitAura2CelesteEs(); + case AURA_ASTERIA_EN: + return visitor.visitAuraAsteriaEn(); + case AURA2ESTRELLA_ES: + return visitor.visitAura2EstrellaEs(); + case AURA2HERA_EN: + return visitor.visitAura2HeraEn(); + case AURA2MARS_EN: + return visitor.visitAura2MarsEn(); + case AURA2SIRIO_ES: + return visitor.visitAura2SirioEs(); + case AURA2ASTERIA_EN: + return visitor.visitAura2AsteriaEn(); + case AURA2HERMES_EN: + return visitor.visitAura2HermesEn(); + case AURA2VESTA_EN: + return visitor.visitAura2VestaEn(); + case AURA2CARINA_ES: + return visitor.visitAura2CarinaEs(); + case AURA2CALLISTA_EN: + return visitor.visitAura2CallistaEn(); + case AURA2HARMONIA_EN: + return visitor.visitAura2HarmoniaEn(); + case AURA2SELENA_ES: + return visitor.visitAura2SelenaEs(); + case AURA2AURORA_EN: + return visitor.visitAura2AuroraEn(); + case AURA_ZEUS_EN: + return visitor.visitAuraZeusEn(); + case AURA2OPHELIA_EN: + return visitor.visitAura2OpheliaEn(); + case AURA2AMALTHEA_EN: + return visitor.visitAura2AmaltheaEn(); + case AURA_ORPHEUS_EN: + return visitor.visitAuraOrpheusEn(); + case AURA2DELIA_EN: + return visitor.visitAura2DeliaEn(); + case AURA_LUNA_EN: + return visitor.visitAuraLunaEn(); + case AURA2APOLLO_EN: + return visitor.visitAura2ApolloEn(); + case AURA2SELENE_EN: + return visitor.visitAura2SeleneEn(); + case AURA2THEIA_EN: + return visitor.visitAura2TheiaEn(); + case AURA_HERA_EN: + return visitor.visitAuraHeraEn(); + case AURA2CORDELIA_EN: + return visitor.visitAura2CordeliaEn(); + case AURA2ANDROMEDA_EN: + return visitor.visitAura2AndromedaEn(); + case AURA2ARIES_EN: + return visitor.visitAura2AriesEn(); + case AURA2JUNO_EN: + return visitor.visitAura2JunoEn(); + case AURA2LUNA_EN: + return visitor.visitAura2LunaEn(); + case AURA2DIANA_ES: + return visitor.visitAura2DianaEs(); + case AURA2JAVIER_ES: + return visitor.visitAura2JavierEs(); + case AURA_ORION_EN: + return visitor.visitAuraOrionEn(); + case AURA_ARCAS_EN: + return visitor.visitAuraArcasEn(); + case AURA2IRIS_EN: + return visitor.visitAura2IrisEn(); + case AURA2ATHENA_EN: + return visitor.visitAura2AthenaEn(); + case AURA2SATURN_EN: + return visitor.visitAura2SaturnEn(); + case AURA2PHOEBE_EN: + return visitor.visitAura2PhoebeEn(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel valueOf(String value) { + switch (value) { + case "aura-angus-en": + return AURA_ANGUS_EN; + case "aura-2-jupiter-en": + return AURA2JUPITER_EN; + case "aura-2-cora-en": + return AURA2CORA_EN; + case "aura-stella-en": + return AURA_STELLA_EN; + case "aura-2-helena-en": + return AURA2HELENA_EN; + case "aura-2-aquila-es": + return AURA2AQUILA_ES; + case "aura-2-atlas-en": + return AURA2ATLAS_EN; + case "aura-2-orion-en": + return AURA2ORION_EN; + case "aura-2-draco-en": + return AURA2DRACO_EN; + case "aura-2-hyperion-en": + return AURA2HYPERION_EN; + case "aura-2-janus-en": + return AURA2JANUS_EN; + case "aura-helios-en": + return AURA_HELIOS_EN; + case "aura-2-pluto-en": + return AURA2PLUTO_EN; + case "aura-2-arcas-en": + return AURA2ARCAS_EN; + case "aura-2-nestor-es": + return AURA2NESTOR_ES; + case "aura-2-neptune-en": + return AURA2NEPTUNE_EN; + case "aura-2-minerva-en": + return AURA2MINERVA_EN; + case "aura-2-alvaro-es": + return AURA2ALVARO_ES; + case "aura-athena-en": + return AURA_ATHENA_EN; + case "aura-perseus-en": + return AURA_PERSEUS_EN; + case "aura-2-odysseus-en": + return AURA2ODYSSEUS_EN; + case "aura-2-pandora-en": + return AURA2PANDORA_EN; + case "aura-2-zeus-en": + return AURA2ZEUS_EN; + case "aura-2-electra-en": + return AURA2ELECTRA_EN; + case "aura-2-orpheus-en": + return AURA2ORPHEUS_EN; + case "aura-2-thalia-en": + return AURA2THALIA_EN; + case "aura-2-celeste-es": + return AURA2CELESTE_ES; + case "aura-asteria-en": + return AURA_ASTERIA_EN; + case "aura-2-estrella-es": + return AURA2ESTRELLA_ES; + case "aura-2-hera-en": + return AURA2HERA_EN; + case "aura-2-mars-en": + return AURA2MARS_EN; + case "aura-2-sirio-es": + return AURA2SIRIO_ES; + case "aura-2-asteria-en": + return AURA2ASTERIA_EN; + case "aura-2-hermes-en": + return AURA2HERMES_EN; + case "aura-2-vesta-en": + return AURA2VESTA_EN; + case "aura-2-carina-es": + return AURA2CARINA_ES; + case "aura-2-callista-en": + return AURA2CALLISTA_EN; + case "aura-2-harmonia-en": + return AURA2HARMONIA_EN; + case "aura-2-selena-es": + return AURA2SELENA_ES; + case "aura-2-aurora-en": + return AURA2AURORA_EN; + case "aura-zeus-en": + return AURA_ZEUS_EN; + case "aura-2-ophelia-en": + return AURA2OPHELIA_EN; + case "aura-2-amalthea-en": + return AURA2AMALTHEA_EN; + case "aura-orpheus-en": + return AURA_ORPHEUS_EN; + case "aura-2-delia-en": + return AURA2DELIA_EN; + case "aura-luna-en": + return AURA_LUNA_EN; + case "aura-2-apollo-en": + return AURA2APOLLO_EN; + case "aura-2-selene-en": + return AURA2SELENE_EN; + case "aura-2-theia-en": + return AURA2THEIA_EN; + case "aura-hera-en": + return AURA_HERA_EN; + case "aura-2-cordelia-en": + return AURA2CORDELIA_EN; + case "aura-2-andromeda-en": + return AURA2ANDROMEDA_EN; + case "aura-2-aries-en": + return AURA2ARIES_EN; + case "aura-2-juno-en": + return AURA2JUNO_EN; + case "aura-2-luna-en": + return AURA2LUNA_EN; + case "aura-2-diana-es": + return AURA2DIANA_ES; + case "aura-2-javier-es": + return AURA2JAVIER_ES; + case "aura-orion-en": + return AURA_ORION_EN; + case "aura-arcas-en": + return AURA_ARCAS_EN; + case "aura-2-iris-en": + return AURA2IRIS_EN; + case "aura-2-athena-en": + return AURA2ATHENA_EN; + case "aura-2-saturn-en": + return AURA2SATURN_EN; + case "aura-2-phoebe-en": + return AURA2PHOEBE_EN; + default: + return new AgentV1UpdateSpeakSpeakOneItemProviderDeepgramModel(Value.UNKNOWN, value); + } + } + + public enum Value { + AURA_ASTERIA_EN, + + AURA_LUNA_EN, + + AURA_STELLA_EN, + + AURA_ATHENA_EN, + + AURA_HERA_EN, + + AURA_ORION_EN, + + AURA_ARCAS_EN, + + AURA_PERSEUS_EN, + + AURA_ANGUS_EN, + + AURA_ORPHEUS_EN, + + AURA_HELIOS_EN, + + AURA_ZEUS_EN, + + AURA2AMALTHEA_EN, + + AURA2ANDROMEDA_EN, + + AURA2APOLLO_EN, + + AURA2ARCAS_EN, + + AURA2ARIES_EN, + + AURA2ASTERIA_EN, + + AURA2ATHENA_EN, + + AURA2ATLAS_EN, + + AURA2AURORA_EN, + + AURA2CALLISTA_EN, + + AURA2CORA_EN, + + AURA2CORDELIA_EN, + + AURA2DELIA_EN, + + AURA2DRACO_EN, + + AURA2ELECTRA_EN, + + AURA2HARMONIA_EN, + + AURA2HELENA_EN, + + AURA2HERA_EN, + + AURA2HERMES_EN, + + AURA2HYPERION_EN, + + AURA2IRIS_EN, + + AURA2JANUS_EN, + + AURA2JUNO_EN, + + AURA2JUPITER_EN, + + AURA2LUNA_EN, + + AURA2MARS_EN, + + AURA2MINERVA_EN, + + AURA2NEPTUNE_EN, + + AURA2ODYSSEUS_EN, + + AURA2OPHELIA_EN, + + AURA2ORION_EN, + + AURA2ORPHEUS_EN, + + AURA2PANDORA_EN, + + AURA2PHOEBE_EN, + + AURA2PLUTO_EN, + + AURA2SATURN_EN, + + AURA2SELENE_EN, + + AURA2THALIA_EN, + + AURA2THEIA_EN, + + AURA2VESTA_EN, + + AURA2ZEUS_EN, + + AURA2SIRIO_ES, + + AURA2NESTOR_ES, + + AURA2CARINA_ES, + + AURA2CELESTE_ES, + + AURA2ALVARO_ES, + + AURA2DIANA_ES, + + AURA2AQUILA_ES, + + AURA2SELENA_ES, + + AURA2ESTRELLA_ES, + + AURA2JAVIER_ES, + + UNKNOWN + } + + public interface Visitor { + T visitAuraAsteriaEn(); + + T visitAuraLunaEn(); + + T visitAuraStellaEn(); + + T visitAuraAthenaEn(); + + T visitAuraHeraEn(); + + T visitAuraOrionEn(); + + T visitAuraArcasEn(); + + T visitAuraPerseusEn(); + + T visitAuraAngusEn(); + + T visitAuraOrpheusEn(); + + T visitAuraHeliosEn(); + + T visitAuraZeusEn(); + + T visitAura2AmaltheaEn(); + + T visitAura2AndromedaEn(); + + T visitAura2ApolloEn(); + + T visitAura2ArcasEn(); + + T visitAura2AriesEn(); + + T visitAura2AsteriaEn(); + + T visitAura2AthenaEn(); + + T visitAura2AtlasEn(); + + T visitAura2AuroraEn(); + + T visitAura2CallistaEn(); + + T visitAura2CoraEn(); + + T visitAura2CordeliaEn(); + + T visitAura2DeliaEn(); + + T visitAura2DracoEn(); + + T visitAura2ElectraEn(); + + T visitAura2HarmoniaEn(); + + T visitAura2HelenaEn(); + + T visitAura2HeraEn(); + + T visitAura2HermesEn(); + + T visitAura2HyperionEn(); + + T visitAura2IrisEn(); + + T visitAura2JanusEn(); + + T visitAura2JunoEn(); + + T visitAura2JupiterEn(); + + T visitAura2LunaEn(); + + T visitAura2MarsEn(); + + T visitAura2MinervaEn(); + + T visitAura2NeptuneEn(); + + T visitAura2OdysseusEn(); + + T visitAura2OpheliaEn(); + + T visitAura2OrionEn(); + + T visitAura2OrpheusEn(); + + T visitAura2PandoraEn(); + + T visitAura2PhoebeEn(); + + T visitAura2PlutoEn(); + + T visitAura2SaturnEn(); + + T visitAura2SeleneEn(); + + T visitAura2ThaliaEn(); + + T visitAura2TheiaEn(); + + T visitAura2VestaEn(); + + T visitAura2ZeusEn(); + + T visitAura2SirioEs(); + + T visitAura2NestorEs(); + + T visitAura2CarinaEs(); + + T visitAura2CelesteEs(); + + T visitAura2AlvaroEs(); + + T visitAura2DianaEs(); + + T visitAura2AquilaEs(); + + T visitAura2SelenaEs(); + + T visitAura2EstrellaEs(); + + T visitAura2JavierEs(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProviderElevenLabs.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProviderElevenLabs.java new file mode 100644 index 0000000..5755ded --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProviderElevenLabs.java @@ -0,0 +1,264 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = AgentV1UpdateSpeakSpeakOneItemProviderElevenLabs.Builder.class) +public final class AgentV1UpdateSpeakSpeakOneItemProviderElevenLabs { + private final Optional version; + + private final AgentV1UpdateSpeakSpeakOneItemProviderElevenLabsModelId modelId; + + private final Optional language; + + private final Optional languageCode; + + private final Map additionalProperties; + + private AgentV1UpdateSpeakSpeakOneItemProviderElevenLabs( + Optional version, + AgentV1UpdateSpeakSpeakOneItemProviderElevenLabsModelId modelId, + Optional language, + Optional languageCode, + Map additionalProperties) { + this.version = version; + this.modelId = modelId; + this.language = language; + this.languageCode = languageCode; + this.additionalProperties = additionalProperties; + } + + /** + * @return The REST API version for the ElevenLabs text-to-speech API + */ + @JsonProperty("version") + public Optional getVersion() { + return version; + } + + /** + * @return Eleven Labs model ID + */ + @JsonProperty("model_id") + public AgentV1UpdateSpeakSpeakOneItemProviderElevenLabsModelId getModelId() { + return modelId; + } + + /** + * @return Optional language to use, e.g. 'en-US'. Corresponds to the language_code parameter in the ElevenLabs API + */ + @JsonProperty("language") + public Optional getLanguage() { + return language; + } + + /** + * @return Use the language field instead. + */ + @JsonProperty("language_code") + public Optional getLanguageCode() { + return languageCode; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1UpdateSpeakSpeakOneItemProviderElevenLabs + && equalTo((AgentV1UpdateSpeakSpeakOneItemProviderElevenLabs) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1UpdateSpeakSpeakOneItemProviderElevenLabs other) { + return version.equals(other.version) + && modelId.equals(other.modelId) + && language.equals(other.language) + && languageCode.equals(other.languageCode); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.version, this.modelId, this.language, this.languageCode); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ModelIdStage builder() { + return new Builder(); + } + + public interface ModelIdStage { + /** + *

Eleven Labs model ID

+ */ + _FinalStage modelId(@NotNull AgentV1UpdateSpeakSpeakOneItemProviderElevenLabsModelId modelId); + + Builder from(AgentV1UpdateSpeakSpeakOneItemProviderElevenLabs other); + } + + public interface _FinalStage { + AgentV1UpdateSpeakSpeakOneItemProviderElevenLabs build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The REST API version for the ElevenLabs text-to-speech API

+ */ + _FinalStage version(Optional version); + + _FinalStage version(String version); + + /** + *

Optional language to use, e.g. 'en-US'. Corresponds to the language_code parameter in the ElevenLabs API

+ */ + _FinalStage language(Optional language); + + _FinalStage language(String language); + + /** + *

Use the language field instead.

+ */ + _FinalStage languageCode(Optional languageCode); + + _FinalStage languageCode(String languageCode); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ModelIdStage, _FinalStage { + private AgentV1UpdateSpeakSpeakOneItemProviderElevenLabsModelId modelId; + + private Optional languageCode = Optional.empty(); + + private Optional language = Optional.empty(); + + private Optional version = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentV1UpdateSpeakSpeakOneItemProviderElevenLabs other) { + version(other.getVersion()); + modelId(other.getModelId()); + language(other.getLanguage()); + languageCode(other.getLanguageCode()); + return this; + } + + /** + *

Eleven Labs model ID

+ *

Eleven Labs model ID

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

Use the language field instead.

+ * @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; + } + + /** + *

Use the language field instead.

+ */ + @java.lang.Override + @JsonSetter(value = "language_code", nulls = Nulls.SKIP) + public _FinalStage languageCode(Optional languageCode) { + this.languageCode = languageCode; + return this; + } + + /** + *

Optional language to use, e.g. 'en-US'. Corresponds to the language_code parameter in the ElevenLabs API

+ * @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; + } + + /** + *

Optional language to use, e.g. 'en-US'. Corresponds to the language_code parameter in the ElevenLabs API

+ */ + @java.lang.Override + @JsonSetter(value = "language", nulls = Nulls.SKIP) + public _FinalStage language(Optional language) { + this.language = language; + return this; + } + + /** + *

The REST API version for the ElevenLabs text-to-speech API

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage version(String version) { + this.version = Optional.ofNullable(version); + return this; + } + + /** + *

The REST API version for the ElevenLabs text-to-speech API

+ */ + @java.lang.Override + @JsonSetter(value = "version", nulls = Nulls.SKIP) + public _FinalStage version(Optional version) { + this.version = version; + return this; + } + + @java.lang.Override + public AgentV1UpdateSpeakSpeakOneItemProviderElevenLabs build() { + return new AgentV1UpdateSpeakSpeakOneItemProviderElevenLabs( + version, modelId, language, languageCode, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProviderElevenLabsModelId.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProviderElevenLabsModelId.java new file mode 100644 index 0000000..663f07e --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProviderElevenLabsModelId.java @@ -0,0 +1,100 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AgentV1UpdateSpeakSpeakOneItemProviderElevenLabsModelId { + public static final AgentV1UpdateSpeakSpeakOneItemProviderElevenLabsModelId ELEVEN_TURBO_V25 = + new AgentV1UpdateSpeakSpeakOneItemProviderElevenLabsModelId(Value.ELEVEN_TURBO_V25, "eleven_turbo_v2_5"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderElevenLabsModelId ELEVEN_MONOLINGUAL_V1 = + new AgentV1UpdateSpeakSpeakOneItemProviderElevenLabsModelId( + Value.ELEVEN_MONOLINGUAL_V1, "eleven_monolingual_v1"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderElevenLabsModelId ELEVEN_MULTILINGUAL_V2 = + new AgentV1UpdateSpeakSpeakOneItemProviderElevenLabsModelId( + Value.ELEVEN_MULTILINGUAL_V2, "eleven_multilingual_v2"); + + private final Value value; + + private final String string; + + AgentV1UpdateSpeakSpeakOneItemProviderElevenLabsModelId(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AgentV1UpdateSpeakSpeakOneItemProviderElevenLabsModelId + && this.string.equals( + ((AgentV1UpdateSpeakSpeakOneItemProviderElevenLabsModelId) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case ELEVEN_TURBO_V25: + return visitor.visitElevenTurboV25(); + case ELEVEN_MONOLINGUAL_V1: + return visitor.visitElevenMonolingualV1(); + case ELEVEN_MULTILINGUAL_V2: + return visitor.visitElevenMultilingualV2(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AgentV1UpdateSpeakSpeakOneItemProviderElevenLabsModelId valueOf(String value) { + switch (value) { + case "eleven_turbo_v2_5": + return ELEVEN_TURBO_V25; + case "eleven_monolingual_v1": + return ELEVEN_MONOLINGUAL_V1; + case "eleven_multilingual_v2": + return ELEVEN_MULTILINGUAL_V2; + default: + return new AgentV1UpdateSpeakSpeakOneItemProviderElevenLabsModelId(Value.UNKNOWN, value); + } + } + + public enum Value { + ELEVEN_TURBO_V25, + + ELEVEN_MONOLINGUAL_V1, + + ELEVEN_MULTILINGUAL_V2, + + UNKNOWN + } + + public interface Visitor { + T visitElevenTurboV25(); + + T visitElevenMonolingualV1(); + + T visitElevenMultilingualV2(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProviderOpenAi.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProviderOpenAi.java new file mode 100644 index 0000000..846594a --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProviderOpenAi.java @@ -0,0 +1,210 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = AgentV1UpdateSpeakSpeakOneItemProviderOpenAi.Builder.class) +public final class AgentV1UpdateSpeakSpeakOneItemProviderOpenAi { + private final Optional version; + + private final AgentV1UpdateSpeakSpeakOneItemProviderOpenAiModel model; + + private final AgentV1UpdateSpeakSpeakOneItemProviderOpenAiVoice voice; + + private final Map additionalProperties; + + private AgentV1UpdateSpeakSpeakOneItemProviderOpenAi( + Optional version, + AgentV1UpdateSpeakSpeakOneItemProviderOpenAiModel model, + AgentV1UpdateSpeakSpeakOneItemProviderOpenAiVoice voice, + Map additionalProperties) { + this.version = version; + this.model = model; + this.voice = voice; + this.additionalProperties = additionalProperties; + } + + /** + * @return The REST API version for the OpenAI text-to-speech API + */ + @JsonProperty("version") + public Optional getVersion() { + return version; + } + + /** + * @return OpenAI TTS model + */ + @JsonProperty("model") + public AgentV1UpdateSpeakSpeakOneItemProviderOpenAiModel getModel() { + return model; + } + + /** + * @return OpenAI voice + */ + @JsonProperty("voice") + public AgentV1UpdateSpeakSpeakOneItemProviderOpenAiVoice getVoice() { + return voice; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1UpdateSpeakSpeakOneItemProviderOpenAi + && equalTo((AgentV1UpdateSpeakSpeakOneItemProviderOpenAi) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1UpdateSpeakSpeakOneItemProviderOpenAi other) { + return version.equals(other.version) && model.equals(other.model) && voice.equals(other.voice); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.version, this.model, this.voice); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ModelStage builder() { + return new Builder(); + } + + public interface ModelStage { + /** + *

OpenAI TTS model

+ */ + VoiceStage model(@NotNull AgentV1UpdateSpeakSpeakOneItemProviderOpenAiModel model); + + Builder from(AgentV1UpdateSpeakSpeakOneItemProviderOpenAi other); + } + + public interface VoiceStage { + /** + *

OpenAI voice

+ */ + _FinalStage voice(@NotNull AgentV1UpdateSpeakSpeakOneItemProviderOpenAiVoice voice); + } + + public interface _FinalStage { + AgentV1UpdateSpeakSpeakOneItemProviderOpenAi build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The REST API version for the OpenAI text-to-speech API

+ */ + _FinalStage version(Optional version); + + _FinalStage version(String version); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ModelStage, VoiceStage, _FinalStage { + private AgentV1UpdateSpeakSpeakOneItemProviderOpenAiModel model; + + private AgentV1UpdateSpeakSpeakOneItemProviderOpenAiVoice voice; + + private Optional version = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentV1UpdateSpeakSpeakOneItemProviderOpenAi other) { + version(other.getVersion()); + model(other.getModel()); + voice(other.getVoice()); + return this; + } + + /** + *

OpenAI TTS model

+ *

OpenAI TTS model

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

OpenAI voice

+ *

OpenAI voice

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

The REST API version for the OpenAI text-to-speech API

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage version(String version) { + this.version = Optional.ofNullable(version); + return this; + } + + /** + *

The REST API version for the OpenAI text-to-speech API

+ */ + @java.lang.Override + @JsonSetter(value = "version", nulls = Nulls.SKIP) + public _FinalStage version(Optional version) { + this.version = version; + return this; + } + + @java.lang.Override + public AgentV1UpdateSpeakSpeakOneItemProviderOpenAi build() { + return new AgentV1UpdateSpeakSpeakOneItemProviderOpenAi(version, model, voice, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProviderOpenAiModel.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProviderOpenAiModel.java new file mode 100644 index 0000000..5558df0 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProviderOpenAiModel.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AgentV1UpdateSpeakSpeakOneItemProviderOpenAiModel { + public static final AgentV1UpdateSpeakSpeakOneItemProviderOpenAiModel TTS1HD = + new AgentV1UpdateSpeakSpeakOneItemProviderOpenAiModel(Value.TTS1HD, "tts-1-hd"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderOpenAiModel TTS1 = + new AgentV1UpdateSpeakSpeakOneItemProviderOpenAiModel(Value.TTS1, "tts-1"); + + private final Value value; + + private final String string; + + AgentV1UpdateSpeakSpeakOneItemProviderOpenAiModel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AgentV1UpdateSpeakSpeakOneItemProviderOpenAiModel + && this.string.equals(((AgentV1UpdateSpeakSpeakOneItemProviderOpenAiModel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case TTS1HD: + return visitor.visitTts1Hd(); + case TTS1: + return visitor.visitTts1(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AgentV1UpdateSpeakSpeakOneItemProviderOpenAiModel valueOf(String value) { + switch (value) { + case "tts-1-hd": + return TTS1HD; + case "tts-1": + return TTS1; + default: + return new AgentV1UpdateSpeakSpeakOneItemProviderOpenAiModel(Value.UNKNOWN, value); + } + } + + public enum Value { + TTS1, + + TTS1HD, + + UNKNOWN + } + + public interface Visitor { + T visitTts1(); + + T visitTts1Hd(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProviderOpenAiVoice.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProviderOpenAiVoice.java new file mode 100644 index 0000000..b6abf14 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UpdateSpeakSpeakOneItemProviderOpenAiVoice.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AgentV1UpdateSpeakSpeakOneItemProviderOpenAiVoice { + public static final AgentV1UpdateSpeakSpeakOneItemProviderOpenAiVoice SHIMMER = + new AgentV1UpdateSpeakSpeakOneItemProviderOpenAiVoice(Value.SHIMMER, "shimmer"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderOpenAiVoice FABLE = + new AgentV1UpdateSpeakSpeakOneItemProviderOpenAiVoice(Value.FABLE, "fable"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderOpenAiVoice ALLOY = + new AgentV1UpdateSpeakSpeakOneItemProviderOpenAiVoice(Value.ALLOY, "alloy"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderOpenAiVoice ONYX = + new AgentV1UpdateSpeakSpeakOneItemProviderOpenAiVoice(Value.ONYX, "onyx"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderOpenAiVoice NOVA = + new AgentV1UpdateSpeakSpeakOneItemProviderOpenAiVoice(Value.NOVA, "nova"); + + public static final AgentV1UpdateSpeakSpeakOneItemProviderOpenAiVoice ECHO = + new AgentV1UpdateSpeakSpeakOneItemProviderOpenAiVoice(Value.ECHO, "echo"); + + private final Value value; + + private final String string; + + AgentV1UpdateSpeakSpeakOneItemProviderOpenAiVoice(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AgentV1UpdateSpeakSpeakOneItemProviderOpenAiVoice + && this.string.equals(((AgentV1UpdateSpeakSpeakOneItemProviderOpenAiVoice) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SHIMMER: + return visitor.visitShimmer(); + case FABLE: + return visitor.visitFable(); + case ALLOY: + return visitor.visitAlloy(); + case ONYX: + return visitor.visitOnyx(); + case NOVA: + return visitor.visitNova(); + case ECHO: + return visitor.visitEcho(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AgentV1UpdateSpeakSpeakOneItemProviderOpenAiVoice valueOf(String value) { + switch (value) { + case "shimmer": + return SHIMMER; + case "fable": + return FABLE; + case "alloy": + return ALLOY; + case "onyx": + return ONYX; + case "nova": + return NOVA; + case "echo": + return ECHO; + default: + return new AgentV1UpdateSpeakSpeakOneItemProviderOpenAiVoice(Value.UNKNOWN, value); + } + } + + public enum Value { + ALLOY, + + ECHO, + + FABLE, + + ONYX, + + NOVA, + + SHIMMER, + + UNKNOWN + } + + public interface Visitor { + T visitAlloy(); + + T visitEcho(); + + T visitFable(); + + T visitOnyx(); + + T visitNova(); + + T visitShimmer(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UserStartedSpeaking.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UserStartedSpeaking.java new file mode 100644 index 0000000..edb80f8 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1UserStartedSpeaking.java @@ -0,0 +1,78 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AgentV1UserStartedSpeaking.Builder.class) +public final class AgentV1UserStartedSpeaking { + private final Map additionalProperties; + + private AgentV1UserStartedSpeaking(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + /** + * @return Message type identifier indicating that the user has begun speaking + */ + @JsonProperty("type") + public String getType() { + return "UserStartedSpeaking"; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1UserStartedSpeaking; + } + + @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(AgentV1UserStartedSpeaking other) { + return this; + } + + public AgentV1UserStartedSpeaking build() { + return new AgentV1UserStartedSpeaking(additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1Warning.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1Warning.java new file mode 100644 index 0000000..f151d6d --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1Warning.java @@ -0,0 +1,170 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AgentV1Warning.Builder.class) +public final class AgentV1Warning { + private final String description; + + private final String code; + + private final Map additionalProperties; + + private AgentV1Warning(String description, String code, Map additionalProperties) { + this.description = description; + this.code = code; + this.additionalProperties = additionalProperties; + } + + /** + * @return Message type identifier for warnings + */ + @JsonProperty("type") + public String getType() { + return "Warning"; + } + + /** + * @return Description of the warning + */ + @JsonProperty("description") + public String getDescription() { + return description; + } + + /** + * @return Warning code identifier + */ + @JsonProperty("code") + public String getCode() { + return code; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1Warning && equalTo((AgentV1Warning) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1Warning other) { + return description.equals(other.description) && code.equals(other.code); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.description, this.code); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DescriptionStage builder() { + return new Builder(); + } + + public interface DescriptionStage { + /** + *

Description of the warning

+ */ + CodeStage description(@NotNull String description); + + Builder from(AgentV1Warning other); + } + + public interface CodeStage { + /** + *

Warning code identifier

+ */ + _FinalStage code(@NotNull String code); + } + + public interface _FinalStage { + AgentV1Warning build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DescriptionStage, CodeStage, _FinalStage { + private String description; + + private String code; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentV1Warning other) { + description(other.getDescription()); + code(other.getCode()); + return this; + } + + /** + *

Description of the warning

+ *

Description of the warning

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

Warning code identifier

+ *

Warning code identifier

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("code") + public _FinalStage code(@NotNull String code) { + this.code = Objects.requireNonNull(code, "code must not be null"); + return this; + } + + @java.lang.Override + public AgentV1Warning build() { + return new AgentV1Warning(description, code, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1Welcome.java b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1Welcome.java new file mode 100644 index 0000000..1303bea --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/AgentV1Welcome.java @@ -0,0 +1,137 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AgentV1Welcome.Builder.class) +public final class AgentV1Welcome { + private final String requestId; + + private final Map additionalProperties; + + private AgentV1Welcome(String requestId, Map additionalProperties) { + this.requestId = requestId; + this.additionalProperties = additionalProperties; + } + + /** + * @return Message type identifier for welcome message + */ + @JsonProperty("type") + public String getType() { + return "Welcome"; + } + + /** + * @return Unique identifier for the request + */ + @JsonProperty("request_id") + public String getRequestId() { + return requestId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentV1Welcome && equalTo((AgentV1Welcome) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentV1Welcome other) { + return requestId.equals(other.requestId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.requestId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static RequestIdStage builder() { + return new Builder(); + } + + public interface RequestIdStage { + /** + *

Unique identifier for the request

+ */ + _FinalStage requestId(@NotNull String requestId); + + Builder from(AgentV1Welcome other); + } + + public interface _FinalStage { + AgentV1Welcome build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements RequestIdStage, _FinalStage { + private String requestId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentV1Welcome other) { + requestId(other.getRequestId()); + return this; + } + + /** + *

Unique identifier for the request

+ *

Unique identifier for the request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("request_id") + public _FinalStage requestId(@NotNull String requestId) { + this.requestId = Objects.requireNonNull(requestId, "requestId must not be null"); + return this; + } + + @java.lang.Override + public AgentV1Welcome build() { + return new AgentV1Welcome(requestId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/Cartesia.java b/src/main/java/com/deepgram/resources/agent/v1/types/Cartesia.java new file mode 100644 index 0000000..e6ea755 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/Cartesia.java @@ -0,0 +1,243 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = Cartesia.Builder.class) +public final class Cartesia { + private final Optional version; + + private final AgentV1SettingsAgentSpeakOneItemProviderCartesiaModelId modelId; + + private final AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoice voice; + + private final Optional language; + + private final Map additionalProperties; + + private Cartesia( + Optional version, + AgentV1SettingsAgentSpeakOneItemProviderCartesiaModelId modelId, + AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoice voice, + Optional language, + Map additionalProperties) { + this.version = version; + this.modelId = modelId; + this.voice = voice; + this.language = language; + this.additionalProperties = additionalProperties; + } + + /** + * @return The API version header for the Cartesia text-to-speech API + */ + @JsonProperty("version") + public Optional getVersion() { + return version; + } + + /** + * @return Cartesia model ID + */ + @JsonProperty("model_id") + public AgentV1SettingsAgentSpeakOneItemProviderCartesiaModelId getModelId() { + return modelId; + } + + @JsonProperty("voice") + public AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoice getVoice() { + return voice; + } + + /** + * @return Cartesia language code + */ + @JsonProperty("language") + public Optional getLanguage() { + return language; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Cartesia && equalTo((Cartesia) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Cartesia other) { + return version.equals(other.version) + && modelId.equals(other.modelId) + && voice.equals(other.voice) + && language.equals(other.language); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.version, this.modelId, this.voice, this.language); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ModelIdStage builder() { + return new Builder(); + } + + public interface ModelIdStage { + /** + *

Cartesia model ID

+ */ + VoiceStage modelId(@NotNull AgentV1SettingsAgentSpeakOneItemProviderCartesiaModelId modelId); + + Builder from(Cartesia other); + } + + public interface VoiceStage { + _FinalStage voice(@NotNull AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoice voice); + } + + public interface _FinalStage { + Cartesia build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The API version header for the Cartesia text-to-speech API

+ */ + _FinalStage version(Optional version); + + _FinalStage version(String version); + + /** + *

Cartesia language code

+ */ + _FinalStage language(Optional language); + + _FinalStage language(String language); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ModelIdStage, VoiceStage, _FinalStage { + private AgentV1SettingsAgentSpeakOneItemProviderCartesiaModelId modelId; + + private AgentV1SettingsAgentSpeakOneItemProviderCartesiaVoice voice; + + private Optional language = Optional.empty(); + + private Optional version = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Cartesia other) { + version(other.getVersion()); + modelId(other.getModelId()); + voice(other.getVoice()); + language(other.getLanguage()); + return this; + } + + /** + *

Cartesia model ID

+ *

Cartesia model ID

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

Cartesia language code

+ * @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; + } + + /** + *

Cartesia language code

+ */ + @java.lang.Override + @JsonSetter(value = "language", nulls = Nulls.SKIP) + public _FinalStage language(Optional language) { + this.language = language; + return this; + } + + /** + *

The API version header for the Cartesia text-to-speech API

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage version(String version) { + this.version = Optional.ofNullable(version); + return this; + } + + /** + *

The API version header for the Cartesia text-to-speech API

+ */ + @java.lang.Override + @JsonSetter(value = "version", nulls = Nulls.SKIP) + public _FinalStage version(Optional version) { + this.version = version; + return this; + } + + @java.lang.Override + public Cartesia build() { + return new Cartesia(version, modelId, voice, language, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/Deepgram.java b/src/main/java/com/deepgram/resources/agent/v1/types/Deepgram.java new file mode 100644 index 0000000..f69db3f --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/Deepgram.java @@ -0,0 +1,175 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = Deepgram.Builder.class) +public final class Deepgram { + private final Optional version; + + private final AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel model; + + private final Map additionalProperties; + + private Deepgram( + Optional version, + AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel model, + Map additionalProperties) { + this.version = version; + this.model = model; + this.additionalProperties = additionalProperties; + } + + /** + * @return The REST API version for the Deepgram text-to-speech API + */ + @JsonProperty("version") + public Optional getVersion() { + return version; + } + + /** + * @return Deepgram TTS model + */ + @JsonProperty("model") + public AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel getModel() { + return model; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Deepgram && equalTo((Deepgram) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Deepgram other) { + return version.equals(other.version) && model.equals(other.model); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.version, this.model); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ModelStage builder() { + return new Builder(); + } + + public interface ModelStage { + /** + *

Deepgram TTS model

+ */ + _FinalStage model(@NotNull AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel model); + + Builder from(Deepgram other); + } + + public interface _FinalStage { + Deepgram build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The REST API version for the Deepgram text-to-speech API

+ */ + _FinalStage version(Optional version); + + _FinalStage version(String version); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ModelStage, _FinalStage { + private AgentV1SettingsAgentSpeakOneItemProviderDeepgramModel model; + + private Optional version = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Deepgram other) { + version(other.getVersion()); + model(other.getModel()); + return this; + } + + /** + *

Deepgram TTS model

+ *

Deepgram TTS model

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

The REST API version for the Deepgram text-to-speech API

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage version(String version) { + this.version = Optional.ofNullable(version); + return this; + } + + /** + *

The REST API version for the Deepgram text-to-speech API

+ */ + @java.lang.Override + @JsonSetter(value = "version", nulls = Nulls.SKIP) + public _FinalStage version(Optional version) { + this.version = version; + return this; + } + + @java.lang.Override + public Deepgram build() { + return new Deepgram(version, model, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/types/ElevenLabs.java b/src/main/java/com/deepgram/resources/agent/v1/types/ElevenLabs.java new file mode 100644 index 0000000..b6d2faf --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/types/ElevenLabs.java @@ -0,0 +1,262 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = ElevenLabs.Builder.class) +public final class ElevenLabs { + private final Optional version; + + private final AgentV1SettingsAgentSpeakOneItemProviderElevenLabsModelId modelId; + + private final Optional language; + + private final Optional languageCode; + + private final Map additionalProperties; + + private ElevenLabs( + Optional version, + AgentV1SettingsAgentSpeakOneItemProviderElevenLabsModelId modelId, + Optional language, + Optional languageCode, + Map additionalProperties) { + this.version = version; + this.modelId = modelId; + this.language = language; + this.languageCode = languageCode; + this.additionalProperties = additionalProperties; + } + + /** + * @return The REST API version for the ElevenLabs text-to-speech API + */ + @JsonProperty("version") + public Optional getVersion() { + return version; + } + + /** + * @return Eleven Labs model ID + */ + @JsonProperty("model_id") + public AgentV1SettingsAgentSpeakOneItemProviderElevenLabsModelId getModelId() { + return modelId; + } + + /** + * @return Optional language to use, e.g. 'en-US'. Corresponds to the language_code parameter in the ElevenLabs API + */ + @JsonProperty("language") + public Optional getLanguage() { + return language; + } + + /** + * @return Use the language field instead. + */ + @JsonProperty("language_code") + public Optional getLanguageCode() { + return languageCode; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ElevenLabs && equalTo((ElevenLabs) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ElevenLabs other) { + return version.equals(other.version) + && modelId.equals(other.modelId) + && language.equals(other.language) + && languageCode.equals(other.languageCode); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.version, this.modelId, this.language, this.languageCode); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ModelIdStage builder() { + return new Builder(); + } + + public interface ModelIdStage { + /** + *

Eleven Labs model ID

+ */ + _FinalStage modelId(@NotNull AgentV1SettingsAgentSpeakOneItemProviderElevenLabsModelId modelId); + + Builder from(ElevenLabs other); + } + + public interface _FinalStage { + ElevenLabs build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The REST API version for the ElevenLabs text-to-speech API

+ */ + _FinalStage version(Optional version); + + _FinalStage version(String version); + + /** + *

Optional language to use, e.g. 'en-US'. Corresponds to the language_code parameter in the ElevenLabs API

+ */ + _FinalStage language(Optional language); + + _FinalStage language(String language); + + /** + *

Use the language field instead.

+ */ + _FinalStage languageCode(Optional languageCode); + + _FinalStage languageCode(String languageCode); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ModelIdStage, _FinalStage { + private AgentV1SettingsAgentSpeakOneItemProviderElevenLabsModelId modelId; + + private Optional languageCode = Optional.empty(); + + private Optional language = Optional.empty(); + + private Optional version = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ElevenLabs other) { + version(other.getVersion()); + modelId(other.getModelId()); + language(other.getLanguage()); + languageCode(other.getLanguageCode()); + return this; + } + + /** + *

Eleven Labs model ID

+ *

Eleven Labs model ID

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

Use the language field instead.

+ * @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; + } + + /** + *

Use the language field instead.

+ */ + @java.lang.Override + @JsonSetter(value = "language_code", nulls = Nulls.SKIP) + public _FinalStage languageCode(Optional languageCode) { + this.languageCode = languageCode; + return this; + } + + /** + *

Optional language to use, e.g. 'en-US'. Corresponds to the language_code parameter in the ElevenLabs API

+ * @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; + } + + /** + *

Optional language to use, e.g. 'en-US'. Corresponds to the language_code parameter in the ElevenLabs API

+ */ + @java.lang.Override + @JsonSetter(value = "language", nulls = Nulls.SKIP) + public _FinalStage language(Optional language) { + this.language = language; + return this; + } + + /** + *

The REST API version for the ElevenLabs text-to-speech API

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage version(String version) { + this.version = Optional.ofNullable(version); + return this; + } + + /** + *

The REST API version for the ElevenLabs text-to-speech API

+ */ + @java.lang.Override + @JsonSetter(value = "version", nulls = Nulls.SKIP) + public _FinalStage version(Optional version) { + this.version = version; + return this; + } + + @java.lang.Override + public ElevenLabs build() { + return new ElevenLabs(version, modelId, language, languageCode, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/agent/v1/websocket/V1WebSocketClient.java b/src/main/java/com/deepgram/resources/agent/v1/websocket/V1WebSocketClient.java new file mode 100644 index 0000000..5e78613 --- /dev/null +++ b/src/main/java/com/deepgram/resources/agent/v1/websocket/V1WebSocketClient.java @@ -0,0 +1,640 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.agent.v1.websocket; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.DisconnectReason; +import com.deepgram.core.ObjectMappers; +import com.deepgram.core.ReconnectingWebSocketListener; +import com.deepgram.core.WebSocketReadyState; +import com.deepgram.resources.agent.v1.types.AgentV1AgentAudioDone; +import com.deepgram.resources.agent.v1.types.AgentV1AgentStartedSpeaking; +import com.deepgram.resources.agent.v1.types.AgentV1AgentThinking; +import com.deepgram.resources.agent.v1.types.AgentV1ConversationText; +import com.deepgram.resources.agent.v1.types.AgentV1Error; +import com.deepgram.resources.agent.v1.types.AgentV1FunctionCallRequest; +import com.deepgram.resources.agent.v1.types.AgentV1InjectAgentMessage; +import com.deepgram.resources.agent.v1.types.AgentV1InjectUserMessage; +import com.deepgram.resources.agent.v1.types.AgentV1InjectionRefused; +import com.deepgram.resources.agent.v1.types.AgentV1KeepAlive; +import com.deepgram.resources.agent.v1.types.AgentV1PromptUpdated; +import com.deepgram.resources.agent.v1.types.AgentV1ReceiveFunctionCallResponse; +import com.deepgram.resources.agent.v1.types.AgentV1SendFunctionCallResponse; +import com.deepgram.resources.agent.v1.types.AgentV1Settings; +import com.deepgram.resources.agent.v1.types.AgentV1SettingsApplied; +import com.deepgram.resources.agent.v1.types.AgentV1SpeakUpdated; +import com.deepgram.resources.agent.v1.types.AgentV1UpdatePrompt; +import com.deepgram.resources.agent.v1.types.AgentV1UpdateSpeak; +import com.deepgram.resources.agent.v1.types.AgentV1UserStartedSpeaking; +import com.deepgram.resources.agent.v1.types.AgentV1Warning; +import com.deepgram.resources.agent.v1.types.AgentV1Welcome; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ScheduledExecutorService; +import java.util.function.Consumer; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.WebSocket; +import okio.ByteString; + +/** + * WebSocket client for the v1 channel. + * Provides real-time bidirectional communication with strongly-typed messages. + */ +public class V1WebSocketClient implements AutoCloseable { + protected final ClientOptions clientOptions; + + private final ObjectMapper objectMapper; + + private final OkHttpClient okHttpClient; + + private ScheduledExecutorService timeoutExecutor; + + private volatile WebSocketReadyState readyState = WebSocketReadyState.CLOSED; + + private volatile Runnable onConnectedHandler; + + private volatile Consumer onDisconnectedHandler; + + private volatile Consumer onErrorHandler; + + private volatile Consumer onMessageHandler; + + private volatile ReconnectingWebSocketListener.ReconnectOptions reconnectOptions; + + private CompletableFuture connectionFuture; + + private ReconnectingWebSocketListener reconnectingListener; + + private volatile Consumer onFunctionCallResponseHandler; + + private volatile Consumer promptUpdatedHandler; + + private volatile Consumer speakUpdatedHandler; + + private volatile Consumer injectionRefusedHandler; + + private volatile Consumer welcomeHandler; + + private volatile Consumer settingsAppliedHandler; + + private volatile Consumer conversationTextHandler; + + private volatile Consumer userStartedSpeakingHandler; + + private volatile Consumer agentThinkingHandler; + + private volatile Consumer functionCallRequestHandler; + + private volatile Consumer agentStartedSpeakingHandler; + + private volatile Consumer agentAudioDoneHandler; + + private volatile Consumer errorHandler; + + private volatile Consumer warningHandler; + + private volatile Consumer agentV1AudioHandler; + + /** + * Creates a new async WebSocket client for the v1 channel. + */ + public V1WebSocketClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.objectMapper = ObjectMappers.JSON_MAPPER; + this.okHttpClient = clientOptions.httpClient(); + } + + /** + * Establishes the WebSocket connection asynchronously with automatic reconnection. + * @return a CompletableFuture that completes when the connection is established + */ + public CompletableFuture connect() { + connectionFuture = new CompletableFuture<>(); + String baseUrl = clientOptions.environment().getAgentURL(); + String fullPath = "/v1/agent/converse"; + if (baseUrl.endsWith("/") && fullPath.startsWith("/")) { + fullPath = fullPath.substring(1); + } else if (!baseUrl.endsWith("/") && !fullPath.startsWith("/")) { + fullPath = "/" + fullPath; + } + // OkHttp's HttpUrl only supports http/https schemes; convert wss/ws for URL parsing + if (baseUrl.startsWith("wss://")) { + baseUrl = "https://" + baseUrl.substring(6); + } else if (baseUrl.startsWith("ws://")) { + baseUrl = "http://" + baseUrl.substring(5); + } + HttpUrl parsedUrl = HttpUrl.parse(baseUrl + fullPath); + if (parsedUrl == null) { + throw new IllegalArgumentException("Invalid WebSocket URL: " + baseUrl + fullPath); + } + HttpUrl.Builder urlBuilder = parsedUrl.newBuilder(); + Request.Builder requestBuilder = new Request.Builder().url(urlBuilder.build()); + clientOptions.headers(null).forEach(requestBuilder::addHeader); + final Request request = requestBuilder.build(); + this.readyState = WebSocketReadyState.CONNECTING; + ReconnectingWebSocketListener.ReconnectOptions reconnectOpts = this.reconnectOptions != null + ? this.reconnectOptions + : ReconnectingWebSocketListener.ReconnectOptions.builder().build(); + this.reconnectingListener = + new ReconnectingWebSocketListener(reconnectOpts, () -> { + if (clientOptions.webSocketFactory().isPresent()) { + return clientOptions.webSocketFactory().get().create(request, this.reconnectingListener); + } else { + return okHttpClient.newWebSocket(request, this.reconnectingListener); + } + }) { + @Override + protected void onWebSocketOpen(WebSocket webSocket, Response response) { + readyState = WebSocketReadyState.OPEN; + if (onConnectedHandler != null) { + onConnectedHandler.run(); + } + connectionFuture.complete(null); + } + + @Override + protected void onWebSocketMessage(WebSocket webSocket, String text) { + handleIncomingMessage(text); + } + + @Override + protected void onWebSocketBinaryMessage(WebSocket webSocket, ByteString bytes) { + if (agentV1AudioHandler != null) { + agentV1AudioHandler.accept(bytes); + } + } + + @Override + protected void onWebSocketFailure(WebSocket webSocket, Throwable t, Response response) { + readyState = WebSocketReadyState.CLOSED; + if (onErrorHandler != null) { + onErrorHandler.accept(new RuntimeException(t)); + } + connectionFuture.completeExceptionally(t); + } + + @Override + protected void onWebSocketClosed(WebSocket webSocket, int code, String reason) { + readyState = WebSocketReadyState.CLOSED; + if (onDisconnectedHandler != null) { + onDisconnectedHandler.accept(new DisconnectReason(code, reason)); + } + } + }; + reconnectingListener.connect(); + return connectionFuture; + } + + /** + * Disconnects the WebSocket connection and releases resources. + */ + public void disconnect() { + reconnectingListener.disconnect(); + if (timeoutExecutor != null) { + timeoutExecutor.shutdownNow(); + timeoutExecutor = null; + } + } + + /** + * Gets the current state of the WebSocket connection. + * + * This provides the actual connection state, similar to the W3C WebSocket API. + * + * @return the current WebSocket ready state + */ + public WebSocketReadyState getReadyState() { + return readyState; + } + + /** + * Sends an AgentV1Settings message to the server asynchronously. + * @param message the message to send + * @return a CompletableFuture that completes when the message is sent + */ + public CompletableFuture sendSettings(AgentV1Settings message) { + return sendMessage(message); + } + + /** + * Sends an AgentV1UpdateSpeak message to the server asynchronously. + * @param message the message to send + * @return a CompletableFuture that completes when the message is sent + */ + public CompletableFuture sendUpdateSpeak(AgentV1UpdateSpeak message) { + return sendMessage(message); + } + + /** + * Sends an AgentV1InjectUserMessage message to the server asynchronously. + * @param message the message to send + * @return a CompletableFuture that completes when the message is sent + */ + public CompletableFuture sendInjectUserMessage(AgentV1InjectUserMessage message) { + return sendMessage(message); + } + + /** + * Sends an AgentV1InjectAgentMessage message to the server asynchronously. + * @param message the message to send + * @return a CompletableFuture that completes when the message is sent + */ + public CompletableFuture sendInjectAgentMessage(AgentV1InjectAgentMessage message) { + return sendMessage(message); + } + + /** + * Sends an AgentV1SendFunctionCallResponse message to the server asynchronously. + * @param message the message to send + * @return a CompletableFuture that completes when the message is sent + */ + public CompletableFuture sendFunctionCallResponse(AgentV1SendFunctionCallResponse message) { + return sendMessage(message); + } + + /** + * Sends an AgentV1KeepAlive message to the server asynchronously. + * @param message the message to send + * @return a CompletableFuture that completes when the message is sent + */ + public CompletableFuture sendKeepAlive(AgentV1KeepAlive message) { + return sendMessage(message); + } + + /** + * Sends an AgentV1UpdatePrompt message to the server asynchronously. + * @param message the message to send + * @return a CompletableFuture that completes when the message is sent + */ + public CompletableFuture sendUpdatePrompt(AgentV1UpdatePrompt message) { + return sendMessage(message); + } + + /** + * Sends an AgentV1Media message to the server asynchronously. + * @param message the message to send + * @return a CompletableFuture that completes when the message is sent + */ + public CompletableFuture sendMedia(ByteString message) { + CompletableFuture future = new CompletableFuture<>(); + try { + assertSocketIsOpen(); + // Use reconnecting listener's sendBinary method which handles queuing + reconnectingListener.sendBinary(message); + future.complete(null); + } catch (Exception e) { + future.completeExceptionally(new RuntimeException("Failed to send binary data", e)); + } + return future; + } + + /** + * Registers a handler for AgentV1ReceiveFunctionCallResponse messages from the server. + * @param handler the handler to invoke when a message is received + */ + public void onFunctionCallResponse(Consumer handler) { + this.onFunctionCallResponseHandler = handler; + } + + /** + * Registers a handler for AgentV1PromptUpdated messages from the server. + * @param handler the handler to invoke when a message is received + */ + public void onPromptUpdated(Consumer handler) { + this.promptUpdatedHandler = handler; + } + + /** + * Registers a handler for AgentV1SpeakUpdated messages from the server. + * @param handler the handler to invoke when a message is received + */ + public void onSpeakUpdated(Consumer handler) { + this.speakUpdatedHandler = handler; + } + + /** + * Registers a handler for AgentV1InjectionRefused messages from the server. + * @param handler the handler to invoke when a message is received + */ + public void onInjectionRefused(Consumer handler) { + this.injectionRefusedHandler = handler; + } + + /** + * Registers a handler for AgentV1Welcome messages from the server. + * @param handler the handler to invoke when a message is received + */ + public void onWelcome(Consumer handler) { + this.welcomeHandler = handler; + } + + /** + * Registers a handler for AgentV1SettingsApplied messages from the server. + * @param handler the handler to invoke when a message is received + */ + public void onSettingsApplied(Consumer handler) { + this.settingsAppliedHandler = handler; + } + + /** + * Registers a handler for AgentV1ConversationText messages from the server. + * @param handler the handler to invoke when a message is received + */ + public void onConversationText(Consumer handler) { + this.conversationTextHandler = handler; + } + + /** + * Registers a handler for AgentV1UserStartedSpeaking messages from the server. + * @param handler the handler to invoke when a message is received + */ + public void onUserStartedSpeaking(Consumer handler) { + this.userStartedSpeakingHandler = handler; + } + + /** + * Registers a handler for AgentV1AgentThinking messages from the server. + * @param handler the handler to invoke when a message is received + */ + public void onAgentThinking(Consumer handler) { + this.agentThinkingHandler = handler; + } + + /** + * Registers a handler for AgentV1FunctionCallRequest messages from the server. + * @param handler the handler to invoke when a message is received + */ + public void onFunctionCallRequest(Consumer handler) { + this.functionCallRequestHandler = handler; + } + + /** + * Registers a handler for AgentV1AgentStartedSpeaking messages from the server. + * @param handler the handler to invoke when a message is received + */ + public void onAgentStartedSpeaking(Consumer handler) { + this.agentStartedSpeakingHandler = handler; + } + + /** + * Registers a handler for AgentV1AgentAudioDone messages from the server. + * @param handler the handler to invoke when a message is received + */ + public void onAgentAudioDone(Consumer handler) { + this.agentAudioDoneHandler = handler; + } + + /** + * Registers a handler for AgentV1Error messages from the server. + * @param handler the handler to invoke when a message is received + */ + public void onErrorMessage(Consumer handler) { + this.errorHandler = handler; + } + + /** + * Registers a handler for AgentV1Warning messages from the server. + * @param handler the handler to invoke when a message is received + */ + public void onWarning(Consumer handler) { + this.warningHandler = handler; + } + + /** + * Registers a handler for AgentV1Audio messages from the server. + * @param handler the handler to invoke when a message is received + */ + public void onAgentV1Audio(Consumer handler) { + this.agentV1AudioHandler = handler; + } + + /** + * Registers a handler called when the connection is established. + * @param handler the handler to invoke when connected + */ + public void onConnected(Runnable handler) { + this.onConnectedHandler = handler; + } + + /** + * Registers a handler called when the connection is closed. + * @param handler the handler to invoke when disconnected + */ + public void onDisconnected(Consumer handler) { + this.onDisconnectedHandler = handler; + } + + /** + * Registers a handler called when an error occurs. + * @param handler the handler to invoke on error + */ + public void onError(Consumer handler) { + this.onErrorHandler = handler; + } + + /** + * Registers a handler called for every incoming text message. + * The handler receives the raw JSON string before type-specific dispatch. + * @param handler the handler to invoke with the raw message JSON + */ + public void onMessage(Consumer handler) { + this.onMessageHandler = handler; + } + + /** + * Configures reconnection behavior. Must be called before {@link #connect}. + * + * @param options the reconnection options (backoff, retries, queue size) + */ + public void reconnectOptions(ReconnectingWebSocketListener.ReconnectOptions options) { + this.reconnectOptions = options; + } + + /** + * Closes this WebSocket client, releasing all resources. + * Equivalent to calling {@link #disconnect()}. + */ + @Override + public void close() { + disconnect(); + } + + /** + * Ensures the WebSocket is connected and ready to send messages. + * @throws IllegalStateException if the socket is not connected or not open + */ + private void assertSocketIsOpen() { + if (reconnectingListener.getWebSocket() == null) { + throw new IllegalStateException("WebSocket is not connected. Call connect() first."); + } + if (readyState != WebSocketReadyState.OPEN) { + throw new IllegalStateException("WebSocket is not open. Current state: " + readyState); + } + } + + private CompletableFuture sendMessage(Object body) { + CompletableFuture future = new CompletableFuture<>(); + try { + assertSocketIsOpen(); + String json = objectMapper.writeValueAsString(body); + // Use reconnecting listener's send method which handles queuing + reconnectingListener.send(json); + future.complete(null); + } catch (IllegalStateException e) { + future.completeExceptionally(e); + } catch (Exception e) { + future.completeExceptionally(new RuntimeException("Failed to send message", e)); + } + return future; + } + + private void handleIncomingMessage(String json) { + try { + if (onMessageHandler != null) { + onMessageHandler.accept(json); + } + JsonNode node = objectMapper.readTree(json); + if (node == null || node.isNull()) { + throw new IllegalArgumentException("Received null or invalid JSON message"); + } + JsonNode typeNode = node.get("type"); + if (typeNode == null || typeNode.isNull()) { + throw new IllegalArgumentException("Message missing 'type' field"); + } + String type = typeNode.asText(); + switch (type) { + case "FunctionCallResponse": + if (onFunctionCallResponseHandler != null) { + AgentV1ReceiveFunctionCallResponse event = + objectMapper.treeToValue(node, AgentV1ReceiveFunctionCallResponse.class); + if (event != null) { + onFunctionCallResponseHandler.accept(event); + } + } + break; + case "PromptUpdated": + if (promptUpdatedHandler != null) { + AgentV1PromptUpdated event = objectMapper.treeToValue(node, AgentV1PromptUpdated.class); + if (event != null) { + promptUpdatedHandler.accept(event); + } + } + break; + case "SpeakUpdated": + if (speakUpdatedHandler != null) { + AgentV1SpeakUpdated event = objectMapper.treeToValue(node, AgentV1SpeakUpdated.class); + if (event != null) { + speakUpdatedHandler.accept(event); + } + } + break; + case "InjectionRefused": + if (injectionRefusedHandler != null) { + AgentV1InjectionRefused event = objectMapper.treeToValue(node, AgentV1InjectionRefused.class); + if (event != null) { + injectionRefusedHandler.accept(event); + } + } + break; + case "Welcome": + if (welcomeHandler != null) { + AgentV1Welcome event = objectMapper.treeToValue(node, AgentV1Welcome.class); + if (event != null) { + welcomeHandler.accept(event); + } + } + break; + case "SettingsApplied": + if (settingsAppliedHandler != null) { + AgentV1SettingsApplied event = objectMapper.treeToValue(node, AgentV1SettingsApplied.class); + if (event != null) { + settingsAppliedHandler.accept(event); + } + } + break; + case "ConversationText": + if (conversationTextHandler != null) { + AgentV1ConversationText event = objectMapper.treeToValue(node, AgentV1ConversationText.class); + if (event != null) { + conversationTextHandler.accept(event); + } + } + break; + case "UserStartedSpeaking": + if (userStartedSpeakingHandler != null) { + AgentV1UserStartedSpeaking event = + objectMapper.treeToValue(node, AgentV1UserStartedSpeaking.class); + if (event != null) { + userStartedSpeakingHandler.accept(event); + } + } + break; + case "AgentThinking": + if (agentThinkingHandler != null) { + AgentV1AgentThinking event = objectMapper.treeToValue(node, AgentV1AgentThinking.class); + if (event != null) { + agentThinkingHandler.accept(event); + } + } + break; + case "FunctionCallRequest": + if (functionCallRequestHandler != null) { + AgentV1FunctionCallRequest event = + objectMapper.treeToValue(node, AgentV1FunctionCallRequest.class); + if (event != null) { + functionCallRequestHandler.accept(event); + } + } + break; + case "AgentStartedSpeaking": + if (agentStartedSpeakingHandler != null) { + AgentV1AgentStartedSpeaking event = + objectMapper.treeToValue(node, AgentV1AgentStartedSpeaking.class); + if (event != null) { + agentStartedSpeakingHandler.accept(event); + } + } + break; + case "AgentAudioDone": + if (agentAudioDoneHandler != null) { + AgentV1AgentAudioDone event = objectMapper.treeToValue(node, AgentV1AgentAudioDone.class); + if (event != null) { + agentAudioDoneHandler.accept(event); + } + } + break; + case "Error": + if (errorHandler != null) { + AgentV1Error event = objectMapper.treeToValue(node, AgentV1Error.class); + if (event != null) { + errorHandler.accept(event); + } + } + break; + case "Warning": + if (warningHandler != null) { + AgentV1Warning event = objectMapper.treeToValue(node, AgentV1Warning.class); + if (event != null) { + warningHandler.accept(event); + } + } + break; + default: + if (onErrorHandler != null) { + onErrorHandler.accept(new RuntimeException("Unknown WebSocket message type: '" + type + + "'. Update your SDK version to support new message types.")); + } + break; + } + } catch (Exception e) { + if (onErrorHandler != null) { + onErrorHandler.accept(e); + } + } + } +} diff --git a/src/main/java/com/deepgram/resources/auth/AsyncAuthClient.java b/src/main/java/com/deepgram/resources/auth/AsyncAuthClient.java new file mode 100644 index 0000000..9b3183a --- /dev/null +++ b/src/main/java/com/deepgram/resources/auth/AsyncAuthClient.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.auth; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.Suppliers; +import com.deepgram.resources.auth.v1.AsyncV1Client; +import java.util.function.Supplier; + +public class AsyncAuthClient { + protected final ClientOptions clientOptions; + + protected final Supplier v1Client; + + public AsyncAuthClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.v1Client = Suppliers.memoize(() -> new AsyncV1Client(clientOptions)); + } + + public AsyncV1Client v1() { + return this.v1Client.get(); + } +} diff --git a/src/main/java/com/deepgram/resources/auth/AuthClient.java b/src/main/java/com/deepgram/resources/auth/AuthClient.java new file mode 100644 index 0000000..7d07972 --- /dev/null +++ b/src/main/java/com/deepgram/resources/auth/AuthClient.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.auth; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.Suppliers; +import com.deepgram.resources.auth.v1.V1Client; +import java.util.function.Supplier; + +public class AuthClient { + protected final ClientOptions clientOptions; + + protected final Supplier v1Client; + + public AuthClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.v1Client = Suppliers.memoize(() -> new V1Client(clientOptions)); + } + + public V1Client v1() { + return this.v1Client.get(); + } +} diff --git a/src/main/java/com/deepgram/resources/auth/v1/AsyncV1Client.java b/src/main/java/com/deepgram/resources/auth/v1/AsyncV1Client.java new file mode 100644 index 0000000..d8299d0 --- /dev/null +++ b/src/main/java/com/deepgram/resources/auth/v1/AsyncV1Client.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.auth.v1; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.Suppliers; +import com.deepgram.resources.auth.v1.tokens.AsyncTokensClient; +import java.util.function.Supplier; + +public class AsyncV1Client { + protected final ClientOptions clientOptions; + + protected final Supplier tokensClient; + + public AsyncV1Client(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.tokensClient = Suppliers.memoize(() -> new AsyncTokensClient(clientOptions)); + } + + public AsyncTokensClient tokens() { + return this.tokensClient.get(); + } +} diff --git a/src/main/java/com/deepgram/resources/auth/v1/V1Client.java b/src/main/java/com/deepgram/resources/auth/v1/V1Client.java new file mode 100644 index 0000000..35696dc --- /dev/null +++ b/src/main/java/com/deepgram/resources/auth/v1/V1Client.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.auth.v1; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.Suppliers; +import com.deepgram.resources.auth.v1.tokens.TokensClient; +import java.util.function.Supplier; + +public class V1Client { + protected final ClientOptions clientOptions; + + protected final Supplier tokensClient; + + public V1Client(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.tokensClient = Suppliers.memoize(() -> new TokensClient(clientOptions)); + } + + public TokensClient tokens() { + return this.tokensClient.get(); + } +} diff --git a/src/main/java/com/deepgram/resources/auth/v1/tokens/AsyncRawTokensClient.java b/src/main/java/com/deepgram/resources/auth/v1/tokens/AsyncRawTokensClient.java new file mode 100644 index 0000000..a14d11d --- /dev/null +++ b/src/main/java/com/deepgram/resources/auth/v1/tokens/AsyncRawTokensClient.java @@ -0,0 +1,126 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.auth.v1.tokens; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.DeepgramApiApiException; +import com.deepgram.core.DeepgramApiException; +import com.deepgram.core.DeepgramApiHttpResponse; +import com.deepgram.core.MediaTypes; +import com.deepgram.core.ObjectMappers; +import com.deepgram.core.RequestOptions; +import com.deepgram.errors.BadRequestError; +import com.deepgram.resources.auth.v1.tokens.requests.GrantV1Request; +import com.deepgram.types.GrantV1Response; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawTokensClient { + protected final ClientOptions clientOptions; + + public AsyncRawTokensClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Generates a temporary JSON Web Token (JWT) with a 30-second (by default) TTL and usage::write permission for core voice APIs, requiring an API key with Member or higher authorization. Tokens created with this endpoint will not work with the Manage APIs. + */ + public CompletableFuture> grant() { + return grant(GrantV1Request.builder().build()); + } + + /** + * Generates a temporary JSON Web Token (JWT) with a 30-second (by default) TTL and usage::write permission for core voice APIs, requiring an API key with Member or higher authorization. Tokens created with this endpoint will not work with the Manage APIs. + */ + public CompletableFuture> grant(RequestOptions requestOptions) { + return grant(GrantV1Request.builder().build(), requestOptions); + } + + /** + * Generates a temporary JSON Web Token (JWT) with a 30-second (by default) TTL and usage::write permission for core voice APIs, requiring an API key with Member or higher authorization. Tokens created with this endpoint will not work with the Manage APIs. + */ + public CompletableFuture> grant(GrantV1Request request) { + return grant(request, null); + } + + /** + * Generates a temporary JSON Web Token (JWT) with a 30-second (by default) TTL and usage::write permission for core voice APIs, requiring an API key with Member or higher authorization. Tokens created with this endpoint will not work with the Manage APIs. + */ + public CompletableFuture> grant( + GrantV1Request request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/auth/grant"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new DeepgramApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GrantV1Response.class), + response)); + return; + } + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/deepgram/resources/auth/v1/tokens/AsyncTokensClient.java b/src/main/java/com/deepgram/resources/auth/v1/tokens/AsyncTokensClient.java new file mode 100644 index 0000000..75cbfae --- /dev/null +++ b/src/main/java/com/deepgram/resources/auth/v1/tokens/AsyncTokensClient.java @@ -0,0 +1,56 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.auth.v1.tokens; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.RequestOptions; +import com.deepgram.resources.auth.v1.tokens.requests.GrantV1Request; +import com.deepgram.types.GrantV1Response; +import java.util.concurrent.CompletableFuture; + +public class AsyncTokensClient { + protected final ClientOptions clientOptions; + + private final AsyncRawTokensClient rawClient; + + public AsyncTokensClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawTokensClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawTokensClient withRawResponse() { + return this.rawClient; + } + + /** + * Generates a temporary JSON Web Token (JWT) with a 30-second (by default) TTL and usage::write permission for core voice APIs, requiring an API key with Member or higher authorization. Tokens created with this endpoint will not work with the Manage APIs. + */ + public CompletableFuture grant() { + return this.rawClient.grant().thenApply(response -> response.body()); + } + + /** + * Generates a temporary JSON Web Token (JWT) with a 30-second (by default) TTL and usage::write permission for core voice APIs, requiring an API key with Member or higher authorization. Tokens created with this endpoint will not work with the Manage APIs. + */ + public CompletableFuture grant(RequestOptions requestOptions) { + return this.rawClient.grant(requestOptions).thenApply(response -> response.body()); + } + + /** + * Generates a temporary JSON Web Token (JWT) with a 30-second (by default) TTL and usage::write permission for core voice APIs, requiring an API key with Member or higher authorization. Tokens created with this endpoint will not work with the Manage APIs. + */ + public CompletableFuture grant(GrantV1Request request) { + return this.rawClient.grant(request).thenApply(response -> response.body()); + } + + /** + * Generates a temporary JSON Web Token (JWT) with a 30-second (by default) TTL and usage::write permission for core voice APIs, requiring an API key with Member or higher authorization. Tokens created with this endpoint will not work with the Manage APIs. + */ + public CompletableFuture grant(GrantV1Request request, RequestOptions requestOptions) { + return this.rawClient.grant(request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/deepgram/resources/auth/v1/tokens/RawTokensClient.java b/src/main/java/com/deepgram/resources/auth/v1/tokens/RawTokensClient.java new file mode 100644 index 0000000..59c0bcd --- /dev/null +++ b/src/main/java/com/deepgram/resources/auth/v1/tokens/RawTokensClient.java @@ -0,0 +1,106 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.auth.v1.tokens; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.DeepgramApiApiException; +import com.deepgram.core.DeepgramApiException; +import com.deepgram.core.DeepgramApiHttpResponse; +import com.deepgram.core.MediaTypes; +import com.deepgram.core.ObjectMappers; +import com.deepgram.core.RequestOptions; +import com.deepgram.errors.BadRequestError; +import com.deepgram.resources.auth.v1.tokens.requests.GrantV1Request; +import com.deepgram.types.GrantV1Response; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawTokensClient { + protected final ClientOptions clientOptions; + + public RawTokensClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Generates a temporary JSON Web Token (JWT) with a 30-second (by default) TTL and usage::write permission for core voice APIs, requiring an API key with Member or higher authorization. Tokens created with this endpoint will not work with the Manage APIs. + */ + public DeepgramApiHttpResponse grant() { + return grant(GrantV1Request.builder().build()); + } + + /** + * Generates a temporary JSON Web Token (JWT) with a 30-second (by default) TTL and usage::write permission for core voice APIs, requiring an API key with Member or higher authorization. Tokens created with this endpoint will not work with the Manage APIs. + */ + public DeepgramApiHttpResponse grant(RequestOptions requestOptions) { + return grant(GrantV1Request.builder().build(), requestOptions); + } + + /** + * Generates a temporary JSON Web Token (JWT) with a 30-second (by default) TTL and usage::write permission for core voice APIs, requiring an API key with Member or higher authorization. Tokens created with this endpoint will not work with the Manage APIs. + */ + public DeepgramApiHttpResponse grant(GrantV1Request request) { + return grant(request, null); + } + + /** + * Generates a temporary JSON Web Token (JWT) with a 30-second (by default) TTL and usage::write permission for core voice APIs, requiring an API key with Member or higher authorization. Tokens created with this endpoint will not work with the Manage APIs. + */ + public DeepgramApiHttpResponse grant(GrantV1Request request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/auth/grant"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new DeepgramApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GrantV1Response.class), response); + } + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new DeepgramApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/deepgram/resources/auth/v1/tokens/TokensClient.java b/src/main/java/com/deepgram/resources/auth/v1/tokens/TokensClient.java new file mode 100644 index 0000000..f826dcb --- /dev/null +++ b/src/main/java/com/deepgram/resources/auth/v1/tokens/TokensClient.java @@ -0,0 +1,55 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.auth.v1.tokens; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.RequestOptions; +import com.deepgram.resources.auth.v1.tokens.requests.GrantV1Request; +import com.deepgram.types.GrantV1Response; + +public class TokensClient { + protected final ClientOptions clientOptions; + + private final RawTokensClient rawClient; + + public TokensClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawTokensClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawTokensClient withRawResponse() { + return this.rawClient; + } + + /** + * Generates a temporary JSON Web Token (JWT) with a 30-second (by default) TTL and usage::write permission for core voice APIs, requiring an API key with Member or higher authorization. Tokens created with this endpoint will not work with the Manage APIs. + */ + public GrantV1Response grant() { + return this.rawClient.grant().body(); + } + + /** + * Generates a temporary JSON Web Token (JWT) with a 30-second (by default) TTL and usage::write permission for core voice APIs, requiring an API key with Member or higher authorization. Tokens created with this endpoint will not work with the Manage APIs. + */ + public GrantV1Response grant(RequestOptions requestOptions) { + return this.rawClient.grant(requestOptions).body(); + } + + /** + * Generates a temporary JSON Web Token (JWT) with a 30-second (by default) TTL and usage::write permission for core voice APIs, requiring an API key with Member or higher authorization. Tokens created with this endpoint will not work with the Manage APIs. + */ + public GrantV1Response grant(GrantV1Request request) { + return this.rawClient.grant(request).body(); + } + + /** + * Generates a temporary JSON Web Token (JWT) with a 30-second (by default) TTL and usage::write permission for core voice APIs, requiring an API key with Member or higher authorization. Tokens created with this endpoint will not work with the Manage APIs. + */ + public GrantV1Response grant(GrantV1Request request, RequestOptions requestOptions) { + return this.rawClient.grant(request, requestOptions).body(); + } +} diff --git a/src/main/java/com/deepgram/resources/auth/v1/tokens/requests/GrantV1Request.java b/src/main/java/com/deepgram/resources/auth/v1/tokens/requests/GrantV1Request.java new file mode 100644 index 0000000..ba29f16 --- /dev/null +++ b/src/main/java/com/deepgram/resources/auth/v1/tokens/requests/GrantV1Request.java @@ -0,0 +1,111 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.auth.v1.tokens.requests; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GrantV1Request.Builder.class) +public final class GrantV1Request { + private final Optional ttlSeconds; + + private final Map additionalProperties; + + private GrantV1Request(Optional ttlSeconds, Map additionalProperties) { + this.ttlSeconds = ttlSeconds; + this.additionalProperties = additionalProperties; + } + + /** + * @return Time to live in seconds for the token. Defaults to 30 seconds. + */ + @JsonProperty("ttl_seconds") + public Optional getTtlSeconds() { + return ttlSeconds; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GrantV1Request && equalTo((GrantV1Request) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GrantV1Request other) { + return ttlSeconds.equals(other.ttlSeconds); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.ttlSeconds); + } + + @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 ttlSeconds = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(GrantV1Request other) { + ttlSeconds(other.getTtlSeconds()); + return this; + } + + /** + *

Time to live in seconds for the token. Defaults to 30 seconds.

+ */ + @JsonSetter(value = "ttl_seconds", nulls = Nulls.SKIP) + public Builder ttlSeconds(Optional ttlSeconds) { + this.ttlSeconds = ttlSeconds; + return this; + } + + public Builder ttlSeconds(Double ttlSeconds) { + this.ttlSeconds = Optional.ofNullable(ttlSeconds); + return this; + } + + public GrantV1Request build() { + return new GrantV1Request(ttlSeconds, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/listen/AsyncListenClient.java b/src/main/java/com/deepgram/resources/listen/AsyncListenClient.java new file mode 100644 index 0000000..c2656ee --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/AsyncListenClient.java @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.Suppliers; +import com.deepgram.resources.listen.v1.AsyncV1Client; +import com.deepgram.resources.listen.v2.AsyncV2Client; +import java.util.function.Supplier; + +public class AsyncListenClient { + protected final ClientOptions clientOptions; + + protected final Supplier v1Client; + + protected final Supplier v2Client; + + public AsyncListenClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.v1Client = Suppliers.memoize(() -> new AsyncV1Client(clientOptions)); + this.v2Client = Suppliers.memoize(() -> new AsyncV2Client(clientOptions)); + } + + public AsyncV1Client v1() { + return this.v1Client.get(); + } + + public AsyncV2Client v2() { + return this.v2Client.get(); + } +} diff --git a/src/main/java/com/deepgram/resources/listen/ListenClient.java b/src/main/java/com/deepgram/resources/listen/ListenClient.java new file mode 100644 index 0000000..ad98ce1 --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/ListenClient.java @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.Suppliers; +import com.deepgram.resources.listen.v1.V1Client; +import com.deepgram.resources.listen.v2.V2Client; +import java.util.function.Supplier; + +public class ListenClient { + protected final ClientOptions clientOptions; + + protected final Supplier v1Client; + + protected final Supplier v2Client; + + public ListenClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.v1Client = Suppliers.memoize(() -> new V1Client(clientOptions)); + this.v2Client = Suppliers.memoize(() -> new V2Client(clientOptions)); + } + + public V1Client v1() { + return this.v1Client.get(); + } + + public V2Client v2() { + return this.v2Client.get(); + } +} diff --git a/src/main/java/com/deepgram/resources/listen/v1/AsyncV1Client.java b/src/main/java/com/deepgram/resources/listen/v1/AsyncV1Client.java new file mode 100644 index 0000000..45c0271 --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/v1/AsyncV1Client.java @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen.v1; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.Suppliers; +import com.deepgram.resources.listen.v1.media.AsyncMediaClient; +import com.deepgram.resources.listen.v1.websocket.V1WebSocketClient; +import java.util.function.Supplier; + +public class AsyncV1Client { + protected final ClientOptions clientOptions; + + protected final Supplier mediaClient; + + public AsyncV1Client(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.mediaClient = Suppliers.memoize(() -> new AsyncMediaClient(clientOptions)); + } + + /** + * Creates a new WebSocket client for the v1 channel. + */ + public V1WebSocketClient v1WebSocket() { + return new V1WebSocketClient(clientOptions); + } + + public AsyncMediaClient media() { + return this.mediaClient.get(); + } +} diff --git a/src/main/java/com/deepgram/resources/listen/v1/V1Client.java b/src/main/java/com/deepgram/resources/listen/v1/V1Client.java new file mode 100644 index 0000000..c43c016 --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/v1/V1Client.java @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen.v1; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.Suppliers; +import com.deepgram.resources.listen.v1.media.MediaClient; +import com.deepgram.resources.listen.v1.websocket.V1WebSocketClient; +import java.util.function.Supplier; + +public class V1Client { + protected final ClientOptions clientOptions; + + protected final Supplier mediaClient; + + public V1Client(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.mediaClient = Suppliers.memoize(() -> new MediaClient(clientOptions)); + } + + /** + * Creates a new WebSocket client for the v1 channel. + */ + public V1WebSocketClient v1WebSocket() { + return new V1WebSocketClient(clientOptions); + } + + public MediaClient media() { + return this.mediaClient.get(); + } +} diff --git a/src/main/java/com/deepgram/resources/listen/v1/media/AsyncMediaClient.java b/src/main/java/com/deepgram/resources/listen/v1/media/AsyncMediaClient.java new file mode 100644 index 0000000..14404b2 --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/v1/media/AsyncMediaClient.java @@ -0,0 +1,73 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen.v1.media; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.RequestOptions; +import com.deepgram.resources.listen.v1.media.requests.ListenV1RequestUrl; +import com.deepgram.resources.listen.v1.media.requests.MediaTranscribeRequestOctetStream; +import com.deepgram.resources.listen.v1.media.types.MediaTranscribeResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncMediaClient { + protected final ClientOptions clientOptions; + + private final AsyncRawMediaClient rawClient; + + public AsyncMediaClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawMediaClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawMediaClient withRawResponse() { + return this.rawClient; + } + + /** + * Transcribe audio and video using Deepgram's speech-to-text REST API + */ + public CompletableFuture transcribeUrl(ListenV1RequestUrl request) { + return this.rawClient.transcribeUrl(request).thenApply(response -> response.body()); + } + + /** + * Transcribe audio and video using Deepgram's speech-to-text REST API + */ + public CompletableFuture transcribeUrl( + ListenV1RequestUrl request, RequestOptions requestOptions) { + return this.rawClient.transcribeUrl(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Transcribe audio and video using Deepgram's speech-to-text REST API + */ + public CompletableFuture transcribeFile(byte[] body) { + return this.rawClient.transcribeFile(body).thenApply(response -> response.body()); + } + + /** + * Transcribe audio and video using Deepgram's speech-to-text REST API + */ + public CompletableFuture transcribeFile(byte[] body, RequestOptions requestOptions) { + return this.rawClient.transcribeFile(body, requestOptions).thenApply(response -> response.body()); + } + + /** + * Transcribe audio and video using Deepgram's speech-to-text REST API + */ + public CompletableFuture transcribeFile(MediaTranscribeRequestOctetStream request) { + return this.rawClient.transcribeFile(request).thenApply(response -> response.body()); + } + + /** + * Transcribe audio and video using Deepgram's speech-to-text REST API + */ + public CompletableFuture transcribeFile( + MediaTranscribeRequestOctetStream request, RequestOptions requestOptions) { + return this.rawClient.transcribeFile(request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/deepgram/resources/listen/v1/media/AsyncRawMediaClient.java b/src/main/java/com/deepgram/resources/listen/v1/media/AsyncRawMediaClient.java new file mode 100644 index 0000000..6b70924 --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/v1/media/AsyncRawMediaClient.java @@ -0,0 +1,493 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen.v1.media; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.DeepgramApiApiException; +import com.deepgram.core.DeepgramApiException; +import com.deepgram.core.DeepgramApiHttpResponse; +import com.deepgram.core.InputStreamRequestBody; +import com.deepgram.core.MediaTypes; +import com.deepgram.core.ObjectMappers; +import com.deepgram.core.QueryStringMapper; +import com.deepgram.core.RequestOptions; +import com.deepgram.errors.BadRequestError; +import com.deepgram.resources.listen.v1.media.requests.ListenV1RequestUrl; +import com.deepgram.resources.listen.v1.media.requests.MediaTranscribeRequestOctetStream; +import com.deepgram.resources.listen.v1.media.types.MediaTranscribeResponse; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.MediaType; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawMediaClient { + protected final ClientOptions clientOptions; + + public AsyncRawMediaClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Transcribe audio and video using Deepgram's speech-to-text REST API + */ + public CompletableFuture> transcribeUrl( + ListenV1RequestUrl request) { + return transcribeUrl(request, null); + } + + /** + * Transcribe audio and video using Deepgram's speech-to-text REST API + */ + public CompletableFuture> transcribeUrl( + ListenV1RequestUrl request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/listen"); + if (request.getCallback().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "callback", request.getCallback().get(), false); + } + if (request.getCallbackMethod().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "callback_method", request.getCallbackMethod().get(), false); + } + if (request.getSentiment().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "sentiment", request.getSentiment().get(), false); + } + if (request.getSummarize().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "summarize", request.getSummarize().get(), false); + } + if (request.getTopics().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "topics", request.getTopics().get(), false); + } + if (request.getCustomTopicMode().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "custom_topic_mode", request.getCustomTopicMode().get(), false); + } + if (request.getIntents().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "intents", request.getIntents().get(), false); + } + if (request.getCustomIntentMode().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "custom_intent_mode", request.getCustomIntentMode().get(), false); + } + if (request.getDetectEntities().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "detect_entities", request.getDetectEntities().get(), false); + } + if (request.getDetectLanguage().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "detect_language", request.getDetectLanguage().get(), false); + } + if (request.getDiarize().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "diarize", request.getDiarize().get(), false); + } + if (request.getDictation().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "dictation", request.getDictation().get(), false); + } + if (request.getEncoding().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "encoding", request.getEncoding().get(), false); + } + if (request.getFillerWords().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "filler_words", request.getFillerWords().get(), false); + } + if (request.getLanguage().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "language", request.getLanguage().get(), false); + } + if (request.getMeasurements().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "measurements", request.getMeasurements().get(), false); + } + if (request.getModel().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "model", request.getModel().get(), false); + } + if (request.getMultichannel().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "multichannel", request.getMultichannel().get(), false); + } + if (request.getNumerals().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "numerals", request.getNumerals().get(), false); + } + if (request.getParagraphs().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "paragraphs", request.getParagraphs().get(), false); + } + if (request.getProfanityFilter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "profanity_filter", request.getProfanityFilter().get(), false); + } + if (request.getPunctuate().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "punctuate", request.getPunctuate().get(), false); + } + if (request.getRedact().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "redact", request.getRedact().get(), false); + } + if (request.getSmartFormat().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "smart_format", request.getSmartFormat().get(), false); + } + if (request.getUtterances().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "utterances", request.getUtterances().get(), false); + } + if (request.getUttSplit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "utt_split", request.getUttSplit().get(), false); + } + if (request.getVersion().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "version", request.getVersion().get(), false); + } + if (request.getMipOptOut().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "mip_opt_out", request.getMipOptOut().get(), false); + } + if (request.getExtra().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "extra", request.getExtra().get(), true); + } + if (request.getTag().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "tag", request.getTag().get(), true); + } + if (request.getCustomTopic().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "custom_topic", request.getCustomTopic().get(), true); + } + if (request.getCustomIntent().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "custom_intent", request.getCustomIntent().get(), true); + } + if (request.getKeyterm().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "keyterm", request.getKeyterm().get(), true); + } + if (request.getKeywords().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "keywords", request.getKeywords().get(), true); + } + if (request.getReplace().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "replace", request.getReplace().get(), true); + } + if (request.getSearch().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "search", request.getSearch().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, MediaTranscribeResponse.class), + response)); + return; + } + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Transcribe audio and video using Deepgram's speech-to-text REST API + */ + public CompletableFuture> transcribeFile(byte[] body) { + return transcribeFile( + MediaTranscribeRequestOctetStream.builder().body(body).build()); + } + + /** + * Transcribe audio and video using Deepgram's speech-to-text REST API + */ + public CompletableFuture> transcribeFile( + byte[] body, RequestOptions requestOptions) { + return transcribeFile( + MediaTranscribeRequestOctetStream.builder().body(body).build(), requestOptions); + } + + /** + * Transcribe audio and video using Deepgram's speech-to-text REST API + */ + public CompletableFuture> transcribeFile( + MediaTranscribeRequestOctetStream request) { + return transcribeFile(request, null); + } + + /** + * Transcribe audio and video using Deepgram's speech-to-text REST API + */ + public CompletableFuture> transcribeFile( + MediaTranscribeRequestOctetStream request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/listen"); + if (request.getCallback().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "callback", request.getCallback().get(), false); + } + if (request.getCallbackMethod().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "callback_method", request.getCallbackMethod().get(), false); + } + if (request.getSentiment().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "sentiment", request.getSentiment().get(), false); + } + if (request.getSummarize().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "summarize", request.getSummarize().get(), false); + } + if (request.getTopics().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "topics", request.getTopics().get(), false); + } + if (request.getCustomTopicMode().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "custom_topic_mode", request.getCustomTopicMode().get(), false); + } + if (request.getIntents().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "intents", request.getIntents().get(), false); + } + if (request.getCustomIntentMode().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "custom_intent_mode", request.getCustomIntentMode().get(), false); + } + if (request.getDetectEntities().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "detect_entities", request.getDetectEntities().get(), false); + } + if (request.getDetectLanguage().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "detect_language", request.getDetectLanguage().get(), false); + } + if (request.getDiarize().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "diarize", request.getDiarize().get(), false); + } + if (request.getDictation().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "dictation", request.getDictation().get(), false); + } + if (request.getEncoding().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "encoding", request.getEncoding().get(), false); + } + if (request.getFillerWords().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "filler_words", request.getFillerWords().get(), false); + } + if (request.getLanguage().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "language", request.getLanguage().get(), false); + } + if (request.getMeasurements().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "measurements", request.getMeasurements().get(), false); + } + if (request.getModel().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "model", request.getModel().get(), false); + } + if (request.getMultichannel().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "multichannel", request.getMultichannel().get(), false); + } + if (request.getNumerals().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "numerals", request.getNumerals().get(), false); + } + if (request.getParagraphs().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "paragraphs", request.getParagraphs().get(), false); + } + if (request.getProfanityFilter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "profanity_filter", request.getProfanityFilter().get(), false); + } + if (request.getPunctuate().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "punctuate", request.getPunctuate().get(), false); + } + if (request.getRedact().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "redact", request.getRedact().get(), false); + } + if (request.getSmartFormat().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "smart_format", request.getSmartFormat().get(), false); + } + if (request.getUtterances().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "utterances", request.getUtterances().get(), false); + } + if (request.getUttSplit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "utt_split", request.getUttSplit().get(), false); + } + if (request.getVersion().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "version", request.getVersion().get(), false); + } + if (request.getMipOptOut().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "mip_opt_out", request.getMipOptOut().get(), false); + } + if (request.getExtra().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "extra", request.getExtra().get(), true); + } + if (request.getTag().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "tag", request.getTag().get(), true); + } + if (request.getCustomTopic().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "custom_topic", request.getCustomTopic().get(), true); + } + if (request.getCustomIntent().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "custom_intent", request.getCustomIntent().get(), true); + } + if (request.getKeyterm().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "keyterm", request.getKeyterm().get(), true); + } + if (request.getKeywords().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "keywords", request.getKeywords().get(), true); + } + if (request.getReplace().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "replace", request.getReplace().get(), true); + } + if (request.getSearch().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "search", request.getSearch().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body = new InputStreamRequestBody( + MediaType.parse("application/octet-stream"), new ByteArrayInputStream(request.getBody())); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/octet-stream") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, MediaTranscribeResponse.class), + response)); + return; + } + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/deepgram/resources/listen/v1/media/MediaClient.java b/src/main/java/com/deepgram/resources/listen/v1/media/MediaClient.java new file mode 100644 index 0000000..2932caf --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/v1/media/MediaClient.java @@ -0,0 +1,71 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen.v1.media; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.RequestOptions; +import com.deepgram.resources.listen.v1.media.requests.ListenV1RequestUrl; +import com.deepgram.resources.listen.v1.media.requests.MediaTranscribeRequestOctetStream; +import com.deepgram.resources.listen.v1.media.types.MediaTranscribeResponse; + +public class MediaClient { + protected final ClientOptions clientOptions; + + private final RawMediaClient rawClient; + + public MediaClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawMediaClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawMediaClient withRawResponse() { + return this.rawClient; + } + + /** + * Transcribe audio and video using Deepgram's speech-to-text REST API + */ + public MediaTranscribeResponse transcribeUrl(ListenV1RequestUrl request) { + return this.rawClient.transcribeUrl(request).body(); + } + + /** + * Transcribe audio and video using Deepgram's speech-to-text REST API + */ + public MediaTranscribeResponse transcribeUrl(ListenV1RequestUrl request, RequestOptions requestOptions) { + return this.rawClient.transcribeUrl(request, requestOptions).body(); + } + + /** + * Transcribe audio and video using Deepgram's speech-to-text REST API + */ + public MediaTranscribeResponse transcribeFile(byte[] body) { + return this.rawClient.transcribeFile(body).body(); + } + + /** + * Transcribe audio and video using Deepgram's speech-to-text REST API + */ + public MediaTranscribeResponse transcribeFile(byte[] body, RequestOptions requestOptions) { + return this.rawClient.transcribeFile(body, requestOptions).body(); + } + + /** + * Transcribe audio and video using Deepgram's speech-to-text REST API + */ + public MediaTranscribeResponse transcribeFile(MediaTranscribeRequestOctetStream request) { + return this.rawClient.transcribeFile(request).body(); + } + + /** + * Transcribe audio and video using Deepgram's speech-to-text REST API + */ + public MediaTranscribeResponse transcribeFile( + MediaTranscribeRequestOctetStream request, RequestOptions requestOptions) { + return this.rawClient.transcribeFile(request, requestOptions).body(); + } +} diff --git a/src/main/java/com/deepgram/resources/listen/v1/media/RawMediaClient.java b/src/main/java/com/deepgram/resources/listen/v1/media/RawMediaClient.java new file mode 100644 index 0000000..cbbbfb3 --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/v1/media/RawMediaClient.java @@ -0,0 +1,458 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen.v1.media; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.DeepgramApiApiException; +import com.deepgram.core.DeepgramApiException; +import com.deepgram.core.DeepgramApiHttpResponse; +import com.deepgram.core.InputStreamRequestBody; +import com.deepgram.core.MediaTypes; +import com.deepgram.core.ObjectMappers; +import com.deepgram.core.QueryStringMapper; +import com.deepgram.core.RequestOptions; +import com.deepgram.errors.BadRequestError; +import com.deepgram.resources.listen.v1.media.requests.ListenV1RequestUrl; +import com.deepgram.resources.listen.v1.media.requests.MediaTranscribeRequestOctetStream; +import com.deepgram.resources.listen.v1.media.types.MediaTranscribeResponse; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.MediaType; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawMediaClient { + protected final ClientOptions clientOptions; + + public RawMediaClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Transcribe audio and video using Deepgram's speech-to-text REST API + */ + public DeepgramApiHttpResponse transcribeUrl(ListenV1RequestUrl request) { + return transcribeUrl(request, null); + } + + /** + * Transcribe audio and video using Deepgram's speech-to-text REST API + */ + public DeepgramApiHttpResponse transcribeUrl( + ListenV1RequestUrl request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/listen"); + if (request.getCallback().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "callback", request.getCallback().get(), false); + } + if (request.getCallbackMethod().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "callback_method", request.getCallbackMethod().get(), false); + } + if (request.getSentiment().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "sentiment", request.getSentiment().get(), false); + } + if (request.getSummarize().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "summarize", request.getSummarize().get(), false); + } + if (request.getTopics().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "topics", request.getTopics().get(), false); + } + if (request.getCustomTopicMode().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "custom_topic_mode", request.getCustomTopicMode().get(), false); + } + if (request.getIntents().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "intents", request.getIntents().get(), false); + } + if (request.getCustomIntentMode().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "custom_intent_mode", request.getCustomIntentMode().get(), false); + } + if (request.getDetectEntities().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "detect_entities", request.getDetectEntities().get(), false); + } + if (request.getDetectLanguage().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "detect_language", request.getDetectLanguage().get(), false); + } + if (request.getDiarize().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "diarize", request.getDiarize().get(), false); + } + if (request.getDictation().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "dictation", request.getDictation().get(), false); + } + if (request.getEncoding().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "encoding", request.getEncoding().get(), false); + } + if (request.getFillerWords().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "filler_words", request.getFillerWords().get(), false); + } + if (request.getLanguage().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "language", request.getLanguage().get(), false); + } + if (request.getMeasurements().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "measurements", request.getMeasurements().get(), false); + } + if (request.getModel().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "model", request.getModel().get(), false); + } + if (request.getMultichannel().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "multichannel", request.getMultichannel().get(), false); + } + if (request.getNumerals().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "numerals", request.getNumerals().get(), false); + } + if (request.getParagraphs().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "paragraphs", request.getParagraphs().get(), false); + } + if (request.getProfanityFilter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "profanity_filter", request.getProfanityFilter().get(), false); + } + if (request.getPunctuate().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "punctuate", request.getPunctuate().get(), false); + } + if (request.getRedact().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "redact", request.getRedact().get(), false); + } + if (request.getSmartFormat().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "smart_format", request.getSmartFormat().get(), false); + } + if (request.getUtterances().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "utterances", request.getUtterances().get(), false); + } + if (request.getUttSplit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "utt_split", request.getUttSplit().get(), false); + } + if (request.getVersion().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "version", request.getVersion().get(), false); + } + if (request.getMipOptOut().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "mip_opt_out", request.getMipOptOut().get(), false); + } + if (request.getExtra().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "extra", request.getExtra().get(), true); + } + if (request.getTag().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "tag", request.getTag().get(), true); + } + if (request.getCustomTopic().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "custom_topic", request.getCustomTopic().get(), true); + } + if (request.getCustomIntent().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "custom_intent", request.getCustomIntent().get(), true); + } + if (request.getKeyterm().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "keyterm", request.getKeyterm().get(), true); + } + if (request.getKeywords().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "keywords", request.getKeywords().get(), true); + } + if (request.getReplace().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "replace", request.getReplace().get(), true); + } + if (request.getSearch().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "search", request.getSearch().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, MediaTranscribeResponse.class), + response); + } + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new DeepgramApiException("Network error executing HTTP request", e); + } + } + + /** + * Transcribe audio and video using Deepgram's speech-to-text REST API + */ + public DeepgramApiHttpResponse transcribeFile(byte[] body) { + return transcribeFile( + MediaTranscribeRequestOctetStream.builder().body(body).build()); + } + + /** + * Transcribe audio and video using Deepgram's speech-to-text REST API + */ + public DeepgramApiHttpResponse transcribeFile(byte[] body, RequestOptions requestOptions) { + return transcribeFile( + MediaTranscribeRequestOctetStream.builder().body(body).build(), requestOptions); + } + + /** + * Transcribe audio and video using Deepgram's speech-to-text REST API + */ + public DeepgramApiHttpResponse transcribeFile(MediaTranscribeRequestOctetStream request) { + return transcribeFile(request, null); + } + + /** + * Transcribe audio and video using Deepgram's speech-to-text REST API + */ + public DeepgramApiHttpResponse transcribeFile( + MediaTranscribeRequestOctetStream request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/listen"); + if (request.getCallback().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "callback", request.getCallback().get(), false); + } + if (request.getCallbackMethod().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "callback_method", request.getCallbackMethod().get(), false); + } + if (request.getSentiment().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "sentiment", request.getSentiment().get(), false); + } + if (request.getSummarize().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "summarize", request.getSummarize().get(), false); + } + if (request.getTopics().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "topics", request.getTopics().get(), false); + } + if (request.getCustomTopicMode().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "custom_topic_mode", request.getCustomTopicMode().get(), false); + } + if (request.getIntents().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "intents", request.getIntents().get(), false); + } + if (request.getCustomIntentMode().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "custom_intent_mode", request.getCustomIntentMode().get(), false); + } + if (request.getDetectEntities().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "detect_entities", request.getDetectEntities().get(), false); + } + if (request.getDetectLanguage().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "detect_language", request.getDetectLanguage().get(), false); + } + if (request.getDiarize().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "diarize", request.getDiarize().get(), false); + } + if (request.getDictation().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "dictation", request.getDictation().get(), false); + } + if (request.getEncoding().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "encoding", request.getEncoding().get(), false); + } + if (request.getFillerWords().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "filler_words", request.getFillerWords().get(), false); + } + if (request.getLanguage().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "language", request.getLanguage().get(), false); + } + if (request.getMeasurements().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "measurements", request.getMeasurements().get(), false); + } + if (request.getModel().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "model", request.getModel().get(), false); + } + if (request.getMultichannel().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "multichannel", request.getMultichannel().get(), false); + } + if (request.getNumerals().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "numerals", request.getNumerals().get(), false); + } + if (request.getParagraphs().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "paragraphs", request.getParagraphs().get(), false); + } + if (request.getProfanityFilter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "profanity_filter", request.getProfanityFilter().get(), false); + } + if (request.getPunctuate().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "punctuate", request.getPunctuate().get(), false); + } + if (request.getRedact().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "redact", request.getRedact().get(), false); + } + if (request.getSmartFormat().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "smart_format", request.getSmartFormat().get(), false); + } + if (request.getUtterances().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "utterances", request.getUtterances().get(), false); + } + if (request.getUttSplit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "utt_split", request.getUttSplit().get(), false); + } + if (request.getVersion().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "version", request.getVersion().get(), false); + } + if (request.getMipOptOut().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "mip_opt_out", request.getMipOptOut().get(), false); + } + if (request.getExtra().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "extra", request.getExtra().get(), true); + } + if (request.getTag().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "tag", request.getTag().get(), true); + } + if (request.getCustomTopic().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "custom_topic", request.getCustomTopic().get(), true); + } + if (request.getCustomIntent().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "custom_intent", request.getCustomIntent().get(), true); + } + if (request.getKeyterm().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "keyterm", request.getKeyterm().get(), true); + } + if (request.getKeywords().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "keywords", request.getKeywords().get(), true); + } + if (request.getReplace().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "replace", request.getReplace().get(), true); + } + if (request.getSearch().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "search", request.getSearch().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body = new InputStreamRequestBody( + MediaType.parse("application/octet-stream"), new ByteArrayInputStream(request.getBody())); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/octet-stream") + .addHeader("Accept", "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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, MediaTranscribeResponse.class), + response); + } + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new DeepgramApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/deepgram/resources/listen/v1/media/requests/ListenV1RequestUrl.java b/src/main/java/com/deepgram/resources/listen/v1/media/requests/ListenV1RequestUrl.java new file mode 100644 index 0000000..52388cf --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/v1/media/requests/ListenV1RequestUrl.java @@ -0,0 +1,1819 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen.v1.media.requests; + +import com.deepgram.core.ObjectMappers; +import com.deepgram.resources.listen.v1.media.types.MediaTranscribeRequestCallbackMethod; +import com.deepgram.resources.listen.v1.media.types.MediaTranscribeRequestCustomIntentMode; +import com.deepgram.resources.listen.v1.media.types.MediaTranscribeRequestCustomTopicMode; +import com.deepgram.resources.listen.v1.media.types.MediaTranscribeRequestEncoding; +import com.deepgram.resources.listen.v1.media.types.MediaTranscribeRequestModel; +import com.deepgram.resources.listen.v1.media.types.MediaTranscribeRequestSummarize; +import com.deepgram.resources.listen.v1.media.types.MediaTranscribeRequestVersion; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.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 java.util.Collections; +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 = ListenV1RequestUrl.Builder.class) +public final class ListenV1RequestUrl { + private final Optional> extra; + + private final Optional> tag; + + private final Optional> customTopic; + + private final Optional> customIntent; + + private final Optional> keyterm; + + private final Optional> keywords; + + private final Optional> replace; + + private final Optional> search; + + private final Optional callback; + + private final Optional callbackMethod; + + private final Optional sentiment; + + private final Optional summarize; + + private final Optional topics; + + private final Optional customTopicMode; + + private final Optional intents; + + private final Optional customIntentMode; + + private final Optional detectEntities; + + private final Optional detectLanguage; + + private final Optional diarize; + + private final Optional dictation; + + private final Optional encoding; + + private final Optional fillerWords; + + private final Optional language; + + private final Optional measurements; + + private final Optional model; + + private final Optional multichannel; + + private final Optional numerals; + + private final Optional paragraphs; + + private final Optional profanityFilter; + + private final Optional punctuate; + + private final Optional redact; + + private final Optional smartFormat; + + private final Optional utterances; + + private final Optional uttSplit; + + private final Optional version; + + private final Optional mipOptOut; + + private final String url; + + private final Map additionalProperties; + + private ListenV1RequestUrl( + Optional> extra, + Optional> tag, + Optional> customTopic, + Optional> customIntent, + Optional> keyterm, + Optional> keywords, + Optional> replace, + Optional> search, + Optional callback, + Optional callbackMethod, + Optional sentiment, + Optional summarize, + Optional topics, + Optional customTopicMode, + Optional intents, + Optional customIntentMode, + Optional detectEntities, + Optional detectLanguage, + Optional diarize, + Optional dictation, + Optional encoding, + Optional fillerWords, + Optional language, + Optional measurements, + Optional model, + Optional multichannel, + Optional numerals, + Optional paragraphs, + Optional profanityFilter, + Optional punctuate, + Optional redact, + Optional smartFormat, + Optional utterances, + Optional uttSplit, + Optional version, + Optional mipOptOut, + String url, + Map additionalProperties) { + this.extra = extra; + this.tag = tag; + this.customTopic = customTopic; + this.customIntent = customIntent; + this.keyterm = keyterm; + this.keywords = keywords; + this.replace = replace; + this.search = search; + this.callback = callback; + this.callbackMethod = callbackMethod; + this.sentiment = sentiment; + this.summarize = summarize; + this.topics = topics; + this.customTopicMode = customTopicMode; + this.intents = intents; + this.customIntentMode = customIntentMode; + this.detectEntities = detectEntities; + this.detectLanguage = detectLanguage; + this.diarize = diarize; + this.dictation = dictation; + this.encoding = encoding; + this.fillerWords = fillerWords; + this.language = language; + this.measurements = measurements; + this.model = model; + this.multichannel = multichannel; + this.numerals = numerals; + this.paragraphs = paragraphs; + this.profanityFilter = profanityFilter; + this.punctuate = punctuate; + this.redact = redact; + this.smartFormat = smartFormat; + this.utterances = utterances; + this.uttSplit = uttSplit; + this.version = version; + this.mipOptOut = mipOptOut; + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return Arbitrary key-value pairs that are attached to the API response for usage in downstream processing + */ + @JsonIgnore + public Optional> getExtra() { + return extra; + } + + /** + * @return Label your requests for the purpose of identification during usage reporting + */ + @JsonIgnore + public Optional> getTag() { + return tag; + } + + /** + * @return Custom topics you want the model to detect within your input audio or text if present Submit up to 100. + */ + @JsonIgnore + public Optional> getCustomTopic() { + return customTopic; + } + + /** + * @return Custom intents you want the model to detect within your input audio if present + */ + @JsonIgnore + public Optional> getCustomIntent() { + return customIntent; + } + + /** + * @return Key term prompting can boost or suppress specialized terminology and brands. Only compatible with Nova-3 + */ + @JsonIgnore + public Optional> getKeyterm() { + return keyterm; + } + + /** + * @return Keywords can boost or suppress specialized terminology and brands + */ + @JsonIgnore + public Optional> getKeywords() { + return keywords; + } + + /** + * @return Search for terms or phrases in submitted audio and replaces them + */ + @JsonIgnore + public Optional> getReplace() { + return replace; + } + + /** + * @return Search for terms or phrases in submitted audio + */ + @JsonIgnore + public Optional> getSearch() { + return search; + } + + /** + * @return URL to which we'll make the callback request + */ + @JsonIgnore + public Optional getCallback() { + return callback; + } + + /** + * @return HTTP method by which the callback request will be made + */ + @JsonIgnore + public Optional getCallbackMethod() { + return callbackMethod; + } + + /** + * @return Recognizes the sentiment throughout a transcript or text + */ + @JsonIgnore + public Optional getSentiment() { + return sentiment; + } + + /** + * @return Summarize content. For Listen API, supports string version option. For Read API, accepts boolean only. + */ + @JsonIgnore + public Optional getSummarize() { + return summarize; + } + + /** + * @return Detect topics throughout a transcript or text + */ + @JsonIgnore + public Optional getTopics() { + return topics; + } + + /** + * @return Sets how the model will interpret strings submitted to the custom_topic param. When strict, the model will only return topics submitted using the custom_topic param. When extended, the model will return its own detected topics in addition to those submitted using the custom_topic param + */ + @JsonIgnore + public Optional getCustomTopicMode() { + return customTopicMode; + } + + /** + * @return Recognizes speaker intent throughout a transcript or text + */ + @JsonIgnore + public Optional getIntents() { + return intents; + } + + /** + * @return Sets how the model will interpret intents submitted to the custom_intent param. When strict, the model will only return intents submitted using the custom_intent param. When extended, the model will return its own detected intents in the custom_intent param. + */ + @JsonIgnore + public Optional getCustomIntentMode() { + return customIntentMode; + } + + /** + * @return Identifies and extracts key entities from content in submitted audio + */ + @JsonIgnore + public Optional getDetectEntities() { + return detectEntities; + } + + /** + * @return Identifies the dominant language spoken in submitted audio + */ + @JsonIgnore + public Optional getDetectLanguage() { + return detectLanguage; + } + + /** + * @return Recognize speaker changes. Each word in the transcript will be assigned a speaker number starting at 0 + */ + @JsonIgnore + public Optional getDiarize() { + return diarize; + } + + /** + * @return Dictation mode for controlling formatting with dictated speech + */ + @JsonIgnore + public Optional getDictation() { + return dictation; + } + + /** + * @return Specify the expected encoding of your submitted audio + */ + @JsonIgnore + public Optional getEncoding() { + return encoding; + } + + /** + * @return Filler Words can help transcribe interruptions in your audio, like "uh" and "um" + */ + @JsonIgnore + public Optional getFillerWords() { + return fillerWords; + } + + /** + * @return The BCP-47 language tag that hints at the primary spoken language. Depending on the Model and API endpoint you choose only certain languages are available + */ + @JsonIgnore + public Optional getLanguage() { + return language; + } + + /** + * @return Spoken measurements will be converted to their corresponding abbreviations + */ + @JsonIgnore + public Optional getMeasurements() { + return measurements; + } + + /** + * @return AI model used to process submitted audio + */ + @JsonIgnore + public Optional getModel() { + return model; + } + + /** + * @return Transcribe each audio channel independently + */ + @JsonIgnore + public Optional getMultichannel() { + return multichannel; + } + + /** + * @return Numerals converts numbers from written format to numerical format + */ + @JsonIgnore + public Optional getNumerals() { + return numerals; + } + + /** + * @return Splits audio into paragraphs to improve transcript readability + */ + @JsonIgnore + public Optional getParagraphs() { + return paragraphs; + } + + /** + * @return Profanity Filter looks for recognized profanity and converts it to the nearest recognized non-profane word or removes it from the transcript completely + */ + @JsonIgnore + public Optional getProfanityFilter() { + return profanityFilter; + } + + /** + * @return Add punctuation and capitalization to the transcript + */ + @JsonIgnore + public Optional getPunctuate() { + return punctuate; + } + + /** + * @return Redaction removes sensitive information from your transcripts + */ + @JsonIgnore + public Optional getRedact() { + return redact; + } + + /** + * @return Apply formatting to transcript output. When set to true, additional formatting will be applied to transcripts to improve readability + */ + @JsonIgnore + public Optional getSmartFormat() { + return smartFormat; + } + + /** + * @return Segments speech into meaningful semantic units + */ + @JsonIgnore + public Optional getUtterances() { + return utterances; + } + + /** + * @return Seconds to wait before detecting a pause between words in submitted audio + */ + @JsonIgnore + public Optional getUttSplit() { + return uttSplit; + } + + /** + * @return Version of an AI model to use + */ + @JsonIgnore + public Optional getVersion() { + return version; + } + + /** + * @return Opts out requests from the Deepgram Model Improvement Program. Refer to our Docs for pricing impacts before setting this to true. https://dpgr.am/deepgram-mip + */ + @JsonIgnore + public Optional getMipOptOut() { + return mipOptOut; + } + + @JsonProperty("url") + public String getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListenV1RequestUrl && equalTo((ListenV1RequestUrl) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListenV1RequestUrl other) { + return extra.equals(other.extra) + && tag.equals(other.tag) + && customTopic.equals(other.customTopic) + && customIntent.equals(other.customIntent) + && keyterm.equals(other.keyterm) + && keywords.equals(other.keywords) + && replace.equals(other.replace) + && search.equals(other.search) + && callback.equals(other.callback) + && callbackMethod.equals(other.callbackMethod) + && sentiment.equals(other.sentiment) + && summarize.equals(other.summarize) + && topics.equals(other.topics) + && customTopicMode.equals(other.customTopicMode) + && intents.equals(other.intents) + && customIntentMode.equals(other.customIntentMode) + && detectEntities.equals(other.detectEntities) + && detectLanguage.equals(other.detectLanguage) + && diarize.equals(other.diarize) + && dictation.equals(other.dictation) + && encoding.equals(other.encoding) + && fillerWords.equals(other.fillerWords) + && language.equals(other.language) + && measurements.equals(other.measurements) + && model.equals(other.model) + && multichannel.equals(other.multichannel) + && numerals.equals(other.numerals) + && paragraphs.equals(other.paragraphs) + && profanityFilter.equals(other.profanityFilter) + && punctuate.equals(other.punctuate) + && redact.equals(other.redact) + && smartFormat.equals(other.smartFormat) + && utterances.equals(other.utterances) + && uttSplit.equals(other.uttSplit) + && version.equals(other.version) + && mipOptOut.equals(other.mipOptOut) + && url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.extra, + this.tag, + this.customTopic, + this.customIntent, + this.keyterm, + this.keywords, + this.replace, + this.search, + this.callback, + this.callbackMethod, + this.sentiment, + this.summarize, + this.topics, + this.customTopicMode, + this.intents, + this.customIntentMode, + this.detectEntities, + this.detectLanguage, + this.diarize, + this.dictation, + this.encoding, + this.fillerWords, + this.language, + this.measurements, + this.model, + this.multichannel, + this.numerals, + this.paragraphs, + this.profanityFilter, + this.punctuate, + this.redact, + this.smartFormat, + this.utterances, + this.uttSplit, + this.version, + this.mipOptOut, + this.url); + } + + @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(ListenV1RequestUrl other); + } + + public interface _FinalStage { + ListenV1RequestUrl build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Arbitrary key-value pairs that are attached to the API response for usage in downstream processing

+ */ + _FinalStage extra(Optional> extra); + + _FinalStage extra(List extra); + + _FinalStage extra(String extra); + + /** + *

Label your requests for the purpose of identification during usage reporting

+ */ + _FinalStage tag(Optional> tag); + + _FinalStage tag(List tag); + + _FinalStage tag(String tag); + + /** + *

Custom topics you want the model to detect within your input audio or text if present Submit up to 100.

+ */ + _FinalStage customTopic(Optional> customTopic); + + _FinalStage customTopic(List customTopic); + + _FinalStage customTopic(String customTopic); + + /** + *

Custom intents you want the model to detect within your input audio if present

+ */ + _FinalStage customIntent(Optional> customIntent); + + _FinalStage customIntent(List customIntent); + + _FinalStage customIntent(String customIntent); + + /** + *

Key term prompting can boost or suppress specialized terminology and brands. Only compatible with Nova-3

+ */ + _FinalStage keyterm(Optional> keyterm); + + _FinalStage keyterm(List keyterm); + + _FinalStage keyterm(String keyterm); + + /** + *

Keywords can boost or suppress specialized terminology and brands

+ */ + _FinalStage keywords(Optional> keywords); + + _FinalStage keywords(List keywords); + + _FinalStage keywords(String keywords); + + /** + *

Search for terms or phrases in submitted audio and replaces them

+ */ + _FinalStage replace(Optional> replace); + + _FinalStage replace(List replace); + + _FinalStage replace(String replace); + + /** + *

Search for terms or phrases in submitted audio

+ */ + _FinalStage search(Optional> search); + + _FinalStage search(List search); + + _FinalStage search(String search); + + /** + *

URL to which we'll make the callback request

+ */ + _FinalStage callback(Optional callback); + + _FinalStage callback(String callback); + + /** + *

HTTP method by which the callback request will be made

+ */ + _FinalStage callbackMethod(Optional callbackMethod); + + _FinalStage callbackMethod(MediaTranscribeRequestCallbackMethod callbackMethod); + + /** + *

Recognizes the sentiment throughout a transcript or text

+ */ + _FinalStage sentiment(Optional sentiment); + + _FinalStage sentiment(Boolean sentiment); + + /** + *

Summarize content. For Listen API, supports string version option. For Read API, accepts boolean only.

+ */ + _FinalStage summarize(Optional summarize); + + _FinalStage summarize(MediaTranscribeRequestSummarize summarize); + + /** + *

Detect topics throughout a transcript or text

+ */ + _FinalStage topics(Optional topics); + + _FinalStage topics(Boolean topics); + + /** + *

Sets how the model will interpret strings submitted to the custom_topic param. When strict, the model will only return topics submitted using the custom_topic param. When extended, the model will return its own detected topics in addition to those submitted using the custom_topic param

+ */ + _FinalStage customTopicMode(Optional customTopicMode); + + _FinalStage customTopicMode(MediaTranscribeRequestCustomTopicMode customTopicMode); + + /** + *

Recognizes speaker intent throughout a transcript or text

+ */ + _FinalStage intents(Optional intents); + + _FinalStage intents(Boolean intents); + + /** + *

Sets how the model will interpret intents submitted to the custom_intent param. When strict, the model will only return intents submitted using the custom_intent param. When extended, the model will return its own detected intents in the custom_intent param.

+ */ + _FinalStage customIntentMode(Optional customIntentMode); + + _FinalStage customIntentMode(MediaTranscribeRequestCustomIntentMode customIntentMode); + + /** + *

Identifies and extracts key entities from content in submitted audio

+ */ + _FinalStage detectEntities(Optional detectEntities); + + _FinalStage detectEntities(Boolean detectEntities); + + /** + *

Identifies the dominant language spoken in submitted audio

+ */ + _FinalStage detectLanguage(Optional detectLanguage); + + _FinalStage detectLanguage(Boolean detectLanguage); + + /** + *

Recognize speaker changes. Each word in the transcript will be assigned a speaker number starting at 0

+ */ + _FinalStage diarize(Optional diarize); + + _FinalStage diarize(Boolean diarize); + + /** + *

Dictation mode for controlling formatting with dictated speech

+ */ + _FinalStage dictation(Optional dictation); + + _FinalStage dictation(Boolean dictation); + + /** + *

Specify the expected encoding of your submitted audio

+ */ + _FinalStage encoding(Optional encoding); + + _FinalStage encoding(MediaTranscribeRequestEncoding encoding); + + /** + *

Filler Words can help transcribe interruptions in your audio, like "uh" and "um"

+ */ + _FinalStage fillerWords(Optional fillerWords); + + _FinalStage fillerWords(Boolean fillerWords); + + /** + *

The BCP-47 language tag that hints at the primary spoken language. Depending on the Model and API endpoint you choose only certain languages are available

+ */ + _FinalStage language(Optional language); + + _FinalStage language(String language); + + /** + *

Spoken measurements will be converted to their corresponding abbreviations

+ */ + _FinalStage measurements(Optional measurements); + + _FinalStage measurements(Boolean measurements); + + /** + *

AI model used to process submitted audio

+ */ + _FinalStage model(Optional model); + + _FinalStage model(MediaTranscribeRequestModel model); + + /** + *

Transcribe each audio channel independently

+ */ + _FinalStage multichannel(Optional multichannel); + + _FinalStage multichannel(Boolean multichannel); + + /** + *

Numerals converts numbers from written format to numerical format

+ */ + _FinalStage numerals(Optional numerals); + + _FinalStage numerals(Boolean numerals); + + /** + *

Splits audio into paragraphs to improve transcript readability

+ */ + _FinalStage paragraphs(Optional paragraphs); + + _FinalStage paragraphs(Boolean paragraphs); + + /** + *

Profanity Filter looks for recognized profanity and converts it to the nearest recognized non-profane word or removes it from the transcript completely

+ */ + _FinalStage profanityFilter(Optional profanityFilter); + + _FinalStage profanityFilter(Boolean profanityFilter); + + /** + *

Add punctuation and capitalization to the transcript

+ */ + _FinalStage punctuate(Optional punctuate); + + _FinalStage punctuate(Boolean punctuate); + + /** + *

Redaction removes sensitive information from your transcripts

+ */ + _FinalStage redact(Optional redact); + + _FinalStage redact(String redact); + + /** + *

Apply formatting to transcript output. When set to true, additional formatting will be applied to transcripts to improve readability

+ */ + _FinalStage smartFormat(Optional smartFormat); + + _FinalStage smartFormat(Boolean smartFormat); + + /** + *

Segments speech into meaningful semantic units

+ */ + _FinalStage utterances(Optional utterances); + + _FinalStage utterances(Boolean utterances); + + /** + *

Seconds to wait before detecting a pause between words in submitted audio

+ */ + _FinalStage uttSplit(Optional uttSplit); + + _FinalStage uttSplit(Double uttSplit); + + /** + *

Version of an AI model to use

+ */ + _FinalStage version(Optional version); + + _FinalStage version(MediaTranscribeRequestVersion version); + + /** + *

Opts out requests from the Deepgram Model Improvement Program. Refer to our Docs for pricing impacts before setting this to true. https://dpgr.am/deepgram-mip

+ */ + _FinalStage mipOptOut(Optional mipOptOut); + + _FinalStage mipOptOut(Boolean mipOptOut); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements UrlStage, _FinalStage { + private String url; + + private Optional mipOptOut = Optional.empty(); + + private Optional version = Optional.empty(); + + private Optional uttSplit = Optional.empty(); + + private Optional utterances = Optional.empty(); + + private Optional smartFormat = Optional.empty(); + + private Optional redact = Optional.empty(); + + private Optional punctuate = Optional.empty(); + + private Optional profanityFilter = Optional.empty(); + + private Optional paragraphs = Optional.empty(); + + private Optional numerals = Optional.empty(); + + private Optional multichannel = Optional.empty(); + + private Optional model = Optional.empty(); + + private Optional measurements = Optional.empty(); + + private Optional language = Optional.empty(); + + private Optional fillerWords = Optional.empty(); + + private Optional encoding = Optional.empty(); + + private Optional dictation = Optional.empty(); + + private Optional diarize = Optional.empty(); + + private Optional detectLanguage = Optional.empty(); + + private Optional detectEntities = Optional.empty(); + + private Optional customIntentMode = Optional.empty(); + + private Optional intents = Optional.empty(); + + private Optional customTopicMode = Optional.empty(); + + private Optional topics = Optional.empty(); + + private Optional summarize = Optional.empty(); + + private Optional sentiment = Optional.empty(); + + private Optional callbackMethod = Optional.empty(); + + private Optional callback = Optional.empty(); + + private Optional> search = Optional.empty(); + + private Optional> replace = Optional.empty(); + + private Optional> keywords = Optional.empty(); + + private Optional> keyterm = Optional.empty(); + + private Optional> customIntent = Optional.empty(); + + private Optional> customTopic = Optional.empty(); + + private Optional> tag = Optional.empty(); + + private Optional> extra = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListenV1RequestUrl other) { + extra(other.getExtra()); + tag(other.getTag()); + customTopic(other.getCustomTopic()); + customIntent(other.getCustomIntent()); + keyterm(other.getKeyterm()); + keywords(other.getKeywords()); + replace(other.getReplace()); + search(other.getSearch()); + callback(other.getCallback()); + callbackMethod(other.getCallbackMethod()); + sentiment(other.getSentiment()); + summarize(other.getSummarize()); + topics(other.getTopics()); + customTopicMode(other.getCustomTopicMode()); + intents(other.getIntents()); + customIntentMode(other.getCustomIntentMode()); + detectEntities(other.getDetectEntities()); + detectLanguage(other.getDetectLanguage()); + diarize(other.getDiarize()); + dictation(other.getDictation()); + encoding(other.getEncoding()); + fillerWords(other.getFillerWords()); + language(other.getLanguage()); + measurements(other.getMeasurements()); + model(other.getModel()); + multichannel(other.getMultichannel()); + numerals(other.getNumerals()); + paragraphs(other.getParagraphs()); + profanityFilter(other.getProfanityFilter()); + punctuate(other.getPunctuate()); + redact(other.getRedact()); + smartFormat(other.getSmartFormat()); + utterances(other.getUtterances()); + uttSplit(other.getUttSplit()); + version(other.getVersion()); + mipOptOut(other.getMipOptOut()); + url(other.getUrl()); + return this; + } + + @java.lang.Override + @JsonSetter("url") + public _FinalStage url(@NotNull String url) { + this.url = Objects.requireNonNull(url, "url must not be null"); + return this; + } + + /** + *

Opts out requests from the Deepgram Model Improvement Program. Refer to our Docs for pricing impacts before setting this to true. https://dpgr.am/deepgram-mip

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage mipOptOut(Boolean mipOptOut) { + this.mipOptOut = Optional.ofNullable(mipOptOut); + return this; + } + + /** + *

Opts out requests from the Deepgram Model Improvement Program. Refer to our Docs for pricing impacts before setting this to true. https://dpgr.am/deepgram-mip

+ */ + @java.lang.Override + @JsonSetter(value = "mip_opt_out", nulls = Nulls.SKIP) + public _FinalStage mipOptOut(Optional mipOptOut) { + this.mipOptOut = mipOptOut; + return this; + } + + /** + *

Version of an AI model to use

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage version(MediaTranscribeRequestVersion version) { + this.version = Optional.ofNullable(version); + return this; + } + + /** + *

Version of an AI model to use

+ */ + @java.lang.Override + @JsonSetter(value = "version", nulls = Nulls.SKIP) + public _FinalStage version(Optional version) { + this.version = version; + return this; + } + + /** + *

Seconds to wait before detecting a pause between words in submitted audio

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage uttSplit(Double uttSplit) { + this.uttSplit = Optional.ofNullable(uttSplit); + return this; + } + + /** + *

Seconds to wait before detecting a pause between words in submitted audio

+ */ + @java.lang.Override + @JsonSetter(value = "utt_split", nulls = Nulls.SKIP) + public _FinalStage uttSplit(Optional uttSplit) { + this.uttSplit = uttSplit; + return this; + } + + /** + *

Segments speech into meaningful semantic units

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage utterances(Boolean utterances) { + this.utterances = Optional.ofNullable(utterances); + return this; + } + + /** + *

Segments speech into meaningful semantic units

+ */ + @java.lang.Override + @JsonSetter(value = "utterances", nulls = Nulls.SKIP) + public _FinalStage utterances(Optional utterances) { + this.utterances = utterances; + return this; + } + + /** + *

Apply formatting to transcript output. When set to true, additional formatting will be applied to transcripts to improve readability

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage smartFormat(Boolean smartFormat) { + this.smartFormat = Optional.ofNullable(smartFormat); + return this; + } + + /** + *

Apply formatting to transcript output. When set to true, additional formatting will be applied to transcripts to improve readability

+ */ + @java.lang.Override + @JsonSetter(value = "smart_format", nulls = Nulls.SKIP) + public _FinalStage smartFormat(Optional smartFormat) { + this.smartFormat = smartFormat; + return this; + } + + /** + *

Redaction removes sensitive information from your transcripts

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage redact(String redact) { + this.redact = Optional.ofNullable(redact); + return this; + } + + /** + *

Redaction removes sensitive information from your transcripts

+ */ + @java.lang.Override + @JsonSetter(value = "redact", nulls = Nulls.SKIP) + public _FinalStage redact(Optional redact) { + this.redact = redact; + return this; + } + + /** + *

Add punctuation and capitalization to the transcript

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage punctuate(Boolean punctuate) { + this.punctuate = Optional.ofNullable(punctuate); + return this; + } + + /** + *

Add punctuation and capitalization to the transcript

+ */ + @java.lang.Override + @JsonSetter(value = "punctuate", nulls = Nulls.SKIP) + public _FinalStage punctuate(Optional punctuate) { + this.punctuate = punctuate; + return this; + } + + /** + *

Profanity Filter looks for recognized profanity and converts it to the nearest recognized non-profane word or removes it from the transcript completely

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage profanityFilter(Boolean profanityFilter) { + this.profanityFilter = Optional.ofNullable(profanityFilter); + return this; + } + + /** + *

Profanity Filter looks for recognized profanity and converts it to the nearest recognized non-profane word or removes it from the transcript completely

+ */ + @java.lang.Override + @JsonSetter(value = "profanity_filter", nulls = Nulls.SKIP) + public _FinalStage profanityFilter(Optional profanityFilter) { + this.profanityFilter = profanityFilter; + return this; + } + + /** + *

Splits audio into paragraphs to improve transcript readability

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paragraphs(Boolean paragraphs) { + this.paragraphs = Optional.ofNullable(paragraphs); + return this; + } + + /** + *

Splits audio into paragraphs to improve transcript readability

+ */ + @java.lang.Override + @JsonSetter(value = "paragraphs", nulls = Nulls.SKIP) + public _FinalStage paragraphs(Optional paragraphs) { + this.paragraphs = paragraphs; + return this; + } + + /** + *

Numerals converts numbers from written format to numerical format

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage numerals(Boolean numerals) { + this.numerals = Optional.ofNullable(numerals); + return this; + } + + /** + *

Numerals converts numbers from written format to numerical format

+ */ + @java.lang.Override + @JsonSetter(value = "numerals", nulls = Nulls.SKIP) + public _FinalStage numerals(Optional numerals) { + this.numerals = numerals; + return this; + } + + /** + *

Transcribe each audio channel independently

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage multichannel(Boolean multichannel) { + this.multichannel = Optional.ofNullable(multichannel); + return this; + } + + /** + *

Transcribe each audio channel independently

+ */ + @java.lang.Override + @JsonSetter(value = "multichannel", nulls = Nulls.SKIP) + public _FinalStage multichannel(Optional multichannel) { + this.multichannel = multichannel; + return this; + } + + /** + *

AI model used to process submitted audio

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage model(MediaTranscribeRequestModel model) { + this.model = Optional.ofNullable(model); + return this; + } + + /** + *

AI model used to process submitted audio

+ */ + @java.lang.Override + @JsonSetter(value = "model", nulls = Nulls.SKIP) + public _FinalStage model(Optional model) { + this.model = model; + return this; + } + + /** + *

Spoken measurements will be converted to their corresponding abbreviations

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage measurements(Boolean measurements) { + this.measurements = Optional.ofNullable(measurements); + return this; + } + + /** + *

Spoken measurements will be converted to their corresponding abbreviations

+ */ + @java.lang.Override + @JsonSetter(value = "measurements", nulls = Nulls.SKIP) + public _FinalStage measurements(Optional measurements) { + this.measurements = measurements; + return this; + } + + /** + *

The BCP-47 language tag that hints at the primary spoken language. Depending on the Model and API endpoint you choose only certain languages are available

+ * @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; + } + + /** + *

The BCP-47 language tag that hints at the primary spoken language. Depending on the Model and API endpoint you choose only certain languages are available

+ */ + @java.lang.Override + @JsonSetter(value = "language", nulls = Nulls.SKIP) + public _FinalStage language(Optional language) { + this.language = language; + return this; + } + + /** + *

Filler Words can help transcribe interruptions in your audio, like "uh" and "um"

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fillerWords(Boolean fillerWords) { + this.fillerWords = Optional.ofNullable(fillerWords); + return this; + } + + /** + *

Filler Words can help transcribe interruptions in your audio, like "uh" and "um"

+ */ + @java.lang.Override + @JsonSetter(value = "filler_words", nulls = Nulls.SKIP) + public _FinalStage fillerWords(Optional fillerWords) { + this.fillerWords = fillerWords; + return this; + } + + /** + *

Specify the expected encoding of your submitted audio

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage encoding(MediaTranscribeRequestEncoding encoding) { + this.encoding = Optional.ofNullable(encoding); + return this; + } + + /** + *

Specify the expected encoding of your submitted audio

+ */ + @java.lang.Override + @JsonSetter(value = "encoding", nulls = Nulls.SKIP) + public _FinalStage encoding(Optional encoding) { + this.encoding = encoding; + return this; + } + + /** + *

Dictation mode for controlling formatting with dictated speech

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage dictation(Boolean dictation) { + this.dictation = Optional.ofNullable(dictation); + return this; + } + + /** + *

Dictation mode for controlling formatting with dictated speech

+ */ + @java.lang.Override + @JsonSetter(value = "dictation", nulls = Nulls.SKIP) + public _FinalStage dictation(Optional dictation) { + this.dictation = dictation; + return this; + } + + /** + *

Recognize speaker changes. Each word in the transcript will be assigned a speaker number starting at 0

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage diarize(Boolean diarize) { + this.diarize = Optional.ofNullable(diarize); + return this; + } + + /** + *

Recognize speaker changes. Each word in the transcript will be assigned a speaker number starting at 0

+ */ + @java.lang.Override + @JsonSetter(value = "diarize", nulls = Nulls.SKIP) + public _FinalStage diarize(Optional diarize) { + this.diarize = diarize; + return this; + } + + /** + *

Identifies the dominant language spoken in submitted audio

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage detectLanguage(Boolean detectLanguage) { + this.detectLanguage = Optional.ofNullable(detectLanguage); + return this; + } + + /** + *

Identifies the dominant language spoken in submitted audio

+ */ + @java.lang.Override + @JsonSetter(value = "detect_language", nulls = Nulls.SKIP) + public _FinalStage detectLanguage(Optional detectLanguage) { + this.detectLanguage = detectLanguage; + return this; + } + + /** + *

Identifies and extracts key entities from content in submitted audio

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage detectEntities(Boolean detectEntities) { + this.detectEntities = Optional.ofNullable(detectEntities); + return this; + } + + /** + *

Identifies and extracts key entities from content in submitted audio

+ */ + @java.lang.Override + @JsonSetter(value = "detect_entities", nulls = Nulls.SKIP) + public _FinalStage detectEntities(Optional detectEntities) { + this.detectEntities = detectEntities; + return this; + } + + /** + *

Sets how the model will interpret intents submitted to the custom_intent param. When strict, the model will only return intents submitted using the custom_intent param. When extended, the model will return its own detected intents in the custom_intent param.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customIntentMode(MediaTranscribeRequestCustomIntentMode customIntentMode) { + this.customIntentMode = Optional.ofNullable(customIntentMode); + return this; + } + + /** + *

Sets how the model will interpret intents submitted to the custom_intent param. When strict, the model will only return intents submitted using the custom_intent param. When extended, the model will return its own detected intents in the custom_intent param.

+ */ + @java.lang.Override + @JsonSetter(value = "custom_intent_mode", nulls = Nulls.SKIP) + public _FinalStage customIntentMode(Optional customIntentMode) { + this.customIntentMode = customIntentMode; + return this; + } + + /** + *

Recognizes speaker intent throughout a transcript or text

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage intents(Boolean intents) { + this.intents = Optional.ofNullable(intents); + return this; + } + + /** + *

Recognizes speaker intent throughout a transcript or text

+ */ + @java.lang.Override + @JsonSetter(value = "intents", nulls = Nulls.SKIP) + public _FinalStage intents(Optional intents) { + this.intents = intents; + return this; + } + + /** + *

Sets how the model will interpret strings submitted to the custom_topic param. When strict, the model will only return topics submitted using the custom_topic param. When extended, the model will return its own detected topics in addition to those submitted using the custom_topic param

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customTopicMode(MediaTranscribeRequestCustomTopicMode customTopicMode) { + this.customTopicMode = Optional.ofNullable(customTopicMode); + return this; + } + + /** + *

Sets how the model will interpret strings submitted to the custom_topic param. When strict, the model will only return topics submitted using the custom_topic param. When extended, the model will return its own detected topics in addition to those submitted using the custom_topic param

+ */ + @java.lang.Override + @JsonSetter(value = "custom_topic_mode", nulls = Nulls.SKIP) + public _FinalStage customTopicMode(Optional customTopicMode) { + this.customTopicMode = customTopicMode; + return this; + } + + /** + *

Detect topics throughout a transcript or text

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage topics(Boolean topics) { + this.topics = Optional.ofNullable(topics); + return this; + } + + /** + *

Detect topics throughout a transcript or text

+ */ + @java.lang.Override + @JsonSetter(value = "topics", nulls = Nulls.SKIP) + public _FinalStage topics(Optional topics) { + this.topics = topics; + return this; + } + + /** + *

Summarize content. For Listen API, supports string version option. For Read API, accepts boolean only.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage summarize(MediaTranscribeRequestSummarize summarize) { + this.summarize = Optional.ofNullable(summarize); + return this; + } + + /** + *

Summarize content. For Listen API, supports string version option. For Read API, accepts boolean only.

+ */ + @java.lang.Override + @JsonSetter(value = "summarize", nulls = Nulls.SKIP) + public _FinalStage summarize(Optional summarize) { + this.summarize = summarize; + return this; + } + + /** + *

Recognizes the sentiment throughout a transcript or text

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sentiment(Boolean sentiment) { + this.sentiment = Optional.ofNullable(sentiment); + return this; + } + + /** + *

Recognizes the sentiment throughout a transcript or text

+ */ + @java.lang.Override + @JsonSetter(value = "sentiment", nulls = Nulls.SKIP) + public _FinalStage sentiment(Optional sentiment) { + this.sentiment = sentiment; + return this; + } + + /** + *

HTTP method by which the callback request will be made

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage callbackMethod(MediaTranscribeRequestCallbackMethod callbackMethod) { + this.callbackMethod = Optional.ofNullable(callbackMethod); + return this; + } + + /** + *

HTTP method by which the callback request will be made

+ */ + @java.lang.Override + @JsonSetter(value = "callback_method", nulls = Nulls.SKIP) + public _FinalStage callbackMethod(Optional callbackMethod) { + this.callbackMethod = callbackMethod; + return this; + } + + /** + *

URL to which we'll make the callback request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage callback(String callback) { + this.callback = Optional.ofNullable(callback); + return this; + } + + /** + *

URL to which we'll make the callback request

+ */ + @java.lang.Override + @JsonSetter(value = "callback", nulls = Nulls.SKIP) + public _FinalStage callback(Optional callback) { + this.callback = callback; + return this; + } + + @java.lang.Override + public _FinalStage search(String search) { + this.search = Optional.of(Collections.singletonList(search)); + return this; + } + + /** + *

Search for terms or phrases in submitted audio

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

Search for terms or phrases in submitted audio

+ */ + @java.lang.Override + @JsonSetter(value = "search", nulls = Nulls.SKIP) + public _FinalStage search(Optional> search) { + this.search = search; + return this; + } + + @java.lang.Override + public _FinalStage replace(String replace) { + this.replace = Optional.of(Collections.singletonList(replace)); + return this; + } + + /** + *

Search for terms or phrases in submitted audio and replaces them

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

Search for terms or phrases in submitted audio and replaces them

+ */ + @java.lang.Override + @JsonSetter(value = "replace", nulls = Nulls.SKIP) + public _FinalStage replace(Optional> replace) { + this.replace = replace; + return this; + } + + @java.lang.Override + public _FinalStage keywords(String keywords) { + this.keywords = Optional.of(Collections.singletonList(keywords)); + return this; + } + + /** + *

Keywords can boost or suppress specialized terminology and brands

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

Keywords can boost or suppress specialized terminology and brands

+ */ + @java.lang.Override + @JsonSetter(value = "keywords", nulls = Nulls.SKIP) + public _FinalStage keywords(Optional> keywords) { + this.keywords = keywords; + return this; + } + + @java.lang.Override + public _FinalStage keyterm(String keyterm) { + this.keyterm = Optional.of(Collections.singletonList(keyterm)); + return this; + } + + /** + *

Key term prompting can boost or suppress specialized terminology and brands. Only compatible with Nova-3

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

Key term prompting can boost or suppress specialized terminology and brands. Only compatible with Nova-3

+ */ + @java.lang.Override + @JsonSetter(value = "keyterm", nulls = Nulls.SKIP) + public _FinalStage keyterm(Optional> keyterm) { + this.keyterm = keyterm; + return this; + } + + @java.lang.Override + public _FinalStage customIntent(String customIntent) { + this.customIntent = Optional.of(Collections.singletonList(customIntent)); + return this; + } + + /** + *

Custom intents you want the model to detect within your input audio if present

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

Custom intents you want the model to detect within your input audio if present

+ */ + @java.lang.Override + @JsonSetter(value = "custom_intent", nulls = Nulls.SKIP) + public _FinalStage customIntent(Optional> customIntent) { + this.customIntent = customIntent; + return this; + } + + @java.lang.Override + public _FinalStage customTopic(String customTopic) { + this.customTopic = Optional.of(Collections.singletonList(customTopic)); + return this; + } + + /** + *

Custom topics you want the model to detect within your input audio or text if present Submit up to 100.

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

Custom topics you want the model to detect within your input audio or text if present Submit up to 100.

+ */ + @java.lang.Override + @JsonSetter(value = "custom_topic", nulls = Nulls.SKIP) + public _FinalStage customTopic(Optional> customTopic) { + this.customTopic = customTopic; + return this; + } + + @java.lang.Override + public _FinalStage tag(String tag) { + this.tag = Optional.of(Collections.singletonList(tag)); + return this; + } + + /** + *

Label your requests for the purpose of identification during usage reporting

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

Label your requests for the purpose of identification during usage reporting

+ */ + @java.lang.Override + @JsonSetter(value = "tag", nulls = Nulls.SKIP) + public _FinalStage tag(Optional> tag) { + this.tag = tag; + return this; + } + + @java.lang.Override + public _FinalStage extra(String extra) { + this.extra = Optional.of(Collections.singletonList(extra)); + return this; + } + + /** + *

Arbitrary key-value pairs that are attached to the API response for usage in downstream processing

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

Arbitrary key-value pairs that are attached to the API response for usage in downstream processing

+ */ + @java.lang.Override + @JsonSetter(value = "extra", nulls = Nulls.SKIP) + public _FinalStage extra(Optional> extra) { + this.extra = extra; + return this; + } + + @java.lang.Override + public ListenV1RequestUrl build() { + return new ListenV1RequestUrl( + extra, + tag, + customTopic, + customIntent, + keyterm, + keywords, + replace, + search, + callback, + callbackMethod, + sentiment, + summarize, + topics, + customTopicMode, + intents, + customIntentMode, + detectEntities, + detectLanguage, + diarize, + dictation, + encoding, + fillerWords, + language, + measurements, + model, + multichannel, + numerals, + paragraphs, + profanityFilter, + punctuate, + redact, + smartFormat, + utterances, + uttSplit, + version, + mipOptOut, + url, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/listen/v1/media/requests/MediaTranscribeRequestOctetStream.java b/src/main/java/com/deepgram/resources/listen/v1/media/requests/MediaTranscribeRequestOctetStream.java new file mode 100644 index 0000000..df4b6bb --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/v1/media/requests/MediaTranscribeRequestOctetStream.java @@ -0,0 +1,1819 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen.v1.media.requests; + +import com.deepgram.core.ObjectMappers; +import com.deepgram.resources.listen.v1.media.types.MediaTranscribeRequestCallbackMethod; +import com.deepgram.resources.listen.v1.media.types.MediaTranscribeRequestCustomIntentMode; +import com.deepgram.resources.listen.v1.media.types.MediaTranscribeRequestCustomTopicMode; +import com.deepgram.resources.listen.v1.media.types.MediaTranscribeRequestEncoding; +import com.deepgram.resources.listen.v1.media.types.MediaTranscribeRequestModel; +import com.deepgram.resources.listen.v1.media.types.MediaTranscribeRequestSummarize; +import com.deepgram.resources.listen.v1.media.types.MediaTranscribeRequestVersion; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.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 java.util.Collections; +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 = MediaTranscribeRequestOctetStream.Builder.class) +public final class MediaTranscribeRequestOctetStream { + private final Optional> extra; + + private final Optional> tag; + + private final Optional> customTopic; + + private final Optional> customIntent; + + private final Optional> keyterm; + + private final Optional> keywords; + + private final Optional> replace; + + private final Optional> search; + + private final Optional callback; + + private final Optional callbackMethod; + + private final Optional sentiment; + + private final Optional summarize; + + private final Optional topics; + + private final Optional customTopicMode; + + private final Optional intents; + + private final Optional customIntentMode; + + private final Optional detectEntities; + + private final Optional detectLanguage; + + private final Optional diarize; + + private final Optional dictation; + + private final Optional encoding; + + private final Optional fillerWords; + + private final Optional language; + + private final Optional measurements; + + private final Optional model; + + private final Optional multichannel; + + private final Optional numerals; + + private final Optional paragraphs; + + private final Optional profanityFilter; + + private final Optional punctuate; + + private final Optional redact; + + private final Optional smartFormat; + + private final Optional utterances; + + private final Optional uttSplit; + + private final Optional version; + + private final Optional mipOptOut; + + private final byte[] body; + + private final Map additionalProperties; + + private MediaTranscribeRequestOctetStream( + Optional> extra, + Optional> tag, + Optional> customTopic, + Optional> customIntent, + Optional> keyterm, + Optional> keywords, + Optional> replace, + Optional> search, + Optional callback, + Optional callbackMethod, + Optional sentiment, + Optional summarize, + Optional topics, + Optional customTopicMode, + Optional intents, + Optional customIntentMode, + Optional detectEntities, + Optional detectLanguage, + Optional diarize, + Optional dictation, + Optional encoding, + Optional fillerWords, + Optional language, + Optional measurements, + Optional model, + Optional multichannel, + Optional numerals, + Optional paragraphs, + Optional profanityFilter, + Optional punctuate, + Optional redact, + Optional smartFormat, + Optional utterances, + Optional uttSplit, + Optional version, + Optional mipOptOut, + byte[] body, + Map additionalProperties) { + this.extra = extra; + this.tag = tag; + this.customTopic = customTopic; + this.customIntent = customIntent; + this.keyterm = keyterm; + this.keywords = keywords; + this.replace = replace; + this.search = search; + this.callback = callback; + this.callbackMethod = callbackMethod; + this.sentiment = sentiment; + this.summarize = summarize; + this.topics = topics; + this.customTopicMode = customTopicMode; + this.intents = intents; + this.customIntentMode = customIntentMode; + this.detectEntities = detectEntities; + this.detectLanguage = detectLanguage; + this.diarize = diarize; + this.dictation = dictation; + this.encoding = encoding; + this.fillerWords = fillerWords; + this.language = language; + this.measurements = measurements; + this.model = model; + this.multichannel = multichannel; + this.numerals = numerals; + this.paragraphs = paragraphs; + this.profanityFilter = profanityFilter; + this.punctuate = punctuate; + this.redact = redact; + this.smartFormat = smartFormat; + this.utterances = utterances; + this.uttSplit = uttSplit; + this.version = version; + this.mipOptOut = mipOptOut; + this.body = body; + this.additionalProperties = additionalProperties; + } + + /** + * @return Arbitrary key-value pairs that are attached to the API response for usage in downstream processing + */ + @JsonIgnore + public Optional> getExtra() { + return extra; + } + + /** + * @return Label your requests for the purpose of identification during usage reporting + */ + @JsonIgnore + public Optional> getTag() { + return tag; + } + + /** + * @return Custom topics you want the model to detect within your input audio or text if present Submit up to 100. + */ + @JsonIgnore + public Optional> getCustomTopic() { + return customTopic; + } + + /** + * @return Custom intents you want the model to detect within your input audio if present + */ + @JsonIgnore + public Optional> getCustomIntent() { + return customIntent; + } + + /** + * @return Key term prompting can boost or suppress specialized terminology and brands. Only compatible with Nova-3 + */ + @JsonIgnore + public Optional> getKeyterm() { + return keyterm; + } + + /** + * @return Keywords can boost or suppress specialized terminology and brands + */ + @JsonIgnore + public Optional> getKeywords() { + return keywords; + } + + /** + * @return Search for terms or phrases in submitted audio and replaces them + */ + @JsonIgnore + public Optional> getReplace() { + return replace; + } + + /** + * @return Search for terms or phrases in submitted audio + */ + @JsonIgnore + public Optional> getSearch() { + return search; + } + + /** + * @return URL to which we'll make the callback request + */ + @JsonIgnore + public Optional getCallback() { + return callback; + } + + /** + * @return HTTP method by which the callback request will be made + */ + @JsonIgnore + public Optional getCallbackMethod() { + return callbackMethod; + } + + /** + * @return Recognizes the sentiment throughout a transcript or text + */ + @JsonIgnore + public Optional getSentiment() { + return sentiment; + } + + /** + * @return Summarize content. For Listen API, supports string version option. For Read API, accepts boolean only. + */ + @JsonIgnore + public Optional getSummarize() { + return summarize; + } + + /** + * @return Detect topics throughout a transcript or text + */ + @JsonIgnore + public Optional getTopics() { + return topics; + } + + /** + * @return Sets how the model will interpret strings submitted to the custom_topic param. When strict, the model will only return topics submitted using the custom_topic param. When extended, the model will return its own detected topics in addition to those submitted using the custom_topic param + */ + @JsonIgnore + public Optional getCustomTopicMode() { + return customTopicMode; + } + + /** + * @return Recognizes speaker intent throughout a transcript or text + */ + @JsonIgnore + public Optional getIntents() { + return intents; + } + + /** + * @return Sets how the model will interpret intents submitted to the custom_intent param. When strict, the model will only return intents submitted using the custom_intent param. When extended, the model will return its own detected intents in the custom_intent param. + */ + @JsonIgnore + public Optional getCustomIntentMode() { + return customIntentMode; + } + + /** + * @return Identifies and extracts key entities from content in submitted audio + */ + @JsonIgnore + public Optional getDetectEntities() { + return detectEntities; + } + + /** + * @return Identifies the dominant language spoken in submitted audio + */ + @JsonIgnore + public Optional getDetectLanguage() { + return detectLanguage; + } + + /** + * @return Recognize speaker changes. Each word in the transcript will be assigned a speaker number starting at 0 + */ + @JsonIgnore + public Optional getDiarize() { + return diarize; + } + + /** + * @return Dictation mode for controlling formatting with dictated speech + */ + @JsonIgnore + public Optional getDictation() { + return dictation; + } + + /** + * @return Specify the expected encoding of your submitted audio + */ + @JsonIgnore + public Optional getEncoding() { + return encoding; + } + + /** + * @return Filler Words can help transcribe interruptions in your audio, like "uh" and "um" + */ + @JsonIgnore + public Optional getFillerWords() { + return fillerWords; + } + + /** + * @return The BCP-47 language tag that hints at the primary spoken language. Depending on the Model and API endpoint you choose only certain languages are available + */ + @JsonIgnore + public Optional getLanguage() { + return language; + } + + /** + * @return Spoken measurements will be converted to their corresponding abbreviations + */ + @JsonIgnore + public Optional getMeasurements() { + return measurements; + } + + /** + * @return AI model used to process submitted audio + */ + @JsonIgnore + public Optional getModel() { + return model; + } + + /** + * @return Transcribe each audio channel independently + */ + @JsonIgnore + public Optional getMultichannel() { + return multichannel; + } + + /** + * @return Numerals converts numbers from written format to numerical format + */ + @JsonIgnore + public Optional getNumerals() { + return numerals; + } + + /** + * @return Splits audio into paragraphs to improve transcript readability + */ + @JsonIgnore + public Optional getParagraphs() { + return paragraphs; + } + + /** + * @return Profanity Filter looks for recognized profanity and converts it to the nearest recognized non-profane word or removes it from the transcript completely + */ + @JsonIgnore + public Optional getProfanityFilter() { + return profanityFilter; + } + + /** + * @return Add punctuation and capitalization to the transcript + */ + @JsonIgnore + public Optional getPunctuate() { + return punctuate; + } + + /** + * @return Redaction removes sensitive information from your transcripts + */ + @JsonIgnore + public Optional getRedact() { + return redact; + } + + /** + * @return Apply formatting to transcript output. When set to true, additional formatting will be applied to transcripts to improve readability + */ + @JsonIgnore + public Optional getSmartFormat() { + return smartFormat; + } + + /** + * @return Segments speech into meaningful semantic units + */ + @JsonIgnore + public Optional getUtterances() { + return utterances; + } + + /** + * @return Seconds to wait before detecting a pause between words in submitted audio + */ + @JsonIgnore + public Optional getUttSplit() { + return uttSplit; + } + + /** + * @return Version of an AI model to use + */ + @JsonIgnore + public Optional getVersion() { + return version; + } + + /** + * @return Opts out requests from the Deepgram Model Improvement Program. Refer to our Docs for pricing impacts before setting this to true. https://dpgr.am/deepgram-mip + */ + @JsonIgnore + public Optional getMipOptOut() { + return mipOptOut; + } + + @JsonProperty("body") + public byte[] getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MediaTranscribeRequestOctetStream && equalTo((MediaTranscribeRequestOctetStream) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(MediaTranscribeRequestOctetStream other) { + return extra.equals(other.extra) + && tag.equals(other.tag) + && customTopic.equals(other.customTopic) + && customIntent.equals(other.customIntent) + && keyterm.equals(other.keyterm) + && keywords.equals(other.keywords) + && replace.equals(other.replace) + && search.equals(other.search) + && callback.equals(other.callback) + && callbackMethod.equals(other.callbackMethod) + && sentiment.equals(other.sentiment) + && summarize.equals(other.summarize) + && topics.equals(other.topics) + && customTopicMode.equals(other.customTopicMode) + && intents.equals(other.intents) + && customIntentMode.equals(other.customIntentMode) + && detectEntities.equals(other.detectEntities) + && detectLanguage.equals(other.detectLanguage) + && diarize.equals(other.diarize) + && dictation.equals(other.dictation) + && encoding.equals(other.encoding) + && fillerWords.equals(other.fillerWords) + && language.equals(other.language) + && measurements.equals(other.measurements) + && model.equals(other.model) + && multichannel.equals(other.multichannel) + && numerals.equals(other.numerals) + && paragraphs.equals(other.paragraphs) + && profanityFilter.equals(other.profanityFilter) + && punctuate.equals(other.punctuate) + && redact.equals(other.redact) + && smartFormat.equals(other.smartFormat) + && utterances.equals(other.utterances) + && uttSplit.equals(other.uttSplit) + && version.equals(other.version) + && mipOptOut.equals(other.mipOptOut) + && body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.extra, + this.tag, + this.customTopic, + this.customIntent, + this.keyterm, + this.keywords, + this.replace, + this.search, + this.callback, + this.callbackMethod, + this.sentiment, + this.summarize, + this.topics, + this.customTopicMode, + this.intents, + this.customIntentMode, + this.detectEntities, + this.detectLanguage, + this.diarize, + this.dictation, + this.encoding, + this.fillerWords, + this.language, + this.measurements, + this.model, + this.multichannel, + this.numerals, + this.paragraphs, + this.profanityFilter, + this.punctuate, + this.redact, + this.smartFormat, + this.utterances, + this.uttSplit, + this.version, + this.mipOptOut, + this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BodyStage builder() { + return new Builder(); + } + + public interface BodyStage { + _FinalStage body(@NotNull byte[] body); + + Builder from(MediaTranscribeRequestOctetStream other); + } + + public interface _FinalStage { + MediaTranscribeRequestOctetStream build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Arbitrary key-value pairs that are attached to the API response for usage in downstream processing

+ */ + _FinalStage extra(Optional> extra); + + _FinalStage extra(List extra); + + _FinalStage extra(String extra); + + /** + *

Label your requests for the purpose of identification during usage reporting

+ */ + _FinalStage tag(Optional> tag); + + _FinalStage tag(List tag); + + _FinalStage tag(String tag); + + /** + *

Custom topics you want the model to detect within your input audio or text if present Submit up to 100.

+ */ + _FinalStage customTopic(Optional> customTopic); + + _FinalStage customTopic(List customTopic); + + _FinalStage customTopic(String customTopic); + + /** + *

Custom intents you want the model to detect within your input audio if present

+ */ + _FinalStage customIntent(Optional> customIntent); + + _FinalStage customIntent(List customIntent); + + _FinalStage customIntent(String customIntent); + + /** + *

Key term prompting can boost or suppress specialized terminology and brands. Only compatible with Nova-3

+ */ + _FinalStage keyterm(Optional> keyterm); + + _FinalStage keyterm(List keyterm); + + _FinalStage keyterm(String keyterm); + + /** + *

Keywords can boost or suppress specialized terminology and brands

+ */ + _FinalStage keywords(Optional> keywords); + + _FinalStage keywords(List keywords); + + _FinalStage keywords(String keywords); + + /** + *

Search for terms or phrases in submitted audio and replaces them

+ */ + _FinalStage replace(Optional> replace); + + _FinalStage replace(List replace); + + _FinalStage replace(String replace); + + /** + *

Search for terms or phrases in submitted audio

+ */ + _FinalStage search(Optional> search); + + _FinalStage search(List search); + + _FinalStage search(String search); + + /** + *

URL to which we'll make the callback request

+ */ + _FinalStage callback(Optional callback); + + _FinalStage callback(String callback); + + /** + *

HTTP method by which the callback request will be made

+ */ + _FinalStage callbackMethod(Optional callbackMethod); + + _FinalStage callbackMethod(MediaTranscribeRequestCallbackMethod callbackMethod); + + /** + *

Recognizes the sentiment throughout a transcript or text

+ */ + _FinalStage sentiment(Optional sentiment); + + _FinalStage sentiment(Boolean sentiment); + + /** + *

Summarize content. For Listen API, supports string version option. For Read API, accepts boolean only.

+ */ + _FinalStage summarize(Optional summarize); + + _FinalStage summarize(MediaTranscribeRequestSummarize summarize); + + /** + *

Detect topics throughout a transcript or text

+ */ + _FinalStage topics(Optional topics); + + _FinalStage topics(Boolean topics); + + /** + *

Sets how the model will interpret strings submitted to the custom_topic param. When strict, the model will only return topics submitted using the custom_topic param. When extended, the model will return its own detected topics in addition to those submitted using the custom_topic param

+ */ + _FinalStage customTopicMode(Optional customTopicMode); + + _FinalStage customTopicMode(MediaTranscribeRequestCustomTopicMode customTopicMode); + + /** + *

Recognizes speaker intent throughout a transcript or text

+ */ + _FinalStage intents(Optional intents); + + _FinalStage intents(Boolean intents); + + /** + *

Sets how the model will interpret intents submitted to the custom_intent param. When strict, the model will only return intents submitted using the custom_intent param. When extended, the model will return its own detected intents in the custom_intent param.

+ */ + _FinalStage customIntentMode(Optional customIntentMode); + + _FinalStage customIntentMode(MediaTranscribeRequestCustomIntentMode customIntentMode); + + /** + *

Identifies and extracts key entities from content in submitted audio

+ */ + _FinalStage detectEntities(Optional detectEntities); + + _FinalStage detectEntities(Boolean detectEntities); + + /** + *

Identifies the dominant language spoken in submitted audio

+ */ + _FinalStage detectLanguage(Optional detectLanguage); + + _FinalStage detectLanguage(Boolean detectLanguage); + + /** + *

Recognize speaker changes. Each word in the transcript will be assigned a speaker number starting at 0

+ */ + _FinalStage diarize(Optional diarize); + + _FinalStage diarize(Boolean diarize); + + /** + *

Dictation mode for controlling formatting with dictated speech

+ */ + _FinalStage dictation(Optional dictation); + + _FinalStage dictation(Boolean dictation); + + /** + *

Specify the expected encoding of your submitted audio

+ */ + _FinalStage encoding(Optional encoding); + + _FinalStage encoding(MediaTranscribeRequestEncoding encoding); + + /** + *

Filler Words can help transcribe interruptions in your audio, like "uh" and "um"

+ */ + _FinalStage fillerWords(Optional fillerWords); + + _FinalStage fillerWords(Boolean fillerWords); + + /** + *

The BCP-47 language tag that hints at the primary spoken language. Depending on the Model and API endpoint you choose only certain languages are available

+ */ + _FinalStage language(Optional language); + + _FinalStage language(String language); + + /** + *

Spoken measurements will be converted to their corresponding abbreviations

+ */ + _FinalStage measurements(Optional measurements); + + _FinalStage measurements(Boolean measurements); + + /** + *

AI model used to process submitted audio

+ */ + _FinalStage model(Optional model); + + _FinalStage model(MediaTranscribeRequestModel model); + + /** + *

Transcribe each audio channel independently

+ */ + _FinalStage multichannel(Optional multichannel); + + _FinalStage multichannel(Boolean multichannel); + + /** + *

Numerals converts numbers from written format to numerical format

+ */ + _FinalStage numerals(Optional numerals); + + _FinalStage numerals(Boolean numerals); + + /** + *

Splits audio into paragraphs to improve transcript readability

+ */ + _FinalStage paragraphs(Optional paragraphs); + + _FinalStage paragraphs(Boolean paragraphs); + + /** + *

Profanity Filter looks for recognized profanity and converts it to the nearest recognized non-profane word or removes it from the transcript completely

+ */ + _FinalStage profanityFilter(Optional profanityFilter); + + _FinalStage profanityFilter(Boolean profanityFilter); + + /** + *

Add punctuation and capitalization to the transcript

+ */ + _FinalStage punctuate(Optional punctuate); + + _FinalStage punctuate(Boolean punctuate); + + /** + *

Redaction removes sensitive information from your transcripts

+ */ + _FinalStage redact(Optional redact); + + _FinalStage redact(String redact); + + /** + *

Apply formatting to transcript output. When set to true, additional formatting will be applied to transcripts to improve readability

+ */ + _FinalStage smartFormat(Optional smartFormat); + + _FinalStage smartFormat(Boolean smartFormat); + + /** + *

Segments speech into meaningful semantic units

+ */ + _FinalStage utterances(Optional utterances); + + _FinalStage utterances(Boolean utterances); + + /** + *

Seconds to wait before detecting a pause between words in submitted audio

+ */ + _FinalStage uttSplit(Optional uttSplit); + + _FinalStage uttSplit(Double uttSplit); + + /** + *

Version of an AI model to use

+ */ + _FinalStage version(Optional version); + + _FinalStage version(MediaTranscribeRequestVersion version); + + /** + *

Opts out requests from the Deepgram Model Improvement Program. Refer to our Docs for pricing impacts before setting this to true. https://dpgr.am/deepgram-mip

+ */ + _FinalStage mipOptOut(Optional mipOptOut); + + _FinalStage mipOptOut(Boolean mipOptOut); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements BodyStage, _FinalStage { + private byte[] body; + + private Optional mipOptOut = Optional.empty(); + + private Optional version = Optional.empty(); + + private Optional uttSplit = Optional.empty(); + + private Optional utterances = Optional.empty(); + + private Optional smartFormat = Optional.empty(); + + private Optional redact = Optional.empty(); + + private Optional punctuate = Optional.empty(); + + private Optional profanityFilter = Optional.empty(); + + private Optional paragraphs = Optional.empty(); + + private Optional numerals = Optional.empty(); + + private Optional multichannel = Optional.empty(); + + private Optional model = Optional.empty(); + + private Optional measurements = Optional.empty(); + + private Optional language = Optional.empty(); + + private Optional fillerWords = Optional.empty(); + + private Optional encoding = Optional.empty(); + + private Optional dictation = Optional.empty(); + + private Optional diarize = Optional.empty(); + + private Optional detectLanguage = Optional.empty(); + + private Optional detectEntities = Optional.empty(); + + private Optional customIntentMode = Optional.empty(); + + private Optional intents = Optional.empty(); + + private Optional customTopicMode = Optional.empty(); + + private Optional topics = Optional.empty(); + + private Optional summarize = Optional.empty(); + + private Optional sentiment = Optional.empty(); + + private Optional callbackMethod = Optional.empty(); + + private Optional callback = Optional.empty(); + + private Optional> search = Optional.empty(); + + private Optional> replace = Optional.empty(); + + private Optional> keywords = Optional.empty(); + + private Optional> keyterm = Optional.empty(); + + private Optional> customIntent = Optional.empty(); + + private Optional> customTopic = Optional.empty(); + + private Optional> tag = Optional.empty(); + + private Optional> extra = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(MediaTranscribeRequestOctetStream other) { + extra(other.getExtra()); + tag(other.getTag()); + customTopic(other.getCustomTopic()); + customIntent(other.getCustomIntent()); + keyterm(other.getKeyterm()); + keywords(other.getKeywords()); + replace(other.getReplace()); + search(other.getSearch()); + callback(other.getCallback()); + callbackMethod(other.getCallbackMethod()); + sentiment(other.getSentiment()); + summarize(other.getSummarize()); + topics(other.getTopics()); + customTopicMode(other.getCustomTopicMode()); + intents(other.getIntents()); + customIntentMode(other.getCustomIntentMode()); + detectEntities(other.getDetectEntities()); + detectLanguage(other.getDetectLanguage()); + diarize(other.getDiarize()); + dictation(other.getDictation()); + encoding(other.getEncoding()); + fillerWords(other.getFillerWords()); + language(other.getLanguage()); + measurements(other.getMeasurements()); + model(other.getModel()); + multichannel(other.getMultichannel()); + numerals(other.getNumerals()); + paragraphs(other.getParagraphs()); + profanityFilter(other.getProfanityFilter()); + punctuate(other.getPunctuate()); + redact(other.getRedact()); + smartFormat(other.getSmartFormat()); + utterances(other.getUtterances()); + uttSplit(other.getUttSplit()); + version(other.getVersion()); + mipOptOut(other.getMipOptOut()); + body(other.getBody()); + return this; + } + + @java.lang.Override + @JsonSetter("body") + public _FinalStage body(@NotNull byte[] body) { + this.body = Objects.requireNonNull(body, "body must not be null"); + return this; + } + + /** + *

Opts out requests from the Deepgram Model Improvement Program. Refer to our Docs for pricing impacts before setting this to true. https://dpgr.am/deepgram-mip

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage mipOptOut(Boolean mipOptOut) { + this.mipOptOut = Optional.ofNullable(mipOptOut); + return this; + } + + /** + *

Opts out requests from the Deepgram Model Improvement Program. Refer to our Docs for pricing impacts before setting this to true. https://dpgr.am/deepgram-mip

+ */ + @java.lang.Override + @JsonSetter(value = "mip_opt_out", nulls = Nulls.SKIP) + public _FinalStage mipOptOut(Optional mipOptOut) { + this.mipOptOut = mipOptOut; + return this; + } + + /** + *

Version of an AI model to use

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage version(MediaTranscribeRequestVersion version) { + this.version = Optional.ofNullable(version); + return this; + } + + /** + *

Version of an AI model to use

+ */ + @java.lang.Override + @JsonSetter(value = "version", nulls = Nulls.SKIP) + public _FinalStage version(Optional version) { + this.version = version; + return this; + } + + /** + *

Seconds to wait before detecting a pause between words in submitted audio

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage uttSplit(Double uttSplit) { + this.uttSplit = Optional.ofNullable(uttSplit); + return this; + } + + /** + *

Seconds to wait before detecting a pause between words in submitted audio

+ */ + @java.lang.Override + @JsonSetter(value = "utt_split", nulls = Nulls.SKIP) + public _FinalStage uttSplit(Optional uttSplit) { + this.uttSplit = uttSplit; + return this; + } + + /** + *

Segments speech into meaningful semantic units

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage utterances(Boolean utterances) { + this.utterances = Optional.ofNullable(utterances); + return this; + } + + /** + *

Segments speech into meaningful semantic units

+ */ + @java.lang.Override + @JsonSetter(value = "utterances", nulls = Nulls.SKIP) + public _FinalStage utterances(Optional utterances) { + this.utterances = utterances; + return this; + } + + /** + *

Apply formatting to transcript output. When set to true, additional formatting will be applied to transcripts to improve readability

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage smartFormat(Boolean smartFormat) { + this.smartFormat = Optional.ofNullable(smartFormat); + return this; + } + + /** + *

Apply formatting to transcript output. When set to true, additional formatting will be applied to transcripts to improve readability

+ */ + @java.lang.Override + @JsonSetter(value = "smart_format", nulls = Nulls.SKIP) + public _FinalStage smartFormat(Optional smartFormat) { + this.smartFormat = smartFormat; + return this; + } + + /** + *

Redaction removes sensitive information from your transcripts

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage redact(String redact) { + this.redact = Optional.ofNullable(redact); + return this; + } + + /** + *

Redaction removes sensitive information from your transcripts

+ */ + @java.lang.Override + @JsonSetter(value = "redact", nulls = Nulls.SKIP) + public _FinalStage redact(Optional redact) { + this.redact = redact; + return this; + } + + /** + *

Add punctuation and capitalization to the transcript

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage punctuate(Boolean punctuate) { + this.punctuate = Optional.ofNullable(punctuate); + return this; + } + + /** + *

Add punctuation and capitalization to the transcript

+ */ + @java.lang.Override + @JsonSetter(value = "punctuate", nulls = Nulls.SKIP) + public _FinalStage punctuate(Optional punctuate) { + this.punctuate = punctuate; + return this; + } + + /** + *

Profanity Filter looks for recognized profanity and converts it to the nearest recognized non-profane word or removes it from the transcript completely

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage profanityFilter(Boolean profanityFilter) { + this.profanityFilter = Optional.ofNullable(profanityFilter); + return this; + } + + /** + *

Profanity Filter looks for recognized profanity and converts it to the nearest recognized non-profane word or removes it from the transcript completely

+ */ + @java.lang.Override + @JsonSetter(value = "profanity_filter", nulls = Nulls.SKIP) + public _FinalStage profanityFilter(Optional profanityFilter) { + this.profanityFilter = profanityFilter; + return this; + } + + /** + *

Splits audio into paragraphs to improve transcript readability

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage paragraphs(Boolean paragraphs) { + this.paragraphs = Optional.ofNullable(paragraphs); + return this; + } + + /** + *

Splits audio into paragraphs to improve transcript readability

+ */ + @java.lang.Override + @JsonSetter(value = "paragraphs", nulls = Nulls.SKIP) + public _FinalStage paragraphs(Optional paragraphs) { + this.paragraphs = paragraphs; + return this; + } + + /** + *

Numerals converts numbers from written format to numerical format

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage numerals(Boolean numerals) { + this.numerals = Optional.ofNullable(numerals); + return this; + } + + /** + *

Numerals converts numbers from written format to numerical format

+ */ + @java.lang.Override + @JsonSetter(value = "numerals", nulls = Nulls.SKIP) + public _FinalStage numerals(Optional numerals) { + this.numerals = numerals; + return this; + } + + /** + *

Transcribe each audio channel independently

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage multichannel(Boolean multichannel) { + this.multichannel = Optional.ofNullable(multichannel); + return this; + } + + /** + *

Transcribe each audio channel independently

+ */ + @java.lang.Override + @JsonSetter(value = "multichannel", nulls = Nulls.SKIP) + public _FinalStage multichannel(Optional multichannel) { + this.multichannel = multichannel; + return this; + } + + /** + *

AI model used to process submitted audio

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage model(MediaTranscribeRequestModel model) { + this.model = Optional.ofNullable(model); + return this; + } + + /** + *

AI model used to process submitted audio

+ */ + @java.lang.Override + @JsonSetter(value = "model", nulls = Nulls.SKIP) + public _FinalStage model(Optional model) { + this.model = model; + return this; + } + + /** + *

Spoken measurements will be converted to their corresponding abbreviations

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage measurements(Boolean measurements) { + this.measurements = Optional.ofNullable(measurements); + return this; + } + + /** + *

Spoken measurements will be converted to their corresponding abbreviations

+ */ + @java.lang.Override + @JsonSetter(value = "measurements", nulls = Nulls.SKIP) + public _FinalStage measurements(Optional measurements) { + this.measurements = measurements; + return this; + } + + /** + *

The BCP-47 language tag that hints at the primary spoken language. Depending on the Model and API endpoint you choose only certain languages are available

+ * @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; + } + + /** + *

The BCP-47 language tag that hints at the primary spoken language. Depending on the Model and API endpoint you choose only certain languages are available

+ */ + @java.lang.Override + @JsonSetter(value = "language", nulls = Nulls.SKIP) + public _FinalStage language(Optional language) { + this.language = language; + return this; + } + + /** + *

Filler Words can help transcribe interruptions in your audio, like "uh" and "um"

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fillerWords(Boolean fillerWords) { + this.fillerWords = Optional.ofNullable(fillerWords); + return this; + } + + /** + *

Filler Words can help transcribe interruptions in your audio, like "uh" and "um"

+ */ + @java.lang.Override + @JsonSetter(value = "filler_words", nulls = Nulls.SKIP) + public _FinalStage fillerWords(Optional fillerWords) { + this.fillerWords = fillerWords; + return this; + } + + /** + *

Specify the expected encoding of your submitted audio

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage encoding(MediaTranscribeRequestEncoding encoding) { + this.encoding = Optional.ofNullable(encoding); + return this; + } + + /** + *

Specify the expected encoding of your submitted audio

+ */ + @java.lang.Override + @JsonSetter(value = "encoding", nulls = Nulls.SKIP) + public _FinalStage encoding(Optional encoding) { + this.encoding = encoding; + return this; + } + + /** + *

Dictation mode for controlling formatting with dictated speech

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage dictation(Boolean dictation) { + this.dictation = Optional.ofNullable(dictation); + return this; + } + + /** + *

Dictation mode for controlling formatting with dictated speech

+ */ + @java.lang.Override + @JsonSetter(value = "dictation", nulls = Nulls.SKIP) + public _FinalStage dictation(Optional dictation) { + this.dictation = dictation; + return this; + } + + /** + *

Recognize speaker changes. Each word in the transcript will be assigned a speaker number starting at 0

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage diarize(Boolean diarize) { + this.diarize = Optional.ofNullable(diarize); + return this; + } + + /** + *

Recognize speaker changes. Each word in the transcript will be assigned a speaker number starting at 0

+ */ + @java.lang.Override + @JsonSetter(value = "diarize", nulls = Nulls.SKIP) + public _FinalStage diarize(Optional diarize) { + this.diarize = diarize; + return this; + } + + /** + *

Identifies the dominant language spoken in submitted audio

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage detectLanguage(Boolean detectLanguage) { + this.detectLanguage = Optional.ofNullable(detectLanguage); + return this; + } + + /** + *

Identifies the dominant language spoken in submitted audio

+ */ + @java.lang.Override + @JsonSetter(value = "detect_language", nulls = Nulls.SKIP) + public _FinalStage detectLanguage(Optional detectLanguage) { + this.detectLanguage = detectLanguage; + return this; + } + + /** + *

Identifies and extracts key entities from content in submitted audio

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage detectEntities(Boolean detectEntities) { + this.detectEntities = Optional.ofNullable(detectEntities); + return this; + } + + /** + *

Identifies and extracts key entities from content in submitted audio

+ */ + @java.lang.Override + @JsonSetter(value = "detect_entities", nulls = Nulls.SKIP) + public _FinalStage detectEntities(Optional detectEntities) { + this.detectEntities = detectEntities; + return this; + } + + /** + *

Sets how the model will interpret intents submitted to the custom_intent param. When strict, the model will only return intents submitted using the custom_intent param. When extended, the model will return its own detected intents in the custom_intent param.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customIntentMode(MediaTranscribeRequestCustomIntentMode customIntentMode) { + this.customIntentMode = Optional.ofNullable(customIntentMode); + return this; + } + + /** + *

Sets how the model will interpret intents submitted to the custom_intent param. When strict, the model will only return intents submitted using the custom_intent param. When extended, the model will return its own detected intents in the custom_intent param.

+ */ + @java.lang.Override + @JsonSetter(value = "custom_intent_mode", nulls = Nulls.SKIP) + public _FinalStage customIntentMode(Optional customIntentMode) { + this.customIntentMode = customIntentMode; + return this; + } + + /** + *

Recognizes speaker intent throughout a transcript or text

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage intents(Boolean intents) { + this.intents = Optional.ofNullable(intents); + return this; + } + + /** + *

Recognizes speaker intent throughout a transcript or text

+ */ + @java.lang.Override + @JsonSetter(value = "intents", nulls = Nulls.SKIP) + public _FinalStage intents(Optional intents) { + this.intents = intents; + return this; + } + + /** + *

Sets how the model will interpret strings submitted to the custom_topic param. When strict, the model will only return topics submitted using the custom_topic param. When extended, the model will return its own detected topics in addition to those submitted using the custom_topic param

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customTopicMode(MediaTranscribeRequestCustomTopicMode customTopicMode) { + this.customTopicMode = Optional.ofNullable(customTopicMode); + return this; + } + + /** + *

Sets how the model will interpret strings submitted to the custom_topic param. When strict, the model will only return topics submitted using the custom_topic param. When extended, the model will return its own detected topics in addition to those submitted using the custom_topic param

+ */ + @java.lang.Override + @JsonSetter(value = "custom_topic_mode", nulls = Nulls.SKIP) + public _FinalStage customTopicMode(Optional customTopicMode) { + this.customTopicMode = customTopicMode; + return this; + } + + /** + *

Detect topics throughout a transcript or text

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage topics(Boolean topics) { + this.topics = Optional.ofNullable(topics); + return this; + } + + /** + *

Detect topics throughout a transcript or text

+ */ + @java.lang.Override + @JsonSetter(value = "topics", nulls = Nulls.SKIP) + public _FinalStage topics(Optional topics) { + this.topics = topics; + return this; + } + + /** + *

Summarize content. For Listen API, supports string version option. For Read API, accepts boolean only.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage summarize(MediaTranscribeRequestSummarize summarize) { + this.summarize = Optional.ofNullable(summarize); + return this; + } + + /** + *

Summarize content. For Listen API, supports string version option. For Read API, accepts boolean only.

+ */ + @java.lang.Override + @JsonSetter(value = "summarize", nulls = Nulls.SKIP) + public _FinalStage summarize(Optional summarize) { + this.summarize = summarize; + return this; + } + + /** + *

Recognizes the sentiment throughout a transcript or text

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sentiment(Boolean sentiment) { + this.sentiment = Optional.ofNullable(sentiment); + return this; + } + + /** + *

Recognizes the sentiment throughout a transcript or text

+ */ + @java.lang.Override + @JsonSetter(value = "sentiment", nulls = Nulls.SKIP) + public _FinalStage sentiment(Optional sentiment) { + this.sentiment = sentiment; + return this; + } + + /** + *

HTTP method by which the callback request will be made

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage callbackMethod(MediaTranscribeRequestCallbackMethod callbackMethod) { + this.callbackMethod = Optional.ofNullable(callbackMethod); + return this; + } + + /** + *

HTTP method by which the callback request will be made

+ */ + @java.lang.Override + @JsonSetter(value = "callback_method", nulls = Nulls.SKIP) + public _FinalStage callbackMethod(Optional callbackMethod) { + this.callbackMethod = callbackMethod; + return this; + } + + /** + *

URL to which we'll make the callback request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage callback(String callback) { + this.callback = Optional.ofNullable(callback); + return this; + } + + /** + *

URL to which we'll make the callback request

+ */ + @java.lang.Override + @JsonSetter(value = "callback", nulls = Nulls.SKIP) + public _FinalStage callback(Optional callback) { + this.callback = callback; + return this; + } + + @java.lang.Override + public _FinalStage search(String search) { + this.search = Optional.of(Collections.singletonList(search)); + return this; + } + + /** + *

Search for terms or phrases in submitted audio

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

Search for terms or phrases in submitted audio

+ */ + @java.lang.Override + @JsonSetter(value = "search", nulls = Nulls.SKIP) + public _FinalStage search(Optional> search) { + this.search = search; + return this; + } + + @java.lang.Override + public _FinalStage replace(String replace) { + this.replace = Optional.of(Collections.singletonList(replace)); + return this; + } + + /** + *

Search for terms or phrases in submitted audio and replaces them

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

Search for terms or phrases in submitted audio and replaces them

+ */ + @java.lang.Override + @JsonSetter(value = "replace", nulls = Nulls.SKIP) + public _FinalStage replace(Optional> replace) { + this.replace = replace; + return this; + } + + @java.lang.Override + public _FinalStage keywords(String keywords) { + this.keywords = Optional.of(Collections.singletonList(keywords)); + return this; + } + + /** + *

Keywords can boost or suppress specialized terminology and brands

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

Keywords can boost or suppress specialized terminology and brands

+ */ + @java.lang.Override + @JsonSetter(value = "keywords", nulls = Nulls.SKIP) + public _FinalStage keywords(Optional> keywords) { + this.keywords = keywords; + return this; + } + + @java.lang.Override + public _FinalStage keyterm(String keyterm) { + this.keyterm = Optional.of(Collections.singletonList(keyterm)); + return this; + } + + /** + *

Key term prompting can boost or suppress specialized terminology and brands. Only compatible with Nova-3

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

Key term prompting can boost or suppress specialized terminology and brands. Only compatible with Nova-3

+ */ + @java.lang.Override + @JsonSetter(value = "keyterm", nulls = Nulls.SKIP) + public _FinalStage keyterm(Optional> keyterm) { + this.keyterm = keyterm; + return this; + } + + @java.lang.Override + public _FinalStage customIntent(String customIntent) { + this.customIntent = Optional.of(Collections.singletonList(customIntent)); + return this; + } + + /** + *

Custom intents you want the model to detect within your input audio if present

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

Custom intents you want the model to detect within your input audio if present

+ */ + @java.lang.Override + @JsonSetter(value = "custom_intent", nulls = Nulls.SKIP) + public _FinalStage customIntent(Optional> customIntent) { + this.customIntent = customIntent; + return this; + } + + @java.lang.Override + public _FinalStage customTopic(String customTopic) { + this.customTopic = Optional.of(Collections.singletonList(customTopic)); + return this; + } + + /** + *

Custom topics you want the model to detect within your input audio or text if present Submit up to 100.

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

Custom topics you want the model to detect within your input audio or text if present Submit up to 100.

+ */ + @java.lang.Override + @JsonSetter(value = "custom_topic", nulls = Nulls.SKIP) + public _FinalStage customTopic(Optional> customTopic) { + this.customTopic = customTopic; + return this; + } + + @java.lang.Override + public _FinalStage tag(String tag) { + this.tag = Optional.of(Collections.singletonList(tag)); + return this; + } + + /** + *

Label your requests for the purpose of identification during usage reporting

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

Label your requests for the purpose of identification during usage reporting

+ */ + @java.lang.Override + @JsonSetter(value = "tag", nulls = Nulls.SKIP) + public _FinalStage tag(Optional> tag) { + this.tag = tag; + return this; + } + + @java.lang.Override + public _FinalStage extra(String extra) { + this.extra = Optional.of(Collections.singletonList(extra)); + return this; + } + + /** + *

Arbitrary key-value pairs that are attached to the API response for usage in downstream processing

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

Arbitrary key-value pairs that are attached to the API response for usage in downstream processing

+ */ + @java.lang.Override + @JsonSetter(value = "extra", nulls = Nulls.SKIP) + public _FinalStage extra(Optional> extra) { + this.extra = extra; + return this; + } + + @java.lang.Override + public MediaTranscribeRequestOctetStream build() { + return new MediaTranscribeRequestOctetStream( + extra, + tag, + customTopic, + customIntent, + keyterm, + keywords, + replace, + search, + callback, + callbackMethod, + sentiment, + summarize, + topics, + customTopicMode, + intents, + customIntentMode, + detectEntities, + detectLanguage, + diarize, + dictation, + encoding, + fillerWords, + language, + measurements, + model, + multichannel, + numerals, + paragraphs, + profanityFilter, + punctuate, + redact, + smartFormat, + utterances, + uttSplit, + version, + mipOptOut, + body, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/listen/v1/media/types/MediaTranscribeRequestCallbackMethod.java b/src/main/java/com/deepgram/resources/listen/v1/media/types/MediaTranscribeRequestCallbackMethod.java new file mode 100644 index 0000000..cc8b65d --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/v1/media/types/MediaTranscribeRequestCallbackMethod.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen.v1.media.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class MediaTranscribeRequestCallbackMethod { + public static final MediaTranscribeRequestCallbackMethod PUT = + new MediaTranscribeRequestCallbackMethod(Value.PUT, "PUT"); + + public static final MediaTranscribeRequestCallbackMethod POST = + new MediaTranscribeRequestCallbackMethod(Value.POST, "POST"); + + private final Value value; + + private final String string; + + MediaTranscribeRequestCallbackMethod(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof MediaTranscribeRequestCallbackMethod + && this.string.equals(((MediaTranscribeRequestCallbackMethod) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PUT: + return visitor.visitPut(); + case POST: + return visitor.visitPost(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static MediaTranscribeRequestCallbackMethod valueOf(String value) { + switch (value) { + case "PUT": + return PUT; + case "POST": + return POST; + default: + return new MediaTranscribeRequestCallbackMethod(Value.UNKNOWN, value); + } + } + + public enum Value { + POST, + + PUT, + + UNKNOWN + } + + public interface Visitor { + T visitPost(); + + T visitPut(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/listen/v1/media/types/MediaTranscribeRequestCustomIntentMode.java b/src/main/java/com/deepgram/resources/listen/v1/media/types/MediaTranscribeRequestCustomIntentMode.java new file mode 100644 index 0000000..94511d3 --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/v1/media/types/MediaTranscribeRequestCustomIntentMode.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen.v1.media.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class MediaTranscribeRequestCustomIntentMode { + public static final MediaTranscribeRequestCustomIntentMode STRICT = + new MediaTranscribeRequestCustomIntentMode(Value.STRICT, "strict"); + + public static final MediaTranscribeRequestCustomIntentMode EXTENDED = + new MediaTranscribeRequestCustomIntentMode(Value.EXTENDED, "extended"); + + private final Value value; + + private final String string; + + MediaTranscribeRequestCustomIntentMode(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof MediaTranscribeRequestCustomIntentMode + && this.string.equals(((MediaTranscribeRequestCustomIntentMode) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case STRICT: + return visitor.visitStrict(); + case EXTENDED: + return visitor.visitExtended(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static MediaTranscribeRequestCustomIntentMode valueOf(String value) { + switch (value) { + case "strict": + return STRICT; + case "extended": + return EXTENDED; + default: + return new MediaTranscribeRequestCustomIntentMode(Value.UNKNOWN, value); + } + } + + public enum Value { + EXTENDED, + + STRICT, + + UNKNOWN + } + + public interface Visitor { + T visitExtended(); + + T visitStrict(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/listen/v1/media/types/MediaTranscribeRequestCustomTopicMode.java b/src/main/java/com/deepgram/resources/listen/v1/media/types/MediaTranscribeRequestCustomTopicMode.java new file mode 100644 index 0000000..d6e20a2 --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/v1/media/types/MediaTranscribeRequestCustomTopicMode.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen.v1.media.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class MediaTranscribeRequestCustomTopicMode { + public static final MediaTranscribeRequestCustomTopicMode STRICT = + new MediaTranscribeRequestCustomTopicMode(Value.STRICT, "strict"); + + public static final MediaTranscribeRequestCustomTopicMode EXTENDED = + new MediaTranscribeRequestCustomTopicMode(Value.EXTENDED, "extended"); + + private final Value value; + + private final String string; + + MediaTranscribeRequestCustomTopicMode(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof MediaTranscribeRequestCustomTopicMode + && this.string.equals(((MediaTranscribeRequestCustomTopicMode) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case STRICT: + return visitor.visitStrict(); + case EXTENDED: + return visitor.visitExtended(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static MediaTranscribeRequestCustomTopicMode valueOf(String value) { + switch (value) { + case "strict": + return STRICT; + case "extended": + return EXTENDED; + default: + return new MediaTranscribeRequestCustomTopicMode(Value.UNKNOWN, value); + } + } + + public enum Value { + EXTENDED, + + STRICT, + + UNKNOWN + } + + public interface Visitor { + T visitExtended(); + + T visitStrict(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/listen/v1/media/types/MediaTranscribeRequestEncoding.java b/src/main/java/com/deepgram/resources/listen/v1/media/types/MediaTranscribeRequestEncoding.java new file mode 100644 index 0000000..f72667d --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/v1/media/types/MediaTranscribeRequestEncoding.java @@ -0,0 +1,147 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen.v1.media.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class MediaTranscribeRequestEncoding { + public static final MediaTranscribeRequestEncoding MULAW = new MediaTranscribeRequestEncoding(Value.MULAW, "mulaw"); + + public static final MediaTranscribeRequestEncoding AMR_WB = + new MediaTranscribeRequestEncoding(Value.AMR_WB, "amr-wb"); + + public static final MediaTranscribeRequestEncoding FLAC = new MediaTranscribeRequestEncoding(Value.FLAC, "flac"); + + public static final MediaTranscribeRequestEncoding SPEEX = new MediaTranscribeRequestEncoding(Value.SPEEX, "speex"); + + public static final MediaTranscribeRequestEncoding LINEAR16 = + new MediaTranscribeRequestEncoding(Value.LINEAR16, "linear16"); + + public static final MediaTranscribeRequestEncoding OPUS = new MediaTranscribeRequestEncoding(Value.OPUS, "opus"); + + public static final MediaTranscribeRequestEncoding AMR_NB = + new MediaTranscribeRequestEncoding(Value.AMR_NB, "amr-nb"); + + public static final MediaTranscribeRequestEncoding G729 = new MediaTranscribeRequestEncoding(Value.G729, "g729"); + + private final Value value; + + private final String string; + + MediaTranscribeRequestEncoding(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof MediaTranscribeRequestEncoding + && this.string.equals(((MediaTranscribeRequestEncoding) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MULAW: + return visitor.visitMulaw(); + case AMR_WB: + return visitor.visitAmrWb(); + case FLAC: + return visitor.visitFlac(); + case SPEEX: + return visitor.visitSpeex(); + case LINEAR16: + return visitor.visitLinear16(); + case OPUS: + return visitor.visitOpus(); + case AMR_NB: + return visitor.visitAmrNb(); + case G729: + return visitor.visitG729(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static MediaTranscribeRequestEncoding valueOf(String value) { + switch (value) { + case "mulaw": + return MULAW; + case "amr-wb": + return AMR_WB; + case "flac": + return FLAC; + case "speex": + return SPEEX; + case "linear16": + return LINEAR16; + case "opus": + return OPUS; + case "amr-nb": + return AMR_NB; + case "g729": + return G729; + default: + return new MediaTranscribeRequestEncoding(Value.UNKNOWN, value); + } + } + + public enum Value { + LINEAR16, + + FLAC, + + MULAW, + + AMR_NB, + + AMR_WB, + + OPUS, + + SPEEX, + + G729, + + UNKNOWN + } + + public interface Visitor { + T visitLinear16(); + + T visitFlac(); + + T visitMulaw(); + + T visitAmrNb(); + + T visitAmrWb(); + + T visitOpus(); + + T visitSpeex(); + + T visitG729(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/listen/v1/media/types/MediaTranscribeRequestModel.java b/src/main/java/com/deepgram/resources/listen/v1/media/types/MediaTranscribeRequestModel.java new file mode 100644 index 0000000..175ccdb --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/v1/media/types/MediaTranscribeRequestModel.java @@ -0,0 +1,376 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen.v1.media.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class MediaTranscribeRequestModel { + public static final MediaTranscribeRequestModel NOVA2VOICEMAIL = + new MediaTranscribeRequestModel(Value.NOVA2VOICEMAIL, "nova-2-voicemail"); + + public static final MediaTranscribeRequestModel NOVA3 = new MediaTranscribeRequestModel(Value.NOVA3, "nova-3"); + + public static final MediaTranscribeRequestModel FINANCE = new MediaTranscribeRequestModel(Value.FINANCE, "finance"); + + public static final MediaTranscribeRequestModel NOVA_MEDICAL = + new MediaTranscribeRequestModel(Value.NOVA_MEDICAL, "nova-medical"); + + public static final MediaTranscribeRequestModel ENHANCED_GENERAL = + new MediaTranscribeRequestModel(Value.ENHANCED_GENERAL, "enhanced-general"); + + public static final MediaTranscribeRequestModel NOVA_GENERAL = + new MediaTranscribeRequestModel(Value.NOVA_GENERAL, "nova-general"); + + public static final MediaTranscribeRequestModel NOVA3MEDICAL = + new MediaTranscribeRequestModel(Value.NOVA3MEDICAL, "nova-3-medical"); + + public static final MediaTranscribeRequestModel NOVA2 = new MediaTranscribeRequestModel(Value.NOVA2, "nova-2"); + + public static final MediaTranscribeRequestModel VOICEMAIL = + new MediaTranscribeRequestModel(Value.VOICEMAIL, "voicemail"); + + public static final MediaTranscribeRequestModel ENHANCED_FINANCE = + new MediaTranscribeRequestModel(Value.ENHANCED_FINANCE, "enhanced-finance"); + + public static final MediaTranscribeRequestModel NOVA2FINANCE = + new MediaTranscribeRequestModel(Value.NOVA2FINANCE, "nova-2-finance"); + + public static final MediaTranscribeRequestModel MEETING = new MediaTranscribeRequestModel(Value.MEETING, "meeting"); + + public static final MediaTranscribeRequestModel PHONECALL = + new MediaTranscribeRequestModel(Value.PHONECALL, "phonecall"); + + public static final MediaTranscribeRequestModel NOVA2CONVERSATIONALAI = + new MediaTranscribeRequestModel(Value.NOVA2CONVERSATIONALAI, "nova-2-conversationalai"); + + public static final MediaTranscribeRequestModel VIDEO = new MediaTranscribeRequestModel(Value.VIDEO, "video"); + + public static final MediaTranscribeRequestModel CONVERSATIONALAI = + new MediaTranscribeRequestModel(Value.CONVERSATIONALAI, "conversationalai"); + + public static final MediaTranscribeRequestModel NOVA2VIDEO = + new MediaTranscribeRequestModel(Value.NOVA2VIDEO, "nova-2-video"); + + public static final MediaTranscribeRequestModel NOVA2DRIVETHRU = + new MediaTranscribeRequestModel(Value.NOVA2DRIVETHRU, "nova-2-drivethru"); + + public static final MediaTranscribeRequestModel BASE = new MediaTranscribeRequestModel(Value.BASE, "base"); + + public static final MediaTranscribeRequestModel NOVA2GENERAL = + new MediaTranscribeRequestModel(Value.NOVA2GENERAL, "nova-2-general"); + + public static final MediaTranscribeRequestModel NOVA = new MediaTranscribeRequestModel(Value.NOVA, "nova"); + + public static final MediaTranscribeRequestModel ENHANCED_PHONECALL = + new MediaTranscribeRequestModel(Value.ENHANCED_PHONECALL, "enhanced-phonecall"); + + public static final MediaTranscribeRequestModel NOVA2MEDICAL = + new MediaTranscribeRequestModel(Value.NOVA2MEDICAL, "nova-2-medical"); + + public static final MediaTranscribeRequestModel NOVA3GENERAL = + new MediaTranscribeRequestModel(Value.NOVA3GENERAL, "nova-3-general"); + + public static final MediaTranscribeRequestModel ENHANCED = + new MediaTranscribeRequestModel(Value.ENHANCED, "enhanced"); + + public static final MediaTranscribeRequestModel NOVA_PHONECALL = + new MediaTranscribeRequestModel(Value.NOVA_PHONECALL, "nova-phonecall"); + + public static final MediaTranscribeRequestModel NOVA2MEETING = + new MediaTranscribeRequestModel(Value.NOVA2MEETING, "nova-2-meeting"); + + public static final MediaTranscribeRequestModel NOVA2AUTOMOTIVE = + new MediaTranscribeRequestModel(Value.NOVA2AUTOMOTIVE, "nova-2-automotive"); + + public static final MediaTranscribeRequestModel ENHANCED_MEETING = + new MediaTranscribeRequestModel(Value.ENHANCED_MEETING, "enhanced-meeting"); + + private final Value value; + + private final String string; + + MediaTranscribeRequestModel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof MediaTranscribeRequestModel + && this.string.equals(((MediaTranscribeRequestModel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case NOVA2VOICEMAIL: + return visitor.visitNova2Voicemail(); + case NOVA3: + return visitor.visitNova3(); + case FINANCE: + return visitor.visitFinance(); + case NOVA_MEDICAL: + return visitor.visitNovaMedical(); + case ENHANCED_GENERAL: + return visitor.visitEnhancedGeneral(); + case NOVA_GENERAL: + return visitor.visitNovaGeneral(); + case NOVA3MEDICAL: + return visitor.visitNova3Medical(); + case NOVA2: + return visitor.visitNova2(); + case VOICEMAIL: + return visitor.visitVoicemail(); + case ENHANCED_FINANCE: + return visitor.visitEnhancedFinance(); + case NOVA2FINANCE: + return visitor.visitNova2Finance(); + case MEETING: + return visitor.visitMeeting(); + case PHONECALL: + return visitor.visitPhonecall(); + case NOVA2CONVERSATIONALAI: + return visitor.visitNova2Conversationalai(); + case VIDEO: + return visitor.visitVideo(); + case CONVERSATIONALAI: + return visitor.visitConversationalai(); + case NOVA2VIDEO: + return visitor.visitNova2Video(); + case NOVA2DRIVETHRU: + return visitor.visitNova2Drivethru(); + case BASE: + return visitor.visitBase(); + case NOVA2GENERAL: + return visitor.visitNova2General(); + case NOVA: + return visitor.visitNova(); + case ENHANCED_PHONECALL: + return visitor.visitEnhancedPhonecall(); + case NOVA2MEDICAL: + return visitor.visitNova2Medical(); + case NOVA3GENERAL: + return visitor.visitNova3General(); + case ENHANCED: + return visitor.visitEnhanced(); + case NOVA_PHONECALL: + return visitor.visitNovaPhonecall(); + case NOVA2MEETING: + return visitor.visitNova2Meeting(); + case NOVA2AUTOMOTIVE: + return visitor.visitNova2Automotive(); + case ENHANCED_MEETING: + return visitor.visitEnhancedMeeting(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static MediaTranscribeRequestModel valueOf(String value) { + switch (value) { + case "nova-2-voicemail": + return NOVA2VOICEMAIL; + case "nova-3": + return NOVA3; + case "finance": + return FINANCE; + case "nova-medical": + return NOVA_MEDICAL; + case "enhanced-general": + return ENHANCED_GENERAL; + case "nova-general": + return NOVA_GENERAL; + case "nova-3-medical": + return NOVA3MEDICAL; + case "nova-2": + return NOVA2; + case "voicemail": + return VOICEMAIL; + case "enhanced-finance": + return ENHANCED_FINANCE; + case "nova-2-finance": + return NOVA2FINANCE; + case "meeting": + return MEETING; + case "phonecall": + return PHONECALL; + case "nova-2-conversationalai": + return NOVA2CONVERSATIONALAI; + case "video": + return VIDEO; + case "conversationalai": + return CONVERSATIONALAI; + case "nova-2-video": + return NOVA2VIDEO; + case "nova-2-drivethru": + return NOVA2DRIVETHRU; + case "base": + return BASE; + case "nova-2-general": + return NOVA2GENERAL; + case "nova": + return NOVA; + case "enhanced-phonecall": + return ENHANCED_PHONECALL; + case "nova-2-medical": + return NOVA2MEDICAL; + case "nova-3-general": + return NOVA3GENERAL; + case "enhanced": + return ENHANCED; + case "nova-phonecall": + return NOVA_PHONECALL; + case "nova-2-meeting": + return NOVA2MEETING; + case "nova-2-automotive": + return NOVA2AUTOMOTIVE; + case "enhanced-meeting": + return ENHANCED_MEETING; + default: + return new MediaTranscribeRequestModel(Value.UNKNOWN, value); + } + } + + public enum Value { + NOVA3, + + NOVA3GENERAL, + + NOVA3MEDICAL, + + NOVA2, + + NOVA2GENERAL, + + NOVA2MEETING, + + NOVA2FINANCE, + + NOVA2CONVERSATIONALAI, + + NOVA2VOICEMAIL, + + NOVA2VIDEO, + + NOVA2MEDICAL, + + NOVA2DRIVETHRU, + + NOVA2AUTOMOTIVE, + + NOVA, + + NOVA_GENERAL, + + NOVA_PHONECALL, + + NOVA_MEDICAL, + + ENHANCED, + + ENHANCED_GENERAL, + + ENHANCED_MEETING, + + ENHANCED_PHONECALL, + + ENHANCED_FINANCE, + + BASE, + + MEETING, + + PHONECALL, + + FINANCE, + + CONVERSATIONALAI, + + VOICEMAIL, + + VIDEO, + + UNKNOWN + } + + public interface Visitor { + T visitNova3(); + + T visitNova3General(); + + T visitNova3Medical(); + + T visitNova2(); + + T visitNova2General(); + + T visitNova2Meeting(); + + T visitNova2Finance(); + + T visitNova2Conversationalai(); + + T visitNova2Voicemail(); + + T visitNova2Video(); + + T visitNova2Medical(); + + T visitNova2Drivethru(); + + T visitNova2Automotive(); + + T visitNova(); + + T visitNovaGeneral(); + + T visitNovaPhonecall(); + + T visitNovaMedical(); + + T visitEnhanced(); + + T visitEnhancedGeneral(); + + T visitEnhancedMeeting(); + + T visitEnhancedPhonecall(); + + T visitEnhancedFinance(); + + T visitBase(); + + T visitMeeting(); + + T visitPhonecall(); + + T visitFinance(); + + T visitConversationalai(); + + T visitVoicemail(); + + T visitVideo(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/listen/v1/media/types/MediaTranscribeRequestSummarize.java b/src/main/java/com/deepgram/resources/listen/v1/media/types/MediaTranscribeRequestSummarize.java new file mode 100644 index 0000000..d94cf82 --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/v1/media/types/MediaTranscribeRequestSummarize.java @@ -0,0 +1,74 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen.v1.media.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class MediaTranscribeRequestSummarize { + public static final MediaTranscribeRequestSummarize V2 = new MediaTranscribeRequestSummarize(Value.V2, "v2"); + + private final Value value; + + private final String string; + + MediaTranscribeRequestSummarize(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof MediaTranscribeRequestSummarize + && this.string.equals(((MediaTranscribeRequestSummarize) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V2: + return visitor.visitV2(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static MediaTranscribeRequestSummarize valueOf(String value) { + switch (value) { + case "v2": + return V2; + default: + return new MediaTranscribeRequestSummarize(Value.UNKNOWN, value); + } + } + + public enum Value { + V2, + + UNKNOWN + } + + public interface Visitor { + T visitV2(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/listen/v1/media/types/MediaTranscribeRequestVersion.java b/src/main/java/com/deepgram/resources/listen/v1/media/types/MediaTranscribeRequestVersion.java new file mode 100644 index 0000000..94ceb4c --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/v1/media/types/MediaTranscribeRequestVersion.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen.v1.media.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class MediaTranscribeRequestVersion { + public static final MediaTranscribeRequestVersion LATEST = + new MediaTranscribeRequestVersion(Value.LATEST, "latest"); + + private final Value value; + + private final String string; + + MediaTranscribeRequestVersion(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof MediaTranscribeRequestVersion + && this.string.equals(((MediaTranscribeRequestVersion) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case LATEST: + return visitor.visitLatest(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static MediaTranscribeRequestVersion valueOf(String value) { + switch (value) { + case "latest": + return LATEST; + default: + return new MediaTranscribeRequestVersion(Value.UNKNOWN, value); + } + } + + public enum Value { + LATEST, + + UNKNOWN + } + + public interface Visitor { + T visitLatest(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/listen/v1/media/types/MediaTranscribeResponse.java b/src/main/java/com/deepgram/resources/listen/v1/media/types/MediaTranscribeResponse.java new file mode 100644 index 0000000..b62b950 --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/v1/media/types/MediaTranscribeResponse.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen.v1.media.types; + +import com.deepgram.core.ObjectMappers; +import com.deepgram.types.ListenV1AcceptedResponse; +import com.deepgram.types.ListenV1Response; +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 java.io.IOException; +import java.util.Objects; + +@JsonDeserialize(using = MediaTranscribeResponse.Deserializer.class) +public final class MediaTranscribeResponse { + private final Object value; + + private final int type; + + private MediaTranscribeResponse(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + @SuppressWarnings("unchecked") + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((ListenV1Response) this.value); + } else if (this.type == 1) { + return visitor.visit((ListenV1AcceptedResponse) 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 MediaTranscribeResponse && equalTo((MediaTranscribeResponse) other); + } + + private boolean equalTo(MediaTranscribeResponse 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 MediaTranscribeResponse of(ListenV1Response value) { + return new MediaTranscribeResponse(value, 0); + } + + public static MediaTranscribeResponse of(ListenV1AcceptedResponse value) { + return new MediaTranscribeResponse(value, 1); + } + + public interface Visitor { + T visit(ListenV1Response value); + + T visit(ListenV1AcceptedResponse value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(MediaTranscribeResponse.class); + } + + @java.lang.Override + public MediaTranscribeResponse deserialize(JsonParser p, DeserializationContext context) throws IOException { + Object value = p.readValueAs(Object.class); + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, ListenV1Response.class)); + } catch (RuntimeException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, ListenV1AcceptedResponse.class)); + } catch (RuntimeException e) { + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1CloseStream.java b/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1CloseStream.java new file mode 100644 index 0000000..5731273 --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1CloseStream.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListenV1CloseStream.Builder.class) +public final class ListenV1CloseStream { + private final ListenV1CloseStreamType type; + + private final Map additionalProperties; + + private ListenV1CloseStream(ListenV1CloseStreamType type, Map additionalProperties) { + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return Message type identifier + */ + @JsonProperty("type") + public ListenV1CloseStreamType getType() { + return type; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListenV1CloseStream && equalTo((ListenV1CloseStream) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListenV1CloseStream other) { + return type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TypeStage builder() { + return new Builder(); + } + + public interface TypeStage { + /** + *

Message type identifier

+ */ + _FinalStage type(@NotNull ListenV1CloseStreamType type); + + Builder from(ListenV1CloseStream other); + } + + public interface _FinalStage { + ListenV1CloseStream build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TypeStage, _FinalStage { + private ListenV1CloseStreamType type; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListenV1CloseStream other) { + type(other.getType()); + return this; + } + + /** + *

Message type identifier

+ *

Message type identifier

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull ListenV1CloseStreamType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + @java.lang.Override + public ListenV1CloseStream build() { + return new ListenV1CloseStream(type, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1CloseStreamType.java b/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1CloseStreamType.java new file mode 100644 index 0000000..af723e7 --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1CloseStreamType.java @@ -0,0 +1,95 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen.v1.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListenV1CloseStreamType { + public static final ListenV1CloseStreamType CLOSE_STREAM = + new ListenV1CloseStreamType(Value.CLOSE_STREAM, "CloseStream"); + + public static final ListenV1CloseStreamType FINALIZE = new ListenV1CloseStreamType(Value.FINALIZE, "Finalize"); + + public static final ListenV1CloseStreamType KEEP_ALIVE = new ListenV1CloseStreamType(Value.KEEP_ALIVE, "KeepAlive"); + + private final Value value; + + private final String string; + + ListenV1CloseStreamType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListenV1CloseStreamType + && this.string.equals(((ListenV1CloseStreamType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CLOSE_STREAM: + return visitor.visitCloseStream(); + case FINALIZE: + return visitor.visitFinalize(); + case KEEP_ALIVE: + return visitor.visitKeepAlive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListenV1CloseStreamType valueOf(String value) { + switch (value) { + case "CloseStream": + return CLOSE_STREAM; + case "Finalize": + return FINALIZE; + case "KeepAlive": + return KEEP_ALIVE; + default: + return new ListenV1CloseStreamType(Value.UNKNOWN, value); + } + } + + public enum Value { + FINALIZE, + + CLOSE_STREAM, + + KEEP_ALIVE, + + UNKNOWN + } + + public interface Visitor { + T visitFinalize(); + + T visitCloseStream(); + + T visitKeepAlive(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1Finalize.java b/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1Finalize.java new file mode 100644 index 0000000..c1bac7f --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1Finalize.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListenV1Finalize.Builder.class) +public final class ListenV1Finalize { + private final ListenV1FinalizeType type; + + private final Map additionalProperties; + + private ListenV1Finalize(ListenV1FinalizeType type, Map additionalProperties) { + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return Message type identifier + */ + @JsonProperty("type") + public ListenV1FinalizeType getType() { + return type; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListenV1Finalize && equalTo((ListenV1Finalize) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListenV1Finalize other) { + return type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TypeStage builder() { + return new Builder(); + } + + public interface TypeStage { + /** + *

Message type identifier

+ */ + _FinalStage type(@NotNull ListenV1FinalizeType type); + + Builder from(ListenV1Finalize other); + } + + public interface _FinalStage { + ListenV1Finalize build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TypeStage, _FinalStage { + private ListenV1FinalizeType type; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListenV1Finalize other) { + type(other.getType()); + return this; + } + + /** + *

Message type identifier

+ *

Message type identifier

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull ListenV1FinalizeType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + @java.lang.Override + public ListenV1Finalize build() { + return new ListenV1Finalize(type, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1FinalizeType.java b/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1FinalizeType.java new file mode 100644 index 0000000..1bf7cd1 --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1FinalizeType.java @@ -0,0 +1,93 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen.v1.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListenV1FinalizeType { + public static final ListenV1FinalizeType CLOSE_STREAM = new ListenV1FinalizeType(Value.CLOSE_STREAM, "CloseStream"); + + public static final ListenV1FinalizeType FINALIZE = new ListenV1FinalizeType(Value.FINALIZE, "Finalize"); + + public static final ListenV1FinalizeType KEEP_ALIVE = new ListenV1FinalizeType(Value.KEEP_ALIVE, "KeepAlive"); + + private final Value value; + + private final String string; + + ListenV1FinalizeType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListenV1FinalizeType && this.string.equals(((ListenV1FinalizeType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CLOSE_STREAM: + return visitor.visitCloseStream(); + case FINALIZE: + return visitor.visitFinalize(); + case KEEP_ALIVE: + return visitor.visitKeepAlive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListenV1FinalizeType valueOf(String value) { + switch (value) { + case "CloseStream": + return CLOSE_STREAM; + case "Finalize": + return FINALIZE; + case "KeepAlive": + return KEEP_ALIVE; + default: + return new ListenV1FinalizeType(Value.UNKNOWN, value); + } + } + + public enum Value { + FINALIZE, + + CLOSE_STREAM, + + KEEP_ALIVE, + + UNKNOWN + } + + public interface Visitor { + T visitFinalize(); + + T visitCloseStream(); + + T visitKeepAlive(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1KeepAlive.java b/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1KeepAlive.java new file mode 100644 index 0000000..2cfb71e --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1KeepAlive.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListenV1KeepAlive.Builder.class) +public final class ListenV1KeepAlive { + private final ListenV1KeepAliveType type; + + private final Map additionalProperties; + + private ListenV1KeepAlive(ListenV1KeepAliveType type, Map additionalProperties) { + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return Message type identifier + */ + @JsonProperty("type") + public ListenV1KeepAliveType getType() { + return type; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListenV1KeepAlive && equalTo((ListenV1KeepAlive) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListenV1KeepAlive other) { + return type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TypeStage builder() { + return new Builder(); + } + + public interface TypeStage { + /** + *

Message type identifier

+ */ + _FinalStage type(@NotNull ListenV1KeepAliveType type); + + Builder from(ListenV1KeepAlive other); + } + + public interface _FinalStage { + ListenV1KeepAlive build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TypeStage, _FinalStage { + private ListenV1KeepAliveType type; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListenV1KeepAlive other) { + type(other.getType()); + return this; + } + + /** + *

Message type identifier

+ *

Message type identifier

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull ListenV1KeepAliveType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + @java.lang.Override + public ListenV1KeepAlive build() { + return new ListenV1KeepAlive(type, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1KeepAliveType.java b/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1KeepAliveType.java new file mode 100644 index 0000000..5e168b9 --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1KeepAliveType.java @@ -0,0 +1,95 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen.v1.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListenV1KeepAliveType { + public static final ListenV1KeepAliveType CLOSE_STREAM = + new ListenV1KeepAliveType(Value.CLOSE_STREAM, "CloseStream"); + + public static final ListenV1KeepAliveType FINALIZE = new ListenV1KeepAliveType(Value.FINALIZE, "Finalize"); + + public static final ListenV1KeepAliveType KEEP_ALIVE = new ListenV1KeepAliveType(Value.KEEP_ALIVE, "KeepAlive"); + + private final Value value; + + private final String string; + + ListenV1KeepAliveType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListenV1KeepAliveType + && this.string.equals(((ListenV1KeepAliveType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CLOSE_STREAM: + return visitor.visitCloseStream(); + case FINALIZE: + return visitor.visitFinalize(); + case KEEP_ALIVE: + return visitor.visitKeepAlive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListenV1KeepAliveType valueOf(String value) { + switch (value) { + case "CloseStream": + return CLOSE_STREAM; + case "Finalize": + return FINALIZE; + case "KeepAlive": + return KEEP_ALIVE; + default: + return new ListenV1KeepAliveType(Value.UNKNOWN, value); + } + } + + public enum Value { + FINALIZE, + + CLOSE_STREAM, + + KEEP_ALIVE, + + UNKNOWN + } + + public interface Visitor { + T visitFinalize(); + + T visitCloseStream(); + + T visitKeepAlive(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1Metadata.java b/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1Metadata.java new file mode 100644 index 0000000..7883331 --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1Metadata.java @@ -0,0 +1,323 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListenV1Metadata.Builder.class) +public final class ListenV1Metadata { + private final String transactionKey; + + private final String requestId; + + private final String sha256; + + private final String created; + + private final double duration; + + private final double channels; + + private final Map additionalProperties; + + private ListenV1Metadata( + String transactionKey, + String requestId, + String sha256, + String created, + double duration, + double channels, + Map additionalProperties) { + this.transactionKey = transactionKey; + this.requestId = requestId; + this.sha256 = sha256; + this.created = created; + this.duration = duration; + this.channels = channels; + this.additionalProperties = additionalProperties; + } + + /** + * @return Message type identifier + */ + @JsonProperty("type") + public String getType() { + return "Metadata"; + } + + /** + * @return The transaction key + */ + @JsonProperty("transaction_key") + public String getTransactionKey() { + return transactionKey; + } + + /** + * @return The request ID + */ + @JsonProperty("request_id") + public String getRequestId() { + return requestId; + } + + /** + * @return The sha256 + */ + @JsonProperty("sha256") + public String getSha256() { + return sha256; + } + + /** + * @return The created + */ + @JsonProperty("created") + public String getCreated() { + return created; + } + + /** + * @return The duration + */ + @JsonProperty("duration") + public double getDuration() { + return duration; + } + + /** + * @return The channels + */ + @JsonProperty("channels") + public double getChannels() { + return channels; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListenV1Metadata && equalTo((ListenV1Metadata) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListenV1Metadata other) { + return transactionKey.equals(other.transactionKey) + && requestId.equals(other.requestId) + && sha256.equals(other.sha256) + && created.equals(other.created) + && duration == other.duration + && channels == other.channels; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.transactionKey, this.requestId, this.sha256, this.created, this.duration, this.channels); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TransactionKeyStage builder() { + return new Builder(); + } + + public interface TransactionKeyStage { + /** + *

The transaction key

+ */ + RequestIdStage transactionKey(@NotNull String transactionKey); + + Builder from(ListenV1Metadata other); + } + + public interface RequestIdStage { + /** + *

The request ID

+ */ + Sha256Stage requestId(@NotNull String requestId); + } + + public interface Sha256Stage { + /** + *

The sha256

+ */ + CreatedStage sha256(@NotNull String sha256); + } + + public interface CreatedStage { + /** + *

The created

+ */ + DurationStage created(@NotNull String created); + } + + public interface DurationStage { + /** + *

The duration

+ */ + ChannelsStage duration(double duration); + } + + public interface ChannelsStage { + /** + *

The channels

+ */ + _FinalStage channels(double channels); + } + + public interface _FinalStage { + ListenV1Metadata build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements TransactionKeyStage, + RequestIdStage, + Sha256Stage, + CreatedStage, + DurationStage, + ChannelsStage, + _FinalStage { + private String transactionKey; + + private String requestId; + + private String sha256; + + private String created; + + private double duration; + + private double channels; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListenV1Metadata other) { + transactionKey(other.getTransactionKey()); + requestId(other.getRequestId()); + sha256(other.getSha256()); + created(other.getCreated()); + duration(other.getDuration()); + channels(other.getChannels()); + return this; + } + + /** + *

The transaction key

+ *

The transaction key

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

The request ID

+ *

The request ID

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

The sha256

+ *

The sha256

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

The created

+ *

The created

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

The duration

+ *

The duration

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

The channels

+ *

The channels

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("channels") + public _FinalStage channels(double channels) { + this.channels = channels; + return this; + } + + @java.lang.Override + public ListenV1Metadata build() { + return new ListenV1Metadata( + transactionKey, requestId, sha256, created, duration, channels, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1Results.java b/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1Results.java new file mode 100644 index 0000000..c545d70 --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1Results.java @@ -0,0 +1,477 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = ListenV1Results.Builder.class) +public final class ListenV1Results { + private final List channelIndex; + + private final double duration; + + private final double start; + + private final Optional isFinal; + + private final Optional speechFinal; + + private final ListenV1ResultsChannel channel; + + private final ListenV1ResultsMetadata metadata; + + private final Optional fromFinalize; + + private final Optional> entities; + + private final Map additionalProperties; + + private ListenV1Results( + List channelIndex, + double duration, + double start, + Optional isFinal, + Optional speechFinal, + ListenV1ResultsChannel channel, + ListenV1ResultsMetadata metadata, + Optional fromFinalize, + Optional> entities, + Map additionalProperties) { + this.channelIndex = channelIndex; + this.duration = duration; + this.start = start; + this.isFinal = isFinal; + this.speechFinal = speechFinal; + this.channel = channel; + this.metadata = metadata; + this.fromFinalize = fromFinalize; + this.entities = entities; + this.additionalProperties = additionalProperties; + } + + /** + * @return Message type identifier + */ + @JsonProperty("type") + public String getType() { + return "Results"; + } + + /** + * @return The index of the channel + */ + @JsonProperty("channel_index") + public List getChannelIndex() { + return channelIndex; + } + + /** + * @return The duration of the transcription + */ + @JsonProperty("duration") + public double getDuration() { + return duration; + } + + /** + * @return The start time of the transcription + */ + @JsonProperty("start") + public double getStart() { + return start; + } + + /** + * @return Whether the transcription is final + */ + @JsonProperty("is_final") + public Optional getIsFinal() { + return isFinal; + } + + /** + * @return Whether the transcription is speech final + */ + @JsonProperty("speech_final") + public Optional getSpeechFinal() { + return speechFinal; + } + + @JsonProperty("channel") + public ListenV1ResultsChannel getChannel() { + return channel; + } + + @JsonProperty("metadata") + public ListenV1ResultsMetadata getMetadata() { + return metadata; + } + + /** + * @return Whether the transcription is from a finalize message + */ + @JsonProperty("from_finalize") + public Optional getFromFinalize() { + return fromFinalize; + } + + /** + * @return Extracted entities from the audio when detect_entities is enabled. Only present in is_final messages. Returns an empty array if no entities are detected + */ + @JsonProperty("entities") + public Optional> getEntities() { + return entities; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListenV1Results && equalTo((ListenV1Results) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListenV1Results other) { + return channelIndex.equals(other.channelIndex) + && duration == other.duration + && start == other.start + && isFinal.equals(other.isFinal) + && speechFinal.equals(other.speechFinal) + && channel.equals(other.channel) + && metadata.equals(other.metadata) + && fromFinalize.equals(other.fromFinalize) + && entities.equals(other.entities); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.channelIndex, + this.duration, + this.start, + this.isFinal, + this.speechFinal, + this.channel, + this.metadata, + this.fromFinalize, + this.entities); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DurationStage builder() { + return new Builder(); + } + + public interface DurationStage { + /** + *

The duration of the transcription

+ */ + StartStage duration(double duration); + + Builder from(ListenV1Results other); + } + + public interface StartStage { + /** + *

The start time of the transcription

+ */ + ChannelStage start(double start); + } + + public interface ChannelStage { + MetadataStage channel(@NotNull ListenV1ResultsChannel channel); + } + + public interface MetadataStage { + _FinalStage metadata(@NotNull ListenV1ResultsMetadata metadata); + } + + public interface _FinalStage { + ListenV1Results build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The index of the channel

+ */ + _FinalStage channelIndex(List channelIndex); + + _FinalStage addChannelIndex(Double channelIndex); + + _FinalStage addAllChannelIndex(List channelIndex); + + /** + *

Whether the transcription is final

+ */ + _FinalStage isFinal(Optional isFinal); + + _FinalStage isFinal(Boolean isFinal); + + /** + *

Whether the transcription is speech final

+ */ + _FinalStage speechFinal(Optional speechFinal); + + _FinalStage speechFinal(Boolean speechFinal); + + /** + *

Whether the transcription is from a finalize message

+ */ + _FinalStage fromFinalize(Optional fromFinalize); + + _FinalStage fromFinalize(Boolean fromFinalize); + + /** + *

Extracted entities from the audio when detect_entities is enabled. Only present in is_final messages. Returns an empty array if no entities are detected

+ */ + _FinalStage entities(Optional> entities); + + _FinalStage entities(List entities); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DurationStage, StartStage, ChannelStage, MetadataStage, _FinalStage { + private double duration; + + private double start; + + private ListenV1ResultsChannel channel; + + private ListenV1ResultsMetadata metadata; + + private Optional> entities = Optional.empty(); + + private Optional fromFinalize = Optional.empty(); + + private Optional speechFinal = Optional.empty(); + + private Optional isFinal = Optional.empty(); + + private List channelIndex = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListenV1Results other) { + channelIndex(other.getChannelIndex()); + duration(other.getDuration()); + start(other.getStart()); + isFinal(other.getIsFinal()); + speechFinal(other.getSpeechFinal()); + channel(other.getChannel()); + metadata(other.getMetadata()); + fromFinalize(other.getFromFinalize()); + entities(other.getEntities()); + return this; + } + + /** + *

The duration of the transcription

+ *

The duration of the transcription

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

The start time of the transcription

+ *

The start time of the transcription

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("start") + public ChannelStage start(double start) { + this.start = start; + return this; + } + + @java.lang.Override + @JsonSetter("channel") + public MetadataStage channel(@NotNull ListenV1ResultsChannel channel) { + this.channel = Objects.requireNonNull(channel, "channel must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("metadata") + public _FinalStage metadata(@NotNull ListenV1ResultsMetadata metadata) { + this.metadata = Objects.requireNonNull(metadata, "metadata must not be null"); + return this; + } + + /** + *

Extracted entities from the audio when detect_entities is enabled. Only present in is_final messages. Returns an empty array if no entities are detected

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

Extracted entities from the audio when detect_entities is enabled. Only present in is_final messages. Returns an empty array if no entities are detected

+ */ + @java.lang.Override + @JsonSetter(value = "entities", nulls = Nulls.SKIP) + public _FinalStage entities(Optional> entities) { + this.entities = entities; + return this; + } + + /** + *

Whether the transcription is from a finalize message

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fromFinalize(Boolean fromFinalize) { + this.fromFinalize = Optional.ofNullable(fromFinalize); + return this; + } + + /** + *

Whether the transcription is from a finalize message

+ */ + @java.lang.Override + @JsonSetter(value = "from_finalize", nulls = Nulls.SKIP) + public _FinalStage fromFinalize(Optional fromFinalize) { + this.fromFinalize = fromFinalize; + return this; + } + + /** + *

Whether the transcription is speech final

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage speechFinal(Boolean speechFinal) { + this.speechFinal = Optional.ofNullable(speechFinal); + return this; + } + + /** + *

Whether the transcription is speech final

+ */ + @java.lang.Override + @JsonSetter(value = "speech_final", nulls = Nulls.SKIP) + public _FinalStage speechFinal(Optional speechFinal) { + this.speechFinal = speechFinal; + return this; + } + + /** + *

Whether the transcription is final

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage isFinal(Boolean isFinal) { + this.isFinal = Optional.ofNullable(isFinal); + return this; + } + + /** + *

Whether the transcription is final

+ */ + @java.lang.Override + @JsonSetter(value = "is_final", nulls = Nulls.SKIP) + public _FinalStage isFinal(Optional isFinal) { + this.isFinal = isFinal; + return this; + } + + /** + *

The index of the channel

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllChannelIndex(List channelIndex) { + if (channelIndex != null) { + this.channelIndex.addAll(channelIndex); + } + return this; + } + + /** + *

The index of the channel

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addChannelIndex(Double channelIndex) { + this.channelIndex.add(channelIndex); + return this; + } + + /** + *

The index of the channel

+ */ + @java.lang.Override + @JsonSetter(value = "channel_index", nulls = Nulls.SKIP) + public _FinalStage channelIndex(List channelIndex) { + this.channelIndex.clear(); + if (channelIndex != null) { + this.channelIndex.addAll(channelIndex); + } + return this; + } + + @java.lang.Override + public ListenV1Results build() { + return new ListenV1Results( + channelIndex, + duration, + start, + isFinal, + speechFinal, + channel, + metadata, + fromFinalize, + entities, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1ResultsChannel.java b/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1ResultsChannel.java new file mode 100644 index 0000000..ffcec7d --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1ResultsChannel.java @@ -0,0 +1,117 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = ListenV1ResultsChannel.Builder.class) +public final class ListenV1ResultsChannel { + private final List alternatives; + + private final Map additionalProperties; + + private ListenV1ResultsChannel( + List alternatives, Map additionalProperties) { + this.alternatives = alternatives; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("alternatives") + public List getAlternatives() { + return alternatives; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListenV1ResultsChannel && equalTo((ListenV1ResultsChannel) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListenV1ResultsChannel other) { + return alternatives.equals(other.alternatives); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.alternatives); + } + + @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 alternatives = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListenV1ResultsChannel other) { + alternatives(other.getAlternatives()); + return this; + } + + @JsonSetter(value = "alternatives", nulls = Nulls.SKIP) + public Builder alternatives(List alternatives) { + this.alternatives.clear(); + if (alternatives != null) { + this.alternatives.addAll(alternatives); + } + return this; + } + + public Builder addAlternatives(ListenV1ResultsChannelAlternativesItem alternatives) { + this.alternatives.add(alternatives); + return this; + } + + public Builder addAllAlternatives(List alternatives) { + if (alternatives != null) { + this.alternatives.addAll(alternatives); + } + return this; + } + + public ListenV1ResultsChannel build() { + return new ListenV1ResultsChannel(alternatives, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1ResultsChannelAlternativesItem.java b/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1ResultsChannelAlternativesItem.java new file mode 100644 index 0000000..fd5ff33 --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1ResultsChannelAlternativesItem.java @@ -0,0 +1,245 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = ListenV1ResultsChannelAlternativesItem.Builder.class) +public final class ListenV1ResultsChannelAlternativesItem { + private final String transcript; + + private final double confidence; + + private final Optional> languages; + + private final List words; + + private final Map additionalProperties; + + private ListenV1ResultsChannelAlternativesItem( + String transcript, + double confidence, + Optional> languages, + List words, + Map additionalProperties) { + this.transcript = transcript; + this.confidence = confidence; + this.languages = languages; + this.words = words; + this.additionalProperties = additionalProperties; + } + + /** + * @return The transcript of the transcription + */ + @JsonProperty("transcript") + public String getTranscript() { + return transcript; + } + + /** + * @return The confidence of the transcription + */ + @JsonProperty("confidence") + public double getConfidence() { + return confidence; + } + + @JsonProperty("languages") + public Optional> getLanguages() { + return languages; + } + + @JsonProperty("words") + public List getWords() { + return words; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListenV1ResultsChannelAlternativesItem + && equalTo((ListenV1ResultsChannelAlternativesItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListenV1ResultsChannelAlternativesItem other) { + return transcript.equals(other.transcript) + && confidence == other.confidence + && languages.equals(other.languages) + && words.equals(other.words); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.transcript, this.confidence, this.languages, this.words); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TranscriptStage builder() { + return new Builder(); + } + + public interface TranscriptStage { + /** + *

The transcript of the transcription

+ */ + ConfidenceStage transcript(@NotNull String transcript); + + Builder from(ListenV1ResultsChannelAlternativesItem other); + } + + public interface ConfidenceStage { + /** + *

The confidence of the transcription

+ */ + _FinalStage confidence(double confidence); + } + + public interface _FinalStage { + ListenV1ResultsChannelAlternativesItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage languages(Optional> languages); + + _FinalStage languages(List languages); + + _FinalStage words(List words); + + _FinalStage addWords(ListenV1ResultsChannelAlternativesItemWordsItem words); + + _FinalStage addAllWords(List words); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TranscriptStage, ConfidenceStage, _FinalStage { + private String transcript; + + private double confidence; + + private List words = new ArrayList<>(); + + private Optional> languages = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListenV1ResultsChannelAlternativesItem other) { + transcript(other.getTranscript()); + confidence(other.getConfidence()); + languages(other.getLanguages()); + words(other.getWords()); + return this; + } + + /** + *

The transcript of the transcription

+ *

The transcript of the transcription

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

The confidence of the transcription

+ *

The confidence of the transcription

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("confidence") + public _FinalStage confidence(double confidence) { + this.confidence = confidence; + return this; + } + + @java.lang.Override + public _FinalStage addAllWords(List words) { + if (words != null) { + this.words.addAll(words); + } + return this; + } + + @java.lang.Override + public _FinalStage addWords(ListenV1ResultsChannelAlternativesItemWordsItem words) { + this.words.add(words); + return this; + } + + @java.lang.Override + @JsonSetter(value = "words", nulls = Nulls.SKIP) + public _FinalStage words(List words) { + this.words.clear(); + if (words != null) { + this.words.addAll(words); + } + return this; + } + + @java.lang.Override + public _FinalStage languages(List languages) { + this.languages = Optional.ofNullable(languages); + return this; + } + + @java.lang.Override + @JsonSetter(value = "languages", nulls = Nulls.SKIP) + public _FinalStage languages(Optional> languages) { + this.languages = languages; + return this; + } + + @java.lang.Override + public ListenV1ResultsChannelAlternativesItem build() { + return new ListenV1ResultsChannelAlternativesItem( + transcript, confidence, languages, words, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1ResultsChannelAlternativesItemWordsItem.java b/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1ResultsChannelAlternativesItemWordsItem.java new file mode 100644 index 0000000..e846397 --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1ResultsChannelAlternativesItemWordsItem.java @@ -0,0 +1,370 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = ListenV1ResultsChannelAlternativesItemWordsItem.Builder.class) +public final class ListenV1ResultsChannelAlternativesItemWordsItem { + private final String word; + + private final double start; + + private final double end; + + private final double confidence; + + private final Optional language; + + private final Optional punctuatedWord; + + private final Optional speaker; + + private final Map additionalProperties; + + private ListenV1ResultsChannelAlternativesItemWordsItem( + String word, + double start, + double end, + double confidence, + Optional language, + Optional punctuatedWord, + Optional speaker, + Map additionalProperties) { + this.word = word; + this.start = start; + this.end = end; + this.confidence = confidence; + this.language = language; + this.punctuatedWord = punctuatedWord; + this.speaker = speaker; + this.additionalProperties = additionalProperties; + } + + /** + * @return The word of the transcription + */ + @JsonProperty("word") + public String getWord() { + return word; + } + + /** + * @return The start time of the word + */ + @JsonProperty("start") + public double getStart() { + return start; + } + + /** + * @return The end time of the word + */ + @JsonProperty("end") + public double getEnd() { + return end; + } + + /** + * @return The confidence of the word + */ + @JsonProperty("confidence") + public double getConfidence() { + return confidence; + } + + /** + * @return The language of the word + */ + @JsonProperty("language") + public Optional getLanguage() { + return language; + } + + /** + * @return The punctuated word of the word + */ + @JsonProperty("punctuated_word") + public Optional getPunctuatedWord() { + return punctuatedWord; + } + + /** + * @return The speaker of the word + */ + @JsonProperty("speaker") + public Optional getSpeaker() { + return speaker; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListenV1ResultsChannelAlternativesItemWordsItem + && equalTo((ListenV1ResultsChannelAlternativesItemWordsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListenV1ResultsChannelAlternativesItemWordsItem other) { + return word.equals(other.word) + && start == other.start + && end == other.end + && confidence == other.confidence + && language.equals(other.language) + && punctuatedWord.equals(other.punctuatedWord) + && speaker.equals(other.speaker); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.word, this.start, this.end, this.confidence, this.language, this.punctuatedWord, this.speaker); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static WordStage builder() { + return new Builder(); + } + + public interface WordStage { + /** + *

The word of the transcription

+ */ + StartStage word(@NotNull String word); + + Builder from(ListenV1ResultsChannelAlternativesItemWordsItem other); + } + + public interface StartStage { + /** + *

The start time of the word

+ */ + EndStage start(double start); + } + + public interface EndStage { + /** + *

The end time of the word

+ */ + ConfidenceStage end(double end); + } + + public interface ConfidenceStage { + /** + *

The confidence of the word

+ */ + _FinalStage confidence(double confidence); + } + + public interface _FinalStage { + ListenV1ResultsChannelAlternativesItemWordsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The language of the word

+ */ + _FinalStage language(Optional language); + + _FinalStage language(String language); + + /** + *

The punctuated word of the word

+ */ + _FinalStage punctuatedWord(Optional punctuatedWord); + + _FinalStage punctuatedWord(String punctuatedWord); + + /** + *

The speaker of the word

+ */ + _FinalStage speaker(Optional speaker); + + _FinalStage speaker(Double speaker); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements WordStage, StartStage, EndStage, ConfidenceStage, _FinalStage { + private String word; + + private double start; + + private double end; + + private double confidence; + + private Optional speaker = Optional.empty(); + + private Optional punctuatedWord = Optional.empty(); + + private Optional language = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListenV1ResultsChannelAlternativesItemWordsItem other) { + word(other.getWord()); + start(other.getStart()); + end(other.getEnd()); + confidence(other.getConfidence()); + language(other.getLanguage()); + punctuatedWord(other.getPunctuatedWord()); + speaker(other.getSpeaker()); + return this; + } + + /** + *

The word of the transcription

+ *

The word of the transcription

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

The start time of the word

+ *

The start time of the word

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

The end time of the word

+ *

The end time of the word

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

The confidence of the word

+ *

The confidence of the word

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

The speaker of the word

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage speaker(Double speaker) { + this.speaker = Optional.ofNullable(speaker); + return this; + } + + /** + *

The speaker of the word

+ */ + @java.lang.Override + @JsonSetter(value = "speaker", nulls = Nulls.SKIP) + public _FinalStage speaker(Optional speaker) { + this.speaker = speaker; + return this; + } + + /** + *

The punctuated word of the word

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage punctuatedWord(String punctuatedWord) { + this.punctuatedWord = Optional.ofNullable(punctuatedWord); + return this; + } + + /** + *

The punctuated word of the word

+ */ + @java.lang.Override + @JsonSetter(value = "punctuated_word", nulls = Nulls.SKIP) + public _FinalStage punctuatedWord(Optional punctuatedWord) { + this.punctuatedWord = punctuatedWord; + return this; + } + + /** + *

The language of the word

+ * @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; + } + + /** + *

The language of the word

+ */ + @java.lang.Override + @JsonSetter(value = "language", nulls = Nulls.SKIP) + public _FinalStage language(Optional language) { + this.language = language; + return this; + } + + @java.lang.Override + public ListenV1ResultsChannelAlternativesItemWordsItem build() { + return new ListenV1ResultsChannelAlternativesItemWordsItem( + word, start, end, confidence, language, punctuatedWord, speaker, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1ResultsEntitiesItem.java b/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1ResultsEntitiesItem.java new file mode 100644 index 0000000..ff5c10e --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1ResultsEntitiesItem.java @@ -0,0 +1,314 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListenV1ResultsEntitiesItem.Builder.class) +public final class ListenV1ResultsEntitiesItem { + private final String label; + + private final String value; + + private final String rawValue; + + private final double confidence; + + private final int startWord; + + private final int endWord; + + private final Map additionalProperties; + + private ListenV1ResultsEntitiesItem( + String label, + String value, + String rawValue, + double confidence, + int startWord, + int endWord, + Map additionalProperties) { + this.label = label; + this.value = value; + this.rawValue = rawValue; + this.confidence = confidence; + this.startWord = startWord; + this.endWord = endWord; + this.additionalProperties = additionalProperties; + } + + /** + * @return The type/category of the entity (e.g., NAME, PHONE_NUMBER, EMAIL_ADDRESS, ORGANIZATION, CARDINAL) + */ + @JsonProperty("label") + public String getLabel() { + return label; + } + + /** + * @return The formatted text representation of the entity + */ + @JsonProperty("value") + public String getValue() { + return value; + } + + /** + * @return The original spoken text of the entity (present when formatting is enabled) + */ + @JsonProperty("raw_value") + public String getRawValue() { + return rawValue; + } + + /** + * @return The confidence score of the entity detection + */ + @JsonProperty("confidence") + public double getConfidence() { + return confidence; + } + + /** + * @return The index of the first word of the entity in the transcript (inclusive) + */ + @JsonProperty("start_word") + public int getStartWord() { + return startWord; + } + + /** + * @return The index of the last word of the entity in the transcript (exclusive) + */ + @JsonProperty("end_word") + public int getEndWord() { + return endWord; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListenV1ResultsEntitiesItem && equalTo((ListenV1ResultsEntitiesItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListenV1ResultsEntitiesItem other) { + return label.equals(other.label) + && value.equals(other.value) + && rawValue.equals(other.rawValue) + && confidence == other.confidence + && startWord == other.startWord + && endWord == other.endWord; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.label, this.value, this.rawValue, this.confidence, this.startWord, this.endWord); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static LabelStage builder() { + return new Builder(); + } + + public interface LabelStage { + /** + *

The type/category of the entity (e.g., NAME, PHONE_NUMBER, EMAIL_ADDRESS, ORGANIZATION, CARDINAL)

+ */ + ValueStage label(@NotNull String label); + + Builder from(ListenV1ResultsEntitiesItem other); + } + + public interface ValueStage { + /** + *

The formatted text representation of the entity

+ */ + RawValueStage value(@NotNull String value); + } + + public interface RawValueStage { + /** + *

The original spoken text of the entity (present when formatting is enabled)

+ */ + ConfidenceStage rawValue(@NotNull String rawValue); + } + + public interface ConfidenceStage { + /** + *

The confidence score of the entity detection

+ */ + StartWordStage confidence(double confidence); + } + + public interface StartWordStage { + /** + *

The index of the first word of the entity in the transcript (inclusive)

+ */ + EndWordStage startWord(int startWord); + } + + public interface EndWordStage { + /** + *

The index of the last word of the entity in the transcript (exclusive)

+ */ + _FinalStage endWord(int endWord); + } + + public interface _FinalStage { + ListenV1ResultsEntitiesItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements LabelStage, + ValueStage, + RawValueStage, + ConfidenceStage, + StartWordStage, + EndWordStage, + _FinalStage { + private String label; + + private String value; + + private String rawValue; + + private double confidence; + + private int startWord; + + private int endWord; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListenV1ResultsEntitiesItem other) { + label(other.getLabel()); + value(other.getValue()); + rawValue(other.getRawValue()); + confidence(other.getConfidence()); + startWord(other.getStartWord()); + endWord(other.getEndWord()); + return this; + } + + /** + *

The type/category of the entity (e.g., NAME, PHONE_NUMBER, EMAIL_ADDRESS, ORGANIZATION, CARDINAL)

+ *

The type/category of the entity (e.g., NAME, PHONE_NUMBER, EMAIL_ADDRESS, ORGANIZATION, CARDINAL)

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

The formatted text representation of the entity

+ *

The formatted text representation of the entity

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

The original spoken text of the entity (present when formatting is enabled)

+ *

The original spoken text of the entity (present when formatting is enabled)

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

The confidence score of the entity detection

+ *

The confidence score of the entity detection

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

The index of the first word of the entity in the transcript (inclusive)

+ *

The index of the first word of the entity in the transcript (inclusive)

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

The index of the last word of the entity in the transcript (exclusive)

+ *

The index of the last word of the entity in the transcript (exclusive)

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("end_word") + public _FinalStage endWord(int endWord) { + this.endWord = endWord; + return this; + } + + @java.lang.Override + public ListenV1ResultsEntitiesItem build() { + return new ListenV1ResultsEntitiesItem( + label, value, rawValue, confidence, startWord, endWord, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1ResultsMetadata.java b/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1ResultsMetadata.java new file mode 100644 index 0000000..df504c7 --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1ResultsMetadata.java @@ -0,0 +1,190 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListenV1ResultsMetadata.Builder.class) +public final class ListenV1ResultsMetadata { + private final String requestId; + + private final ListenV1ResultsMetadataModelInfo modelInfo; + + private final String modelUuid; + + private final Map additionalProperties; + + private ListenV1ResultsMetadata( + String requestId, + ListenV1ResultsMetadataModelInfo modelInfo, + String modelUuid, + Map additionalProperties) { + this.requestId = requestId; + this.modelInfo = modelInfo; + this.modelUuid = modelUuid; + this.additionalProperties = additionalProperties; + } + + /** + * @return The request ID + */ + @JsonProperty("request_id") + public String getRequestId() { + return requestId; + } + + @JsonProperty("model_info") + public ListenV1ResultsMetadataModelInfo getModelInfo() { + return modelInfo; + } + + /** + * @return The model UUID + */ + @JsonProperty("model_uuid") + public String getModelUuid() { + return modelUuid; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListenV1ResultsMetadata && equalTo((ListenV1ResultsMetadata) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListenV1ResultsMetadata other) { + return requestId.equals(other.requestId) + && modelInfo.equals(other.modelInfo) + && modelUuid.equals(other.modelUuid); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.requestId, this.modelInfo, this.modelUuid); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static RequestIdStage builder() { + return new Builder(); + } + + public interface RequestIdStage { + /** + *

The request ID

+ */ + ModelInfoStage requestId(@NotNull String requestId); + + Builder from(ListenV1ResultsMetadata other); + } + + public interface ModelInfoStage { + ModelUuidStage modelInfo(@NotNull ListenV1ResultsMetadataModelInfo modelInfo); + } + + public interface ModelUuidStage { + /** + *

The model UUID

+ */ + _FinalStage modelUuid(@NotNull String modelUuid); + } + + public interface _FinalStage { + ListenV1ResultsMetadata build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements RequestIdStage, ModelInfoStage, ModelUuidStage, _FinalStage { + private String requestId; + + private ListenV1ResultsMetadataModelInfo modelInfo; + + private String modelUuid; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListenV1ResultsMetadata other) { + requestId(other.getRequestId()); + modelInfo(other.getModelInfo()); + modelUuid(other.getModelUuid()); + return this; + } + + /** + *

The request ID

+ *

The request ID

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

The model UUID

+ *

The model UUID

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("model_uuid") + public _FinalStage modelUuid(@NotNull String modelUuid) { + this.modelUuid = Objects.requireNonNull(modelUuid, "modelUuid must not be null"); + return this; + } + + @java.lang.Override + public ListenV1ResultsMetadata build() { + return new ListenV1ResultsMetadata(requestId, modelInfo, modelUuid, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1ResultsMetadataModelInfo.java b/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1ResultsMetadataModelInfo.java new file mode 100644 index 0000000..732cd94 --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1ResultsMetadataModelInfo.java @@ -0,0 +1,196 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListenV1ResultsMetadataModelInfo.Builder.class) +public final class ListenV1ResultsMetadataModelInfo { + private final String name; + + private final String version; + + private final String arch; + + private final Map additionalProperties; + + private ListenV1ResultsMetadataModelInfo( + String name, String version, String arch, Map additionalProperties) { + this.name = name; + this.version = version; + this.arch = arch; + this.additionalProperties = additionalProperties; + } + + /** + * @return The name of the model + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return The version of the model + */ + @JsonProperty("version") + public String getVersion() { + return version; + } + + /** + * @return The arch of the model + */ + @JsonProperty("arch") + public String getArch() { + return arch; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListenV1ResultsMetadataModelInfo && equalTo((ListenV1ResultsMetadataModelInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListenV1ResultsMetadataModelInfo other) { + return name.equals(other.name) && version.equals(other.version) && arch.equals(other.arch); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.name, this.version, this.arch); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static NameStage builder() { + return new Builder(); + } + + public interface NameStage { + /** + *

The name of the model

+ */ + VersionStage name(@NotNull String name); + + Builder from(ListenV1ResultsMetadataModelInfo other); + } + + public interface VersionStage { + /** + *

The version of the model

+ */ + ArchStage version(@NotNull String version); + } + + public interface ArchStage { + /** + *

The arch of the model

+ */ + _FinalStage arch(@NotNull String arch); + } + + public interface _FinalStage { + ListenV1ResultsMetadataModelInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements NameStage, VersionStage, ArchStage, _FinalStage { + private String name; + + private String version; + + private String arch; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListenV1ResultsMetadataModelInfo other) { + name(other.getName()); + version(other.getVersion()); + arch(other.getArch()); + return this; + } + + /** + *

The name of the model

+ *

The name of the model

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

The version of the model

+ *

The version of the model

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

The arch of the model

+ *

The arch of the model

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("arch") + public _FinalStage arch(@NotNull String arch) { + this.arch = Objects.requireNonNull(arch, "arch must not be null"); + return this; + } + + @java.lang.Override + public ListenV1ResultsMetadataModelInfo build() { + return new ListenV1ResultsMetadataModelInfo(name, version, arch, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1SpeechStarted.java b/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1SpeechStarted.java new file mode 100644 index 0000000..e03b1fc --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1SpeechStarted.java @@ -0,0 +1,197 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = ListenV1SpeechStarted.Builder.class) +public final class ListenV1SpeechStarted { + private final List channel; + + private final double timestamp; + + private final Map additionalProperties; + + private ListenV1SpeechStarted(List channel, double timestamp, Map additionalProperties) { + this.channel = channel; + this.timestamp = timestamp; + this.additionalProperties = additionalProperties; + } + + /** + * @return Message type identifier + */ + @JsonProperty("type") + public String getType() { + return "SpeechStarted"; + } + + /** + * @return The channel + */ + @JsonProperty("channel") + public List getChannel() { + return channel; + } + + /** + * @return The timestamp + */ + @JsonProperty("timestamp") + public double getTimestamp() { + return timestamp; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListenV1SpeechStarted && equalTo((ListenV1SpeechStarted) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListenV1SpeechStarted other) { + return channel.equals(other.channel) && timestamp == other.timestamp; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.channel, this.timestamp); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TimestampStage builder() { + return new Builder(); + } + + public interface TimestampStage { + /** + *

The timestamp

+ */ + _FinalStage timestamp(double timestamp); + + Builder from(ListenV1SpeechStarted other); + } + + public interface _FinalStage { + ListenV1SpeechStarted build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The channel

+ */ + _FinalStage channel(List channel); + + _FinalStage addChannel(Double channel); + + _FinalStage addAllChannel(List channel); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TimestampStage, _FinalStage { + private double timestamp; + + private List channel = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListenV1SpeechStarted other) { + channel(other.getChannel()); + timestamp(other.getTimestamp()); + return this; + } + + /** + *

The timestamp

+ *

The timestamp

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

The channel

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllChannel(List channel) { + if (channel != null) { + this.channel.addAll(channel); + } + return this; + } + + /** + *

The channel

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addChannel(Double channel) { + this.channel.add(channel); + return this; + } + + /** + *

The channel

+ */ + @java.lang.Override + @JsonSetter(value = "channel", nulls = Nulls.SKIP) + public _FinalStage channel(List channel) { + this.channel.clear(); + if (channel != null) { + this.channel.addAll(channel); + } + return this; + } + + @java.lang.Override + public ListenV1SpeechStarted build() { + return new ListenV1SpeechStarted(channel, timestamp, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1UtteranceEnd.java b/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1UtteranceEnd.java new file mode 100644 index 0000000..22d0364 --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/v1/types/ListenV1UtteranceEnd.java @@ -0,0 +1,197 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = ListenV1UtteranceEnd.Builder.class) +public final class ListenV1UtteranceEnd { + private final List channel; + + private final double lastWordEnd; + + private final Map additionalProperties; + + private ListenV1UtteranceEnd(List channel, double lastWordEnd, Map additionalProperties) { + this.channel = channel; + this.lastWordEnd = lastWordEnd; + this.additionalProperties = additionalProperties; + } + + /** + * @return Message type identifier + */ + @JsonProperty("type") + public String getType() { + return "UtteranceEnd"; + } + + /** + * @return The channel + */ + @JsonProperty("channel") + public List getChannel() { + return channel; + } + + /** + * @return The last word end + */ + @JsonProperty("last_word_end") + public double getLastWordEnd() { + return lastWordEnd; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListenV1UtteranceEnd && equalTo((ListenV1UtteranceEnd) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListenV1UtteranceEnd other) { + return channel.equals(other.channel) && lastWordEnd == other.lastWordEnd; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.channel, this.lastWordEnd); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static LastWordEndStage builder() { + return new Builder(); + } + + public interface LastWordEndStage { + /** + *

The last word end

+ */ + _FinalStage lastWordEnd(double lastWordEnd); + + Builder from(ListenV1UtteranceEnd other); + } + + public interface _FinalStage { + ListenV1UtteranceEnd build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The channel

+ */ + _FinalStage channel(List channel); + + _FinalStage addChannel(Double channel); + + _FinalStage addAllChannel(List channel); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements LastWordEndStage, _FinalStage { + private double lastWordEnd; + + private List channel = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListenV1UtteranceEnd other) { + channel(other.getChannel()); + lastWordEnd(other.getLastWordEnd()); + return this; + } + + /** + *

The last word end

+ *

The last word end

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

The channel

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllChannel(List channel) { + if (channel != null) { + this.channel.addAll(channel); + } + return this; + } + + /** + *

The channel

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addChannel(Double channel) { + this.channel.add(channel); + return this; + } + + /** + *

The channel

+ */ + @java.lang.Override + @JsonSetter(value = "channel", nulls = Nulls.SKIP) + public _FinalStage channel(List channel) { + this.channel.clear(); + if (channel != null) { + this.channel.addAll(channel); + } + return this; + } + + @java.lang.Override + public ListenV1UtteranceEnd build() { + return new ListenV1UtteranceEnd(channel, lastWordEnd, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/listen/v1/websocket/V1ConnectOptions.java b/src/main/java/com/deepgram/resources/listen/v1/websocket/V1ConnectOptions.java new file mode 100644 index 0000000..21d28d9 --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/v1/websocket/V1ConnectOptions.java @@ -0,0 +1,1028 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen.v1.websocket; + +import com.deepgram.core.ObjectMappers; +import com.deepgram.types.ListenV1Callback; +import com.deepgram.types.ListenV1CallbackMethod; +import com.deepgram.types.ListenV1Channels; +import com.deepgram.types.ListenV1DetectEntities; +import com.deepgram.types.ListenV1Diarize; +import com.deepgram.types.ListenV1Dictation; +import com.deepgram.types.ListenV1Encoding; +import com.deepgram.types.ListenV1Endpointing; +import com.deepgram.types.ListenV1Extra; +import com.deepgram.types.ListenV1InterimResults; +import com.deepgram.types.ListenV1Keyterm; +import com.deepgram.types.ListenV1Keywords; +import com.deepgram.types.ListenV1Language; +import com.deepgram.types.ListenV1MipOptOut; +import com.deepgram.types.ListenV1Model; +import com.deepgram.types.ListenV1Multichannel; +import com.deepgram.types.ListenV1Numerals; +import com.deepgram.types.ListenV1ProfanityFilter; +import com.deepgram.types.ListenV1Punctuate; +import com.deepgram.types.ListenV1Redact; +import com.deepgram.types.ListenV1Replace; +import com.deepgram.types.ListenV1SampleRate; +import com.deepgram.types.ListenV1Search; +import com.deepgram.types.ListenV1SmartFormat; +import com.deepgram.types.ListenV1Tag; +import com.deepgram.types.ListenV1UtteranceEndMs; +import com.deepgram.types.ListenV1VadEvents; +import com.deepgram.types.ListenV1Version; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = V1ConnectOptions.Builder.class) +public final class V1ConnectOptions { + private final Optional callback; + + private final Optional callbackMethod; + + private final Optional channels; + + private final Optional detectEntities; + + private final Optional diarize; + + private final Optional dictation; + + private final Optional encoding; + + private final Optional endpointing; + + private final Optional extra; + + private final Optional interimResults; + + private final Optional keyterm; + + private final Optional keywords; + + private final Optional language; + + private final Optional mipOptOut; + + private final ListenV1Model model; + + private final Optional multichannel; + + private final Optional numerals; + + private final Optional profanityFilter; + + private final Optional punctuate; + + private final Optional redact; + + private final Optional replace; + + private final Optional sampleRate; + + private final Optional search; + + private final Optional smartFormat; + + private final Optional tag; + + private final Optional utteranceEndMs; + + private final Optional vadEvents; + + private final Optional version; + + private final Map additionalProperties; + + private V1ConnectOptions( + Optional callback, + Optional callbackMethod, + Optional channels, + Optional detectEntities, + Optional diarize, + Optional dictation, + Optional encoding, + Optional endpointing, + Optional extra, + Optional interimResults, + Optional keyterm, + Optional keywords, + Optional language, + Optional mipOptOut, + ListenV1Model model, + Optional multichannel, + Optional numerals, + Optional profanityFilter, + Optional punctuate, + Optional redact, + Optional replace, + Optional sampleRate, + Optional search, + Optional smartFormat, + Optional tag, + Optional utteranceEndMs, + Optional vadEvents, + Optional version, + Map additionalProperties) { + this.callback = callback; + this.callbackMethod = callbackMethod; + this.channels = channels; + this.detectEntities = detectEntities; + this.diarize = diarize; + this.dictation = dictation; + this.encoding = encoding; + this.endpointing = endpointing; + this.extra = extra; + this.interimResults = interimResults; + this.keyterm = keyterm; + this.keywords = keywords; + this.language = language; + this.mipOptOut = mipOptOut; + this.model = model; + this.multichannel = multichannel; + this.numerals = numerals; + this.profanityFilter = profanityFilter; + this.punctuate = punctuate; + this.redact = redact; + this.replace = replace; + this.sampleRate = sampleRate; + this.search = search; + this.smartFormat = smartFormat; + this.tag = tag; + this.utteranceEndMs = utteranceEndMs; + this.vadEvents = vadEvents; + this.version = version; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("callback") + public Optional getCallback() { + return callback; + } + + @JsonProperty("callback_method") + public Optional getCallbackMethod() { + return callbackMethod; + } + + @JsonProperty("channels") + public Optional getChannels() { + return channels; + } + + @JsonProperty("detect_entities") + public Optional getDetectEntities() { + return detectEntities; + } + + @JsonProperty("diarize") + public Optional getDiarize() { + return diarize; + } + + @JsonProperty("dictation") + public Optional getDictation() { + return dictation; + } + + @JsonProperty("encoding") + public Optional getEncoding() { + return encoding; + } + + @JsonProperty("endpointing") + public Optional getEndpointing() { + return endpointing; + } + + @JsonProperty("extra") + public Optional getExtra() { + return extra; + } + + @JsonProperty("interim_results") + public Optional getInterimResults() { + return interimResults; + } + + @JsonProperty("keyterm") + public Optional getKeyterm() { + return keyterm; + } + + @JsonProperty("keywords") + public Optional getKeywords() { + return keywords; + } + + @JsonProperty("language") + public Optional getLanguage() { + return language; + } + + @JsonProperty("mip_opt_out") + public Optional getMipOptOut() { + return mipOptOut; + } + + /** + * @return AI model to use for the transcription + */ + @JsonProperty("model") + public ListenV1Model getModel() { + return model; + } + + @JsonProperty("multichannel") + public Optional getMultichannel() { + return multichannel; + } + + @JsonProperty("numerals") + public Optional getNumerals() { + return numerals; + } + + @JsonProperty("profanity_filter") + public Optional getProfanityFilter() { + return profanityFilter; + } + + @JsonProperty("punctuate") + public Optional getPunctuate() { + return punctuate; + } + + @JsonProperty("redact") + public Optional getRedact() { + return redact; + } + + @JsonProperty("replace") + public Optional getReplace() { + return replace; + } + + @JsonProperty("sample_rate") + public Optional getSampleRate() { + return sampleRate; + } + + @JsonProperty("search") + public Optional getSearch() { + return search; + } + + @JsonProperty("smart_format") + public Optional getSmartFormat() { + return smartFormat; + } + + @JsonProperty("tag") + public Optional getTag() { + return tag; + } + + @JsonProperty("utterance_end_ms") + public Optional getUtteranceEndMs() { + return utteranceEndMs; + } + + @JsonProperty("vad_events") + public Optional getVadEvents() { + return vadEvents; + } + + @JsonProperty("version") + public Optional getVersion() { + return version; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1ConnectOptions && equalTo((V1ConnectOptions) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1ConnectOptions other) { + return callback.equals(other.callback) + && callbackMethod.equals(other.callbackMethod) + && channels.equals(other.channels) + && detectEntities.equals(other.detectEntities) + && diarize.equals(other.diarize) + && dictation.equals(other.dictation) + && encoding.equals(other.encoding) + && endpointing.equals(other.endpointing) + && extra.equals(other.extra) + && interimResults.equals(other.interimResults) + && keyterm.equals(other.keyterm) + && keywords.equals(other.keywords) + && language.equals(other.language) + && mipOptOut.equals(other.mipOptOut) + && model.equals(other.model) + && multichannel.equals(other.multichannel) + && numerals.equals(other.numerals) + && profanityFilter.equals(other.profanityFilter) + && punctuate.equals(other.punctuate) + && redact.equals(other.redact) + && replace.equals(other.replace) + && sampleRate.equals(other.sampleRate) + && search.equals(other.search) + && smartFormat.equals(other.smartFormat) + && tag.equals(other.tag) + && utteranceEndMs.equals(other.utteranceEndMs) + && vadEvents.equals(other.vadEvents) + && version.equals(other.version); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.callback, + this.callbackMethod, + this.channels, + this.detectEntities, + this.diarize, + this.dictation, + this.encoding, + this.endpointing, + this.extra, + this.interimResults, + this.keyterm, + this.keywords, + this.language, + this.mipOptOut, + this.model, + this.multichannel, + this.numerals, + this.profanityFilter, + this.punctuate, + this.redact, + this.replace, + this.sampleRate, + this.search, + this.smartFormat, + this.tag, + this.utteranceEndMs, + this.vadEvents, + this.version); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ModelStage builder() { + return new Builder(); + } + + public interface ModelStage { + /** + *

AI model to use for the transcription

+ */ + _FinalStage model(@NotNull ListenV1Model model); + + Builder from(V1ConnectOptions other); + } + + public interface _FinalStage { + V1ConnectOptions build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage callback(Optional callback); + + _FinalStage callback(ListenV1Callback callback); + + _FinalStage callbackMethod(Optional callbackMethod); + + _FinalStage callbackMethod(ListenV1CallbackMethod callbackMethod); + + _FinalStage channels(Optional channels); + + _FinalStage channels(ListenV1Channels channels); + + _FinalStage detectEntities(Optional detectEntities); + + _FinalStage detectEntities(ListenV1DetectEntities detectEntities); + + _FinalStage diarize(Optional diarize); + + _FinalStage diarize(ListenV1Diarize diarize); + + _FinalStage dictation(Optional dictation); + + _FinalStage dictation(ListenV1Dictation dictation); + + _FinalStage encoding(Optional encoding); + + _FinalStage encoding(ListenV1Encoding encoding); + + _FinalStage endpointing(Optional endpointing); + + _FinalStage endpointing(ListenV1Endpointing endpointing); + + _FinalStage extra(Optional extra); + + _FinalStage extra(ListenV1Extra extra); + + _FinalStage interimResults(Optional interimResults); + + _FinalStage interimResults(ListenV1InterimResults interimResults); + + _FinalStage keyterm(Optional keyterm); + + _FinalStage keyterm(ListenV1Keyterm keyterm); + + _FinalStage keywords(Optional keywords); + + _FinalStage keywords(ListenV1Keywords keywords); + + _FinalStage language(Optional language); + + _FinalStage language(ListenV1Language language); + + _FinalStage mipOptOut(Optional mipOptOut); + + _FinalStage mipOptOut(ListenV1MipOptOut mipOptOut); + + _FinalStage multichannel(Optional multichannel); + + _FinalStage multichannel(ListenV1Multichannel multichannel); + + _FinalStage numerals(Optional numerals); + + _FinalStage numerals(ListenV1Numerals numerals); + + _FinalStage profanityFilter(Optional profanityFilter); + + _FinalStage profanityFilter(ListenV1ProfanityFilter profanityFilter); + + _FinalStage punctuate(Optional punctuate); + + _FinalStage punctuate(ListenV1Punctuate punctuate); + + _FinalStage redact(Optional redact); + + _FinalStage redact(ListenV1Redact redact); + + _FinalStage replace(Optional replace); + + _FinalStage replace(ListenV1Replace replace); + + _FinalStage sampleRate(Optional sampleRate); + + _FinalStage sampleRate(ListenV1SampleRate sampleRate); + + _FinalStage search(Optional search); + + _FinalStage search(ListenV1Search search); + + _FinalStage smartFormat(Optional smartFormat); + + _FinalStage smartFormat(ListenV1SmartFormat smartFormat); + + _FinalStage tag(Optional tag); + + _FinalStage tag(ListenV1Tag tag); + + _FinalStage utteranceEndMs(Optional utteranceEndMs); + + _FinalStage utteranceEndMs(ListenV1UtteranceEndMs utteranceEndMs); + + _FinalStage vadEvents(Optional vadEvents); + + _FinalStage vadEvents(ListenV1VadEvents vadEvents); + + _FinalStage version(Optional version); + + _FinalStage version(ListenV1Version version); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ModelStage, _FinalStage { + private ListenV1Model model; + + private Optional version = Optional.empty(); + + private Optional vadEvents = Optional.empty(); + + private Optional utteranceEndMs = Optional.empty(); + + private Optional tag = Optional.empty(); + + private Optional smartFormat = Optional.empty(); + + private Optional search = Optional.empty(); + + private Optional sampleRate = Optional.empty(); + + private Optional replace = Optional.empty(); + + private Optional redact = Optional.empty(); + + private Optional punctuate = Optional.empty(); + + private Optional profanityFilter = Optional.empty(); + + private Optional numerals = Optional.empty(); + + private Optional multichannel = Optional.empty(); + + private Optional mipOptOut = Optional.empty(); + + private Optional language = Optional.empty(); + + private Optional keywords = Optional.empty(); + + private Optional keyterm = Optional.empty(); + + private Optional interimResults = Optional.empty(); + + private Optional extra = Optional.empty(); + + private Optional endpointing = Optional.empty(); + + private Optional encoding = Optional.empty(); + + private Optional dictation = Optional.empty(); + + private Optional diarize = Optional.empty(); + + private Optional detectEntities = Optional.empty(); + + private Optional channels = Optional.empty(); + + private Optional callbackMethod = Optional.empty(); + + private Optional callback = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(V1ConnectOptions other) { + callback(other.getCallback()); + callbackMethod(other.getCallbackMethod()); + channels(other.getChannels()); + detectEntities(other.getDetectEntities()); + diarize(other.getDiarize()); + dictation(other.getDictation()); + encoding(other.getEncoding()); + endpointing(other.getEndpointing()); + extra(other.getExtra()); + interimResults(other.getInterimResults()); + keyterm(other.getKeyterm()); + keywords(other.getKeywords()); + language(other.getLanguage()); + mipOptOut(other.getMipOptOut()); + model(other.getModel()); + multichannel(other.getMultichannel()); + numerals(other.getNumerals()); + profanityFilter(other.getProfanityFilter()); + punctuate(other.getPunctuate()); + redact(other.getRedact()); + replace(other.getReplace()); + sampleRate(other.getSampleRate()); + search(other.getSearch()); + smartFormat(other.getSmartFormat()); + tag(other.getTag()); + utteranceEndMs(other.getUtteranceEndMs()); + vadEvents(other.getVadEvents()); + version(other.getVersion()); + return this; + } + + /** + *

AI model to use for the transcription

+ *

AI model to use for the transcription

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("model") + public _FinalStage model(@NotNull ListenV1Model model) { + this.model = Objects.requireNonNull(model, "model must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage version(ListenV1Version version) { + this.version = Optional.ofNullable(version); + return this; + } + + @java.lang.Override + @JsonSetter(value = "version", nulls = Nulls.SKIP) + public _FinalStage version(Optional version) { + this.version = version; + return this; + } + + @java.lang.Override + public _FinalStage vadEvents(ListenV1VadEvents vadEvents) { + this.vadEvents = Optional.ofNullable(vadEvents); + return this; + } + + @java.lang.Override + @JsonSetter(value = "vad_events", nulls = Nulls.SKIP) + public _FinalStage vadEvents(Optional vadEvents) { + this.vadEvents = vadEvents; + return this; + } + + @java.lang.Override + public _FinalStage utteranceEndMs(ListenV1UtteranceEndMs utteranceEndMs) { + this.utteranceEndMs = Optional.ofNullable(utteranceEndMs); + return this; + } + + @java.lang.Override + @JsonSetter(value = "utterance_end_ms", nulls = Nulls.SKIP) + public _FinalStage utteranceEndMs(Optional utteranceEndMs) { + this.utteranceEndMs = utteranceEndMs; + return this; + } + + @java.lang.Override + public _FinalStage tag(ListenV1Tag 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 _FinalStage smartFormat(ListenV1SmartFormat smartFormat) { + this.smartFormat = Optional.ofNullable(smartFormat); + return this; + } + + @java.lang.Override + @JsonSetter(value = "smart_format", nulls = Nulls.SKIP) + public _FinalStage smartFormat(Optional smartFormat) { + this.smartFormat = smartFormat; + return this; + } + + @java.lang.Override + public _FinalStage search(ListenV1Search search) { + this.search = Optional.ofNullable(search); + return this; + } + + @java.lang.Override + @JsonSetter(value = "search", nulls = Nulls.SKIP) + public _FinalStage search(Optional search) { + this.search = search; + return this; + } + + @java.lang.Override + public _FinalStage sampleRate(ListenV1SampleRate sampleRate) { + this.sampleRate = Optional.ofNullable(sampleRate); + return this; + } + + @java.lang.Override + @JsonSetter(value = "sample_rate", nulls = Nulls.SKIP) + public _FinalStage sampleRate(Optional sampleRate) { + this.sampleRate = sampleRate; + return this; + } + + @java.lang.Override + public _FinalStage replace(ListenV1Replace replace) { + this.replace = Optional.ofNullable(replace); + return this; + } + + @java.lang.Override + @JsonSetter(value = "replace", nulls = Nulls.SKIP) + public _FinalStage replace(Optional replace) { + this.replace = replace; + return this; + } + + @java.lang.Override + public _FinalStage redact(ListenV1Redact redact) { + this.redact = Optional.ofNullable(redact); + return this; + } + + @java.lang.Override + @JsonSetter(value = "redact", nulls = Nulls.SKIP) + public _FinalStage redact(Optional redact) { + this.redact = redact; + return this; + } + + @java.lang.Override + public _FinalStage punctuate(ListenV1Punctuate punctuate) { + this.punctuate = Optional.ofNullable(punctuate); + return this; + } + + @java.lang.Override + @JsonSetter(value = "punctuate", nulls = Nulls.SKIP) + public _FinalStage punctuate(Optional punctuate) { + this.punctuate = punctuate; + return this; + } + + @java.lang.Override + public _FinalStage profanityFilter(ListenV1ProfanityFilter profanityFilter) { + this.profanityFilter = Optional.ofNullable(profanityFilter); + return this; + } + + @java.lang.Override + @JsonSetter(value = "profanity_filter", nulls = Nulls.SKIP) + public _FinalStage profanityFilter(Optional profanityFilter) { + this.profanityFilter = profanityFilter; + return this; + } + + @java.lang.Override + public _FinalStage numerals(ListenV1Numerals numerals) { + this.numerals = Optional.ofNullable(numerals); + return this; + } + + @java.lang.Override + @JsonSetter(value = "numerals", nulls = Nulls.SKIP) + public _FinalStage numerals(Optional numerals) { + this.numerals = numerals; + return this; + } + + @java.lang.Override + public _FinalStage multichannel(ListenV1Multichannel multichannel) { + this.multichannel = Optional.ofNullable(multichannel); + return this; + } + + @java.lang.Override + @JsonSetter(value = "multichannel", nulls = Nulls.SKIP) + public _FinalStage multichannel(Optional multichannel) { + this.multichannel = multichannel; + return this; + } + + @java.lang.Override + public _FinalStage mipOptOut(ListenV1MipOptOut mipOptOut) { + this.mipOptOut = Optional.ofNullable(mipOptOut); + return this; + } + + @java.lang.Override + @JsonSetter(value = "mip_opt_out", nulls = Nulls.SKIP) + public _FinalStage mipOptOut(Optional mipOptOut) { + this.mipOptOut = mipOptOut; + return this; + } + + @java.lang.Override + public _FinalStage language(ListenV1Language 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; + } + + @java.lang.Override + public _FinalStage keywords(ListenV1Keywords keywords) { + this.keywords = Optional.ofNullable(keywords); + return this; + } + + @java.lang.Override + @JsonSetter(value = "keywords", nulls = Nulls.SKIP) + public _FinalStage keywords(Optional keywords) { + this.keywords = keywords; + return this; + } + + @java.lang.Override + public _FinalStage keyterm(ListenV1Keyterm keyterm) { + this.keyterm = Optional.ofNullable(keyterm); + return this; + } + + @java.lang.Override + @JsonSetter(value = "keyterm", nulls = Nulls.SKIP) + public _FinalStage keyterm(Optional keyterm) { + this.keyterm = keyterm; + return this; + } + + @java.lang.Override + public _FinalStage interimResults(ListenV1InterimResults interimResults) { + this.interimResults = Optional.ofNullable(interimResults); + return this; + } + + @java.lang.Override + @JsonSetter(value = "interim_results", nulls = Nulls.SKIP) + public _FinalStage interimResults(Optional interimResults) { + this.interimResults = interimResults; + return this; + } + + @java.lang.Override + public _FinalStage extra(ListenV1Extra extra) { + this.extra = Optional.ofNullable(extra); + return this; + } + + @java.lang.Override + @JsonSetter(value = "extra", nulls = Nulls.SKIP) + public _FinalStage extra(Optional extra) { + this.extra = extra; + return this; + } + + @java.lang.Override + public _FinalStage endpointing(ListenV1Endpointing endpointing) { + this.endpointing = Optional.ofNullable(endpointing); + return this; + } + + @java.lang.Override + @JsonSetter(value = "endpointing", nulls = Nulls.SKIP) + public _FinalStage endpointing(Optional endpointing) { + this.endpointing = endpointing; + return this; + } + + @java.lang.Override + public _FinalStage encoding(ListenV1Encoding encoding) { + this.encoding = Optional.ofNullable(encoding); + return this; + } + + @java.lang.Override + @JsonSetter(value = "encoding", nulls = Nulls.SKIP) + public _FinalStage encoding(Optional encoding) { + this.encoding = encoding; + return this; + } + + @java.lang.Override + public _FinalStage dictation(ListenV1Dictation dictation) { + this.dictation = Optional.ofNullable(dictation); + return this; + } + + @java.lang.Override + @JsonSetter(value = "dictation", nulls = Nulls.SKIP) + public _FinalStage dictation(Optional dictation) { + this.dictation = dictation; + return this; + } + + @java.lang.Override + public _FinalStage diarize(ListenV1Diarize diarize) { + this.diarize = Optional.ofNullable(diarize); + return this; + } + + @java.lang.Override + @JsonSetter(value = "diarize", nulls = Nulls.SKIP) + public _FinalStage diarize(Optional diarize) { + this.diarize = diarize; + return this; + } + + @java.lang.Override + public _FinalStage detectEntities(ListenV1DetectEntities detectEntities) { + this.detectEntities = Optional.ofNullable(detectEntities); + return this; + } + + @java.lang.Override + @JsonSetter(value = "detect_entities", nulls = Nulls.SKIP) + public _FinalStage detectEntities(Optional detectEntities) { + this.detectEntities = detectEntities; + return this; + } + + @java.lang.Override + public _FinalStage channels(ListenV1Channels channels) { + this.channels = Optional.ofNullable(channels); + return this; + } + + @java.lang.Override + @JsonSetter(value = "channels", nulls = Nulls.SKIP) + public _FinalStage channels(Optional channels) { + this.channels = channels; + return this; + } + + @java.lang.Override + public _FinalStage callbackMethod(ListenV1CallbackMethod callbackMethod) { + this.callbackMethod = Optional.ofNullable(callbackMethod); + return this; + } + + @java.lang.Override + @JsonSetter(value = "callback_method", nulls = Nulls.SKIP) + public _FinalStage callbackMethod(Optional callbackMethod) { + this.callbackMethod = callbackMethod; + return this; + } + + @java.lang.Override + public _FinalStage callback(ListenV1Callback callback) { + this.callback = Optional.ofNullable(callback); + return this; + } + + @java.lang.Override + @JsonSetter(value = "callback", nulls = Nulls.SKIP) + public _FinalStage callback(Optional callback) { + this.callback = callback; + return this; + } + + @java.lang.Override + public V1ConnectOptions build() { + return new V1ConnectOptions( + callback, + callbackMethod, + channels, + detectEntities, + diarize, + dictation, + encoding, + endpointing, + extra, + interimResults, + keyterm, + keywords, + language, + mipOptOut, + model, + multichannel, + numerals, + profanityFilter, + punctuate, + redact, + replace, + sampleRate, + search, + smartFormat, + tag, + utteranceEndMs, + vadEvents, + version, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/listen/v1/websocket/V1WebSocketClient.java b/src/main/java/com/deepgram/resources/listen/v1/websocket/V1WebSocketClient.java new file mode 100644 index 0000000..f0d6a74 --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/v1/websocket/V1WebSocketClient.java @@ -0,0 +1,506 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen.v1.websocket; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.DisconnectReason; +import com.deepgram.core.ObjectMappers; +import com.deepgram.core.ReconnectingWebSocketListener; +import com.deepgram.core.WebSocketReadyState; +import com.deepgram.resources.listen.v1.types.ListenV1CloseStream; +import com.deepgram.resources.listen.v1.types.ListenV1Finalize; +import com.deepgram.resources.listen.v1.types.ListenV1KeepAlive; +import com.deepgram.resources.listen.v1.types.ListenV1Metadata; +import com.deepgram.resources.listen.v1.types.ListenV1Results; +import com.deepgram.resources.listen.v1.types.ListenV1SpeechStarted; +import com.deepgram.resources.listen.v1.types.ListenV1UtteranceEnd; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ScheduledExecutorService; +import java.util.function.Consumer; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.WebSocket; +import okio.ByteString; + +/** + * WebSocket client for the v1 channel. + * Provides real-time bidirectional communication with strongly-typed messages. + */ +public class V1WebSocketClient implements AutoCloseable { + protected final ClientOptions clientOptions; + + private final ObjectMapper objectMapper; + + private final OkHttpClient okHttpClient; + + private ScheduledExecutorService timeoutExecutor; + + private volatile WebSocketReadyState readyState = WebSocketReadyState.CLOSED; + + private volatile Runnable onConnectedHandler; + + private volatile Consumer onDisconnectedHandler; + + private volatile Consumer onErrorHandler; + + private volatile Consumer onMessageHandler; + + private volatile ReconnectingWebSocketListener.ReconnectOptions reconnectOptions; + + private CompletableFuture connectionFuture; + + private ReconnectingWebSocketListener reconnectingListener; + + private volatile Consumer resultsHandler; + + private volatile Consumer metadataHandler; + + private volatile Consumer utteranceEndHandler; + + private volatile Consumer speechStartedHandler; + + /** + * Creates a new async WebSocket client for the v1 channel. + */ + public V1WebSocketClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.objectMapper = ObjectMappers.JSON_MAPPER; + this.okHttpClient = clientOptions.httpClient(); + } + + /** + * Establishes the WebSocket connection asynchronously with automatic reconnection. + * @return a CompletableFuture that completes when the connection is established + * @param options connection options including query parameters + */ + public CompletableFuture connect(V1ConnectOptions options) { + connectionFuture = new CompletableFuture<>(); + String baseUrl = clientOptions.environment().getProductionURL(); + String fullPath = "/v1/listen"; + if (baseUrl.endsWith("/") && fullPath.startsWith("/")) { + fullPath = fullPath.substring(1); + } else if (!baseUrl.endsWith("/") && !fullPath.startsWith("/")) { + fullPath = "/" + fullPath; + } + // OkHttp's HttpUrl only supports http/https schemes; convert wss/ws for URL parsing + if (baseUrl.startsWith("wss://")) { + baseUrl = "https://" + baseUrl.substring(6); + } else if (baseUrl.startsWith("ws://")) { + baseUrl = "http://" + baseUrl.substring(5); + } + HttpUrl parsedUrl = HttpUrl.parse(baseUrl + fullPath); + if (parsedUrl == null) { + throw new IllegalArgumentException("Invalid WebSocket URL: " + baseUrl + fullPath); + } + HttpUrl.Builder urlBuilder = parsedUrl.newBuilder(); + if (options.getCallback() != null && options.getCallback().isPresent()) { + urlBuilder.addQueryParameter( + "callback", String.valueOf(options.getCallback().get())); + } + if (options.getCallbackMethod() != null && options.getCallbackMethod().isPresent()) { + urlBuilder.addQueryParameter( + "callback_method", + String.valueOf(options.getCallbackMethod().get())); + } + if (options.getChannels() != null && options.getChannels().isPresent()) { + urlBuilder.addQueryParameter( + "channels", String.valueOf(options.getChannels().get())); + } + if (options.getDetectEntities() != null && options.getDetectEntities().isPresent()) { + urlBuilder.addQueryParameter( + "detect_entities", + String.valueOf(options.getDetectEntities().get())); + } + if (options.getDiarize() != null && options.getDiarize().isPresent()) { + urlBuilder.addQueryParameter( + "diarize", String.valueOf(options.getDiarize().get())); + } + if (options.getDictation() != null && options.getDictation().isPresent()) { + urlBuilder.addQueryParameter( + "dictation", String.valueOf(options.getDictation().get())); + } + if (options.getEncoding() != null && options.getEncoding().isPresent()) { + urlBuilder.addQueryParameter( + "encoding", String.valueOf(options.getEncoding().get())); + } + if (options.getEndpointing() != null && options.getEndpointing().isPresent()) { + urlBuilder.addQueryParameter( + "endpointing", String.valueOf(options.getEndpointing().get())); + } + if (options.getExtra() != null && options.getExtra().isPresent()) { + urlBuilder.addQueryParameter( + "extra", String.valueOf(options.getExtra().get())); + } + if (options.getInterimResults() != null && options.getInterimResults().isPresent()) { + urlBuilder.addQueryParameter( + "interim_results", + String.valueOf(options.getInterimResults().get())); + } + if (options.getKeyterm() != null && options.getKeyterm().isPresent()) { + urlBuilder.addQueryParameter( + "keyterm", String.valueOf(options.getKeyterm().get())); + } + if (options.getKeywords() != null && options.getKeywords().isPresent()) { + urlBuilder.addQueryParameter( + "keywords", String.valueOf(options.getKeywords().get())); + } + if (options.getLanguage() != null && options.getLanguage().isPresent()) { + urlBuilder.addQueryParameter( + "language", String.valueOf(options.getLanguage().get())); + } + if (options.getMipOptOut() != null && options.getMipOptOut().isPresent()) { + urlBuilder.addQueryParameter( + "mip_opt_out", String.valueOf(options.getMipOptOut().get())); + } + urlBuilder.addQueryParameter("model", String.valueOf(options.getModel())); + if (options.getMultichannel() != null && options.getMultichannel().isPresent()) { + urlBuilder.addQueryParameter( + "multichannel", String.valueOf(options.getMultichannel().get())); + } + if (options.getNumerals() != null && options.getNumerals().isPresent()) { + urlBuilder.addQueryParameter( + "numerals", String.valueOf(options.getNumerals().get())); + } + if (options.getProfanityFilter() != null && options.getProfanityFilter().isPresent()) { + urlBuilder.addQueryParameter( + "profanity_filter", + String.valueOf(options.getProfanityFilter().get())); + } + if (options.getPunctuate() != null && options.getPunctuate().isPresent()) { + urlBuilder.addQueryParameter( + "punctuate", String.valueOf(options.getPunctuate().get())); + } + if (options.getRedact() != null && options.getRedact().isPresent()) { + urlBuilder.addQueryParameter( + "redact", String.valueOf(options.getRedact().get())); + } + if (options.getReplace() != null && options.getReplace().isPresent()) { + urlBuilder.addQueryParameter( + "replace", String.valueOf(options.getReplace().get())); + } + if (options.getSampleRate() != null && options.getSampleRate().isPresent()) { + urlBuilder.addQueryParameter( + "sample_rate", String.valueOf(options.getSampleRate().get())); + } + if (options.getSearch() != null && options.getSearch().isPresent()) { + urlBuilder.addQueryParameter( + "search", String.valueOf(options.getSearch().get())); + } + if (options.getSmartFormat() != null && options.getSmartFormat().isPresent()) { + urlBuilder.addQueryParameter( + "smart_format", String.valueOf(options.getSmartFormat().get())); + } + if (options.getTag() != null && options.getTag().isPresent()) { + urlBuilder.addQueryParameter("tag", String.valueOf(options.getTag().get())); + } + if (options.getUtteranceEndMs() != null && options.getUtteranceEndMs().isPresent()) { + urlBuilder.addQueryParameter( + "utterance_end_ms", + String.valueOf(options.getUtteranceEndMs().get())); + } + if (options.getVadEvents() != null && options.getVadEvents().isPresent()) { + urlBuilder.addQueryParameter( + "vad_events", String.valueOf(options.getVadEvents().get())); + } + if (options.getVersion() != null && options.getVersion().isPresent()) { + urlBuilder.addQueryParameter( + "version", String.valueOf(options.getVersion().get())); + } + Request.Builder requestBuilder = new Request.Builder().url(urlBuilder.build()); + clientOptions.headers(null).forEach(requestBuilder::addHeader); + final Request request = requestBuilder.build(); + this.readyState = WebSocketReadyState.CONNECTING; + ReconnectingWebSocketListener.ReconnectOptions reconnectOpts = this.reconnectOptions != null + ? this.reconnectOptions + : ReconnectingWebSocketListener.ReconnectOptions.builder().build(); + this.reconnectingListener = + new ReconnectingWebSocketListener(reconnectOpts, () -> { + if (clientOptions.webSocketFactory().isPresent()) { + return clientOptions.webSocketFactory().get().create(request, this.reconnectingListener); + } else { + return okHttpClient.newWebSocket(request, this.reconnectingListener); + } + }) { + @Override + protected void onWebSocketOpen(WebSocket webSocket, Response response) { + readyState = WebSocketReadyState.OPEN; + if (onConnectedHandler != null) { + onConnectedHandler.run(); + } + connectionFuture.complete(null); + } + + @Override + protected void onWebSocketMessage(WebSocket webSocket, String text) { + handleIncomingMessage(text); + } + + @Override + protected void onWebSocketBinaryMessage(WebSocket webSocket, ByteString bytes) {} + + @Override + protected void onWebSocketFailure(WebSocket webSocket, Throwable t, Response response) { + readyState = WebSocketReadyState.CLOSED; + if (onErrorHandler != null) { + onErrorHandler.accept(new RuntimeException(t)); + } + connectionFuture.completeExceptionally(t); + } + + @Override + protected void onWebSocketClosed(WebSocket webSocket, int code, String reason) { + readyState = WebSocketReadyState.CLOSED; + if (onDisconnectedHandler != null) { + onDisconnectedHandler.accept(new DisconnectReason(code, reason)); + } + } + }; + reconnectingListener.connect(); + return connectionFuture; + } + + /** + * Disconnects the WebSocket connection and releases resources. + */ + public void disconnect() { + reconnectingListener.disconnect(); + if (timeoutExecutor != null) { + timeoutExecutor.shutdownNow(); + timeoutExecutor = null; + } + } + + /** + * Gets the current state of the WebSocket connection. + * + * This provides the actual connection state, similar to the W3C WebSocket API. + * + * @return the current WebSocket ready state + */ + public WebSocketReadyState getReadyState() { + return readyState; + } + + /** + * Sends a ListenV1Media message to the server asynchronously. + * @param message the message to send + * @return a CompletableFuture that completes when the message is sent + */ + public CompletableFuture sendMedia(ByteString message) { + CompletableFuture future = new CompletableFuture<>(); + try { + assertSocketIsOpen(); + // Use reconnecting listener's sendBinary method which handles queuing + reconnectingListener.sendBinary(message); + future.complete(null); + } catch (Exception e) { + future.completeExceptionally(new RuntimeException("Failed to send binary data", e)); + } + return future; + } + + /** + * Sends a ListenV1Finalize message to the server asynchronously. + * @param message the message to send + * @return a CompletableFuture that completes when the message is sent + */ + public CompletableFuture sendFinalize(ListenV1Finalize message) { + return sendMessage(message); + } + + /** + * Sends a ListenV1CloseStream message to the server asynchronously. + * @param message the message to send + * @return a CompletableFuture that completes when the message is sent + */ + public CompletableFuture sendCloseStream(ListenV1CloseStream message) { + return sendMessage(message); + } + + /** + * Sends a ListenV1KeepAlive message to the server asynchronously. + * @param message the message to send + * @return a CompletableFuture that completes when the message is sent + */ + public CompletableFuture sendKeepAlive(ListenV1KeepAlive message) { + return sendMessage(message); + } + + /** + * Registers a handler for ListenV1Results messages from the server. + * @param handler the handler to invoke when a message is received + */ + public void onResults(Consumer handler) { + this.resultsHandler = handler; + } + + /** + * Registers a handler for ListenV1Metadata messages from the server. + * @param handler the handler to invoke when a message is received + */ + public void onMetadata(Consumer handler) { + this.metadataHandler = handler; + } + + /** + * Registers a handler for ListenV1UtteranceEnd messages from the server. + * @param handler the handler to invoke when a message is received + */ + public void onUtteranceEnd(Consumer handler) { + this.utteranceEndHandler = handler; + } + + /** + * Registers a handler for ListenV1SpeechStarted messages from the server. + * @param handler the handler to invoke when a message is received + */ + public void onSpeechStarted(Consumer handler) { + this.speechStartedHandler = handler; + } + + /** + * Registers a handler called when the connection is established. + * @param handler the handler to invoke when connected + */ + public void onConnected(Runnable handler) { + this.onConnectedHandler = handler; + } + + /** + * Registers a handler called when the connection is closed. + * @param handler the handler to invoke when disconnected + */ + public void onDisconnected(Consumer handler) { + this.onDisconnectedHandler = handler; + } + + /** + * Registers a handler called when an error occurs. + * @param handler the handler to invoke on error + */ + public void onError(Consumer handler) { + this.onErrorHandler = handler; + } + + /** + * Registers a handler called for every incoming text message. + * The handler receives the raw JSON string before type-specific dispatch. + * @param handler the handler to invoke with the raw message JSON + */ + public void onMessage(Consumer handler) { + this.onMessageHandler = handler; + } + + /** + * Configures reconnection behavior. Must be called before {@link #connect}. + * + * @param options the reconnection options (backoff, retries, queue size) + */ + public void reconnectOptions(ReconnectingWebSocketListener.ReconnectOptions options) { + this.reconnectOptions = options; + } + + /** + * Closes this WebSocket client, releasing all resources. + * Equivalent to calling {@link #disconnect()}. + */ + @Override + public void close() { + disconnect(); + } + + /** + * Ensures the WebSocket is connected and ready to send messages. + * @throws IllegalStateException if the socket is not connected or not open + */ + private void assertSocketIsOpen() { + if (reconnectingListener.getWebSocket() == null) { + throw new IllegalStateException("WebSocket is not connected. Call connect() first."); + } + if (readyState != WebSocketReadyState.OPEN) { + throw new IllegalStateException("WebSocket is not open. Current state: " + readyState); + } + } + + private CompletableFuture sendMessage(Object body) { + CompletableFuture future = new CompletableFuture<>(); + try { + assertSocketIsOpen(); + String json = objectMapper.writeValueAsString(body); + // Use reconnecting listener's send method which handles queuing + reconnectingListener.send(json); + future.complete(null); + } catch (IllegalStateException e) { + future.completeExceptionally(e); + } catch (Exception e) { + future.completeExceptionally(new RuntimeException("Failed to send message", e)); + } + return future; + } + + private void handleIncomingMessage(String json) { + try { + if (onMessageHandler != null) { + onMessageHandler.accept(json); + } + JsonNode node = objectMapper.readTree(json); + if (node == null || node.isNull()) { + throw new IllegalArgumentException("Received null or invalid JSON message"); + } + JsonNode typeNode = node.get("type"); + if (typeNode == null || typeNode.isNull()) { + throw new IllegalArgumentException("Message missing 'type' field"); + } + String type = typeNode.asText(); + switch (type) { + case "Results": + if (resultsHandler != null) { + ListenV1Results event = objectMapper.treeToValue(node, ListenV1Results.class); + if (event != null) { + resultsHandler.accept(event); + } + } + break; + case "Metadata": + if (metadataHandler != null) { + ListenV1Metadata event = objectMapper.treeToValue(node, ListenV1Metadata.class); + if (event != null) { + metadataHandler.accept(event); + } + } + break; + case "UtteranceEnd": + if (utteranceEndHandler != null) { + ListenV1UtteranceEnd event = objectMapper.treeToValue(node, ListenV1UtteranceEnd.class); + if (event != null) { + utteranceEndHandler.accept(event); + } + } + break; + case "SpeechStarted": + if (speechStartedHandler != null) { + ListenV1SpeechStarted event = objectMapper.treeToValue(node, ListenV1SpeechStarted.class); + if (event != null) { + speechStartedHandler.accept(event); + } + } + break; + default: + if (onErrorHandler != null) { + onErrorHandler.accept(new RuntimeException("Unknown WebSocket message type: '" + type + + "'. Update your SDK version to support new message types.")); + } + break; + } + } catch (Exception e) { + if (onErrorHandler != null) { + onErrorHandler.accept(e); + } + } + } +} diff --git a/src/main/java/com/deepgram/resources/listen/v2/AsyncV2Client.java b/src/main/java/com/deepgram/resources/listen/v2/AsyncV2Client.java new file mode 100644 index 0000000..07096ea --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/v2/AsyncV2Client.java @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen.v2; + +import com.deepgram.core.ClientOptions; +import com.deepgram.resources.listen.v2.websocket.V2WebSocketClient; + +public class AsyncV2Client { + protected final ClientOptions clientOptions; + + public AsyncV2Client(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Creates a new WebSocket client for the v2 channel. + */ + public V2WebSocketClient v2WebSocket() { + return new V2WebSocketClient(clientOptions); + } +} diff --git a/src/main/java/com/deepgram/resources/listen/v2/V2Client.java b/src/main/java/com/deepgram/resources/listen/v2/V2Client.java new file mode 100644 index 0000000..6ac86dc --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/v2/V2Client.java @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen.v2; + +import com.deepgram.core.ClientOptions; +import com.deepgram.resources.listen.v2.websocket.V2WebSocketClient; + +public class V2Client { + protected final ClientOptions clientOptions; + + public V2Client(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Creates a new WebSocket client for the v2 channel. + */ + public V2WebSocketClient v2WebSocket() { + return new V2WebSocketClient(clientOptions); + } +} diff --git a/src/main/java/com/deepgram/resources/listen/v2/types/ListenV2CloseStream.java b/src/main/java/com/deepgram/resources/listen/v2/types/ListenV2CloseStream.java new file mode 100644 index 0000000..ccc1104 --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/v2/types/ListenV2CloseStream.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen.v2.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListenV2CloseStream.Builder.class) +public final class ListenV2CloseStream { + private final ListenV2CloseStreamType type; + + private final Map additionalProperties; + + private ListenV2CloseStream(ListenV2CloseStreamType type, Map additionalProperties) { + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return Message type identifier + */ + @JsonProperty("type") + public ListenV2CloseStreamType getType() { + return type; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListenV2CloseStream && equalTo((ListenV2CloseStream) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListenV2CloseStream other) { + return type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TypeStage builder() { + return new Builder(); + } + + public interface TypeStage { + /** + *

Message type identifier

+ */ + _FinalStage type(@NotNull ListenV2CloseStreamType type); + + Builder from(ListenV2CloseStream other); + } + + public interface _FinalStage { + ListenV2CloseStream build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TypeStage, _FinalStage { + private ListenV2CloseStreamType type; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListenV2CloseStream other) { + type(other.getType()); + return this; + } + + /** + *

Message type identifier

+ *

Message type identifier

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull ListenV2CloseStreamType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + @java.lang.Override + public ListenV2CloseStream build() { + return new ListenV2CloseStream(type, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/listen/v2/types/ListenV2CloseStreamType.java b/src/main/java/com/deepgram/resources/listen/v2/types/ListenV2CloseStreamType.java new file mode 100644 index 0000000..326bc2a --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/v2/types/ListenV2CloseStreamType.java @@ -0,0 +1,95 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen.v2.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListenV2CloseStreamType { + public static final ListenV2CloseStreamType CLOSE_STREAM = + new ListenV2CloseStreamType(Value.CLOSE_STREAM, "CloseStream"); + + public static final ListenV2CloseStreamType FINALIZE = new ListenV2CloseStreamType(Value.FINALIZE, "Finalize"); + + public static final ListenV2CloseStreamType KEEP_ALIVE = new ListenV2CloseStreamType(Value.KEEP_ALIVE, "KeepAlive"); + + private final Value value; + + private final String string; + + ListenV2CloseStreamType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListenV2CloseStreamType + && this.string.equals(((ListenV2CloseStreamType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CLOSE_STREAM: + return visitor.visitCloseStream(); + case FINALIZE: + return visitor.visitFinalize(); + case KEEP_ALIVE: + return visitor.visitKeepAlive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListenV2CloseStreamType valueOf(String value) { + switch (value) { + case "CloseStream": + return CLOSE_STREAM; + case "Finalize": + return FINALIZE; + case "KeepAlive": + return KEEP_ALIVE; + default: + return new ListenV2CloseStreamType(Value.UNKNOWN, value); + } + } + + public enum Value { + FINALIZE, + + CLOSE_STREAM, + + KEEP_ALIVE, + + UNKNOWN + } + + public interface Visitor { + T visitFinalize(); + + T visitCloseStream(); + + T visitKeepAlive(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/listen/v2/types/ListenV2Connected.java b/src/main/java/com/deepgram/resources/listen/v2/types/ListenV2Connected.java new file mode 100644 index 0000000..fab5bf9 --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/v2/types/ListenV2Connected.java @@ -0,0 +1,178 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen.v2.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListenV2Connected.Builder.class) +public final class ListenV2Connected { + private final String requestId; + + private final double sequenceId; + + private final Map additionalProperties; + + private ListenV2Connected(String requestId, double sequenceId, Map additionalProperties) { + this.requestId = requestId; + this.sequenceId = sequenceId; + this.additionalProperties = additionalProperties; + } + + /** + * @return Message type identifier + */ + @JsonProperty("type") + public String getType() { + return "Connected"; + } + + /** + * @return The unique identifier of the request + */ + @JsonProperty("request_id") + public String getRequestId() { + return requestId; + } + + /** + * @return Starts at 0 and increments for each message the server sends + * to the client. This includes messages of other types, like + * TurnInfo messages. + */ + @JsonProperty("sequence_id") + public double getSequenceId() { + return sequenceId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListenV2Connected && equalTo((ListenV2Connected) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListenV2Connected other) { + return requestId.equals(other.requestId) && sequenceId == other.sequenceId; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.requestId, this.sequenceId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static RequestIdStage builder() { + return new Builder(); + } + + public interface RequestIdStage { + /** + *

The unique identifier of the request

+ */ + SequenceIdStage requestId(@NotNull String requestId); + + Builder from(ListenV2Connected other); + } + + public interface SequenceIdStage { + /** + *

Starts at 0 and increments for each message the server sends + * to the client. This includes messages of other types, like + * TurnInfo messages.

+ */ + _FinalStage sequenceId(double sequenceId); + } + + public interface _FinalStage { + ListenV2Connected build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements RequestIdStage, SequenceIdStage, _FinalStage { + private String requestId; + + private double sequenceId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListenV2Connected other) { + requestId(other.getRequestId()); + sequenceId(other.getSequenceId()); + return this; + } + + /** + *

The unique identifier of the request

+ *

The unique identifier of the request

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

Starts at 0 and increments for each message the server sends + * to the client. This includes messages of other types, like + * TurnInfo messages.

+ *

Starts at 0 and increments for each message the server sends + * to the client. This includes messages of other types, like + * TurnInfo messages.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("sequence_id") + public _FinalStage sequenceId(double sequenceId) { + this.sequenceId = sequenceId; + return this; + } + + @java.lang.Override + public ListenV2Connected build() { + return new ListenV2Connected(requestId, sequenceId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/listen/v2/types/ListenV2FatalError.java b/src/main/java/com/deepgram/resources/listen/v2/types/ListenV2FatalError.java new file mode 100644 index 0000000..eb41ddb --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/v2/types/ListenV2FatalError.java @@ -0,0 +1,212 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen.v2.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListenV2FatalError.Builder.class) +public final class ListenV2FatalError { + private final double sequenceId; + + private final String code; + + private final String description; + + private final Map additionalProperties; + + private ListenV2FatalError( + double sequenceId, String code, String description, Map additionalProperties) { + this.sequenceId = sequenceId; + this.code = code; + this.description = description; + this.additionalProperties = additionalProperties; + } + + /** + * @return Message type identifier + */ + @JsonProperty("type") + public String getType() { + return "Error"; + } + + /** + * @return Starts at 0 and increments for each message the server sends + * to the client. This includes messages of other types, like + * Connected messages. + */ + @JsonProperty("sequence_id") + public double getSequenceId() { + return sequenceId; + } + + /** + * @return A string code describing the error, e.g. INTERNAL_SERVER_ERROR + */ + @JsonProperty("code") + public String getCode() { + return code; + } + + /** + * @return Prose description of the error + */ + @JsonProperty("description") + public String getDescription() { + return description; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListenV2FatalError && equalTo((ListenV2FatalError) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListenV2FatalError other) { + return sequenceId == other.sequenceId && code.equals(other.code) && description.equals(other.description); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.sequenceId, this.code, this.description); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static SequenceIdStage builder() { + return new Builder(); + } + + public interface SequenceIdStage { + /** + *

Starts at 0 and increments for each message the server sends + * to the client. This includes messages of other types, like + * Connected messages.

+ */ + CodeStage sequenceId(double sequenceId); + + Builder from(ListenV2FatalError other); + } + + public interface CodeStage { + /** + *

A string code describing the error, e.g. INTERNAL_SERVER_ERROR

+ */ + DescriptionStage code(@NotNull String code); + } + + public interface DescriptionStage { + /** + *

Prose description of the error

+ */ + _FinalStage description(@NotNull String description); + } + + public interface _FinalStage { + ListenV2FatalError build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements SequenceIdStage, CodeStage, DescriptionStage, _FinalStage { + private double sequenceId; + + private String code; + + private String description; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListenV2FatalError other) { + sequenceId(other.getSequenceId()); + code(other.getCode()); + description(other.getDescription()); + return this; + } + + /** + *

Starts at 0 and increments for each message the server sends + * to the client. This includes messages of other types, like + * Connected messages.

+ *

Starts at 0 and increments for each message the server sends + * to the client. This includes messages of other types, like + * Connected messages.

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

A string code describing the error, e.g. INTERNAL_SERVER_ERROR

+ *

A string code describing the error, e.g. INTERNAL_SERVER_ERROR

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

Prose description of the error

+ *

Prose description of the error

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("description") + public _FinalStage description(@NotNull String description) { + this.description = Objects.requireNonNull(description, "description must not be null"); + return this; + } + + @java.lang.Override + public ListenV2FatalError build() { + return new ListenV2FatalError(sequenceId, code, description, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/listen/v2/types/ListenV2TurnInfo.java b/src/main/java/com/deepgram/resources/listen/v2/types/ListenV2TurnInfo.java new file mode 100644 index 0000000..819533d --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/v2/types/ListenV2TurnInfo.java @@ -0,0 +1,500 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen.v2.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = ListenV2TurnInfo.Builder.class) +public final class ListenV2TurnInfo { + private final String requestId; + + private final double sequenceId; + + private final ListenV2TurnInfoEvent event; + + private final double turnIndex; + + private final float audioWindowStart; + + private final float audioWindowEnd; + + private final String transcript; + + private final List words; + + private final float endOfTurnConfidence; + + private final Map additionalProperties; + + private ListenV2TurnInfo( + String requestId, + double sequenceId, + ListenV2TurnInfoEvent event, + double turnIndex, + float audioWindowStart, + float audioWindowEnd, + String transcript, + List words, + float endOfTurnConfidence, + Map additionalProperties) { + this.requestId = requestId; + this.sequenceId = sequenceId; + this.event = event; + this.turnIndex = turnIndex; + this.audioWindowStart = audioWindowStart; + this.audioWindowEnd = audioWindowEnd; + this.transcript = transcript; + this.words = words; + this.endOfTurnConfidence = endOfTurnConfidence; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("type") + public String getType() { + return "TurnInfo"; + } + + /** + * @return The unique identifier of the request + */ + @JsonProperty("request_id") + public String getRequestId() { + return requestId; + } + + /** + * @return Starts at 0 and increments for each message the server sends to the client. This includes messages of other types, like Connected messages. + */ + @JsonProperty("sequence_id") + public double getSequenceId() { + return sequenceId; + } + + /** + * @return The type of event being reported. + *
    + *
  • Update - Additional audio has been transcribed, but the turn state hasn't changed
  • + *
  • StartOfTurn - The user has begun speaking for the first time in the turn
  • + *
  • EagerEndOfTurn - The system has moderate confidence that the user has finished speaking for the turn. This is an opportunity to begin preparing an agent reply
  • + *
  • TurnResumed - The system detected that speech had ended and therefore sent an EagerEndOfTurn event, but speech is actually continuing for this turn
  • + *
  • EndOfTurn - The user has finished speaking for the turn
  • + *
+ */ + @JsonProperty("event") + public ListenV2TurnInfoEvent getEvent() { + return event; + } + + /** + * @return The index of the current turn + */ + @JsonProperty("turn_index") + public double getTurnIndex() { + return turnIndex; + } + + /** + * @return Start time in seconds of the audio range that was transcribed + */ + @JsonProperty("audio_window_start") + public float getAudioWindowStart() { + return audioWindowStart; + } + + /** + * @return End time in seconds of the audio range that was transcribed + */ + @JsonProperty("audio_window_end") + public float getAudioWindowEnd() { + return audioWindowEnd; + } + + /** + * @return Text that was said over the course of the current turn + */ + @JsonProperty("transcript") + public String getTranscript() { + return transcript; + } + + /** + * @return The words in the transcript + */ + @JsonProperty("words") + public List getWords() { + return words; + } + + /** + * @return Confidence that no more speech is coming in this turn + */ + @JsonProperty("end_of_turn_confidence") + public float getEndOfTurnConfidence() { + return endOfTurnConfidence; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListenV2TurnInfo && equalTo((ListenV2TurnInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListenV2TurnInfo other) { + return requestId.equals(other.requestId) + && sequenceId == other.sequenceId + && event.equals(other.event) + && turnIndex == other.turnIndex + && audioWindowStart == other.audioWindowStart + && audioWindowEnd == other.audioWindowEnd + && transcript.equals(other.transcript) + && words.equals(other.words) + && endOfTurnConfidence == other.endOfTurnConfidence; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.requestId, + this.sequenceId, + this.event, + this.turnIndex, + this.audioWindowStart, + this.audioWindowEnd, + this.transcript, + this.words, + this.endOfTurnConfidence); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static RequestIdStage builder() { + return new Builder(); + } + + public interface RequestIdStage { + /** + *

The unique identifier of the request

+ */ + SequenceIdStage requestId(@NotNull String requestId); + + Builder from(ListenV2TurnInfo other); + } + + public interface SequenceIdStage { + /** + *

Starts at 0 and increments for each message the server sends to the client. This includes messages of other types, like Connected messages.

+ */ + EventStage sequenceId(double sequenceId); + } + + public interface EventStage { + /** + *

The type of event being reported.

+ *
    + *
  • Update - Additional audio has been transcribed, but the turn state hasn't changed
  • + *
  • StartOfTurn - The user has begun speaking for the first time in the turn
  • + *
  • EagerEndOfTurn - The system has moderate confidence that the user has finished speaking for the turn. This is an opportunity to begin preparing an agent reply
  • + *
  • TurnResumed - The system detected that speech had ended and therefore sent an EagerEndOfTurn event, but speech is actually continuing for this turn
  • + *
  • EndOfTurn - The user has finished speaking for the turn
  • + *
+ */ + TurnIndexStage event(@NotNull ListenV2TurnInfoEvent event); + } + + public interface TurnIndexStage { + /** + *

The index of the current turn

+ */ + AudioWindowStartStage turnIndex(double turnIndex); + } + + public interface AudioWindowStartStage { + /** + *

Start time in seconds of the audio range that was transcribed

+ */ + AudioWindowEndStage audioWindowStart(float audioWindowStart); + } + + public interface AudioWindowEndStage { + /** + *

End time in seconds of the audio range that was transcribed

+ */ + TranscriptStage audioWindowEnd(float audioWindowEnd); + } + + public interface TranscriptStage { + /** + *

Text that was said over the course of the current turn

+ */ + EndOfTurnConfidenceStage transcript(@NotNull String transcript); + } + + public interface EndOfTurnConfidenceStage { + /** + *

Confidence that no more speech is coming in this turn

+ */ + _FinalStage endOfTurnConfidence(float endOfTurnConfidence); + } + + public interface _FinalStage { + ListenV2TurnInfo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

The words in the transcript

+ */ + _FinalStage words(List words); + + _FinalStage addWords(ListenV2TurnInfoWordsItem words); + + _FinalStage addAllWords(List words); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements RequestIdStage, + SequenceIdStage, + EventStage, + TurnIndexStage, + AudioWindowStartStage, + AudioWindowEndStage, + TranscriptStage, + EndOfTurnConfidenceStage, + _FinalStage { + private String requestId; + + private double sequenceId; + + private ListenV2TurnInfoEvent event; + + private double turnIndex; + + private float audioWindowStart; + + private float audioWindowEnd; + + private String transcript; + + private float endOfTurnConfidence; + + private List words = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListenV2TurnInfo other) { + requestId(other.getRequestId()); + sequenceId(other.getSequenceId()); + event(other.getEvent()); + turnIndex(other.getTurnIndex()); + audioWindowStart(other.getAudioWindowStart()); + audioWindowEnd(other.getAudioWindowEnd()); + transcript(other.getTranscript()); + words(other.getWords()); + endOfTurnConfidence(other.getEndOfTurnConfidence()); + return this; + } + + /** + *

The unique identifier of the request

+ *

The unique identifier of the request

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

Starts at 0 and increments for each message the server sends to the client. This includes messages of other types, like Connected messages.

+ *

Starts at 0 and increments for each message the server sends to the client. This includes messages of other types, like Connected messages.

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

The type of event being reported.

+ *
    + *
  • Update - Additional audio has been transcribed, but the turn state hasn't changed
  • + *
  • StartOfTurn - The user has begun speaking for the first time in the turn
  • + *
  • EagerEndOfTurn - The system has moderate confidence that the user has finished speaking for the turn. This is an opportunity to begin preparing an agent reply
  • + *
  • TurnResumed - The system detected that speech had ended and therefore sent an EagerEndOfTurn event, but speech is actually continuing for this turn
  • + *
  • EndOfTurn - The user has finished speaking for the turn
  • + *
+ *

The type of event being reported.

+ *
    + *
  • Update - Additional audio has been transcribed, but the turn state hasn't changed
  • + *
  • StartOfTurn - The user has begun speaking for the first time in the turn
  • + *
  • EagerEndOfTurn - The system has moderate confidence that the user has finished speaking for the turn. This is an opportunity to begin preparing an agent reply
  • + *
  • TurnResumed - The system detected that speech had ended and therefore sent an EagerEndOfTurn event, but speech is actually continuing for this turn
  • + *
  • EndOfTurn - The user has finished speaking for the turn
  • + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("event") + public TurnIndexStage event(@NotNull ListenV2TurnInfoEvent event) { + this.event = Objects.requireNonNull(event, "event must not be null"); + return this; + } + + /** + *

The index of the current turn

+ *

The index of the current turn

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

Start time in seconds of the audio range that was transcribed

+ *

Start time in seconds of the audio range that was transcribed

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

End time in seconds of the audio range that was transcribed

+ *

End time in seconds of the audio range that was transcribed

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

Text that was said over the course of the current turn

+ *

Text that was said over the course of the current turn

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

Confidence that no more speech is coming in this turn

+ *

Confidence that no more speech is coming in this turn

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

The words in the transcript

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllWords(List words) { + if (words != null) { + this.words.addAll(words); + } + return this; + } + + /** + *

The words in the transcript

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addWords(ListenV2TurnInfoWordsItem words) { + this.words.add(words); + return this; + } + + /** + *

The words in the transcript

+ */ + @java.lang.Override + @JsonSetter(value = "words", nulls = Nulls.SKIP) + public _FinalStage words(List words) { + this.words.clear(); + if (words != null) { + this.words.addAll(words); + } + return this; + } + + @java.lang.Override + public ListenV2TurnInfo build() { + return new ListenV2TurnInfo( + requestId, + sequenceId, + event, + turnIndex, + audioWindowStart, + audioWindowEnd, + transcript, + words, + endOfTurnConfidence, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/listen/v2/types/ListenV2TurnInfoEvent.java b/src/main/java/com/deepgram/resources/listen/v2/types/ListenV2TurnInfoEvent.java new file mode 100644 index 0000000..603b8c2 --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/v2/types/ListenV2TurnInfoEvent.java @@ -0,0 +1,117 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen.v2.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListenV2TurnInfoEvent { + public static final ListenV2TurnInfoEvent EAGER_END_OF_TURN = + new ListenV2TurnInfoEvent(Value.EAGER_END_OF_TURN, "EagerEndOfTurn"); + + public static final ListenV2TurnInfoEvent UPDATE = new ListenV2TurnInfoEvent(Value.UPDATE, "Update"); + + public static final ListenV2TurnInfoEvent START_OF_TURN = + new ListenV2TurnInfoEvent(Value.START_OF_TURN, "StartOfTurn"); + + public static final ListenV2TurnInfoEvent END_OF_TURN = new ListenV2TurnInfoEvent(Value.END_OF_TURN, "EndOfTurn"); + + public static final ListenV2TurnInfoEvent TURN_RESUMED = + new ListenV2TurnInfoEvent(Value.TURN_RESUMED, "TurnResumed"); + + private final Value value; + + private final String string; + + ListenV2TurnInfoEvent(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListenV2TurnInfoEvent + && this.string.equals(((ListenV2TurnInfoEvent) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case EAGER_END_OF_TURN: + return visitor.visitEagerEndOfTurn(); + case UPDATE: + return visitor.visitUpdate(); + case START_OF_TURN: + return visitor.visitStartOfTurn(); + case END_OF_TURN: + return visitor.visitEndOfTurn(); + case TURN_RESUMED: + return visitor.visitTurnResumed(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListenV2TurnInfoEvent valueOf(String value) { + switch (value) { + case "EagerEndOfTurn": + return EAGER_END_OF_TURN; + case "Update": + return UPDATE; + case "StartOfTurn": + return START_OF_TURN; + case "EndOfTurn": + return END_OF_TURN; + case "TurnResumed": + return TURN_RESUMED; + default: + return new ListenV2TurnInfoEvent(Value.UNKNOWN, value); + } + } + + public enum Value { + UPDATE, + + START_OF_TURN, + + EAGER_END_OF_TURN, + + TURN_RESUMED, + + END_OF_TURN, + + UNKNOWN + } + + public interface Visitor { + T visitUpdate(); + + T visitStartOfTurn(); + + T visitEagerEndOfTurn(); + + T visitTurnResumed(); + + T visitEndOfTurn(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/listen/v2/types/ListenV2TurnInfoWordsItem.java b/src/main/java/com/deepgram/resources/listen/v2/types/ListenV2TurnInfoWordsItem.java new file mode 100644 index 0000000..b7a751e --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/v2/types/ListenV2TurnInfoWordsItem.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen.v2.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListenV2TurnInfoWordsItem.Builder.class) +public final class ListenV2TurnInfoWordsItem { + private final String word; + + private final float confidence; + + private final Map additionalProperties; + + private ListenV2TurnInfoWordsItem(String word, float confidence, Map additionalProperties) { + this.word = word; + this.confidence = confidence; + this.additionalProperties = additionalProperties; + } + + /** + * @return The individual punctuated, properly-cased word from the transcript + */ + @JsonProperty("word") + public String getWord() { + return word; + } + + /** + * @return Confidence that this word was transcribed correctly + */ + @JsonProperty("confidence") + public float getConfidence() { + return confidence; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListenV2TurnInfoWordsItem && equalTo((ListenV2TurnInfoWordsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListenV2TurnInfoWordsItem other) { + return word.equals(other.word) && confidence == other.confidence; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.word, this.confidence); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static WordStage builder() { + return new Builder(); + } + + public interface WordStage { + /** + *

The individual punctuated, properly-cased word from the transcript

+ */ + ConfidenceStage word(@NotNull String word); + + Builder from(ListenV2TurnInfoWordsItem other); + } + + public interface ConfidenceStage { + /** + *

Confidence that this word was transcribed correctly

+ */ + _FinalStage confidence(float confidence); + } + + public interface _FinalStage { + ListenV2TurnInfoWordsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements WordStage, ConfidenceStage, _FinalStage { + private String word; + + private float confidence; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListenV2TurnInfoWordsItem other) { + word(other.getWord()); + confidence(other.getConfidence()); + return this; + } + + /** + *

The individual punctuated, properly-cased word from the transcript

+ *

The individual punctuated, properly-cased word from the transcript

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

Confidence that this word was transcribed correctly

+ *

Confidence that this word was transcribed correctly

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("confidence") + public _FinalStage confidence(float confidence) { + this.confidence = confidence; + return this; + } + + @java.lang.Override + public ListenV2TurnInfoWordsItem build() { + return new ListenV2TurnInfoWordsItem(word, confidence, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/listen/v2/websocket/V2ConnectOptions.java b/src/main/java/com/deepgram/resources/listen/v2/websocket/V2ConnectOptions.java new file mode 100644 index 0000000..5e7060f --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/v2/websocket/V2ConnectOptions.java @@ -0,0 +1,389 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen.v2.websocket; + +import com.deepgram.core.ObjectMappers; +import com.deepgram.types.ListenV2EagerEotThreshold; +import com.deepgram.types.ListenV2Encoding; +import com.deepgram.types.ListenV2EotThreshold; +import com.deepgram.types.ListenV2EotTimeoutMs; +import com.deepgram.types.ListenV2Keyterm; +import com.deepgram.types.ListenV2MipOptOut; +import com.deepgram.types.ListenV2SampleRate; +import com.deepgram.types.ListenV2Tag; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = V2ConnectOptions.Builder.class) +public final class V2ConnectOptions { + private final String model; + + private final Optional encoding; + + private final Optional sampleRate; + + private final Optional eagerEotThreshold; + + private final Optional eotThreshold; + + private final Optional eotTimeoutMs; + + private final Optional keyterm; + + private final Optional mipOptOut; + + private final Optional tag; + + private final Map additionalProperties; + + private V2ConnectOptions( + String model, + Optional encoding, + Optional sampleRate, + Optional eagerEotThreshold, + Optional eotThreshold, + Optional eotTimeoutMs, + Optional keyterm, + Optional mipOptOut, + Optional tag, + Map additionalProperties) { + this.model = model; + this.encoding = encoding; + this.sampleRate = sampleRate; + this.eagerEotThreshold = eagerEotThreshold; + this.eotThreshold = eotThreshold; + this.eotTimeoutMs = eotTimeoutMs; + this.keyterm = keyterm; + this.mipOptOut = mipOptOut; + this.tag = tag; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("model") + public String getModel() { + return model; + } + + @JsonProperty("encoding") + public Optional getEncoding() { + return encoding; + } + + @JsonProperty("sample_rate") + public Optional getSampleRate() { + return sampleRate; + } + + @JsonProperty("eager_eot_threshold") + public Optional getEagerEotThreshold() { + return eagerEotThreshold; + } + + @JsonProperty("eot_threshold") + public Optional getEotThreshold() { + return eotThreshold; + } + + @JsonProperty("eot_timeout_ms") + public Optional getEotTimeoutMs() { + return eotTimeoutMs; + } + + @JsonProperty("keyterm") + public Optional getKeyterm() { + return keyterm; + } + + @JsonProperty("mip_opt_out") + public Optional getMipOptOut() { + return mipOptOut; + } + + @JsonProperty("tag") + public Optional getTag() { + return tag; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V2ConnectOptions && equalTo((V2ConnectOptions) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V2ConnectOptions other) { + return model.equals(other.model) + && encoding.equals(other.encoding) + && sampleRate.equals(other.sampleRate) + && eagerEotThreshold.equals(other.eagerEotThreshold) + && eotThreshold.equals(other.eotThreshold) + && eotTimeoutMs.equals(other.eotTimeoutMs) + && keyterm.equals(other.keyterm) + && mipOptOut.equals(other.mipOptOut) + && tag.equals(other.tag); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.model, + this.encoding, + this.sampleRate, + this.eagerEotThreshold, + this.eotThreshold, + this.eotTimeoutMs, + this.keyterm, + this.mipOptOut, + this.tag); + } + + @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(V2ConnectOptions other); + } + + public interface _FinalStage { + V2ConnectOptions build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage encoding(Optional encoding); + + _FinalStage encoding(ListenV2Encoding encoding); + + _FinalStage sampleRate(Optional sampleRate); + + _FinalStage sampleRate(ListenV2SampleRate sampleRate); + + _FinalStage eagerEotThreshold(Optional eagerEotThreshold); + + _FinalStage eagerEotThreshold(ListenV2EagerEotThreshold eagerEotThreshold); + + _FinalStage eotThreshold(Optional eotThreshold); + + _FinalStage eotThreshold(ListenV2EotThreshold eotThreshold); + + _FinalStage eotTimeoutMs(Optional eotTimeoutMs); + + _FinalStage eotTimeoutMs(ListenV2EotTimeoutMs eotTimeoutMs); + + _FinalStage keyterm(Optional keyterm); + + _FinalStage keyterm(ListenV2Keyterm keyterm); + + _FinalStage mipOptOut(Optional mipOptOut); + + _FinalStage mipOptOut(ListenV2MipOptOut mipOptOut); + + _FinalStage tag(Optional tag); + + _FinalStage tag(ListenV2Tag tag); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ModelStage, _FinalStage { + private String model; + + private Optional tag = Optional.empty(); + + private Optional mipOptOut = Optional.empty(); + + private Optional keyterm = Optional.empty(); + + private Optional eotTimeoutMs = Optional.empty(); + + private Optional eotThreshold = Optional.empty(); + + private Optional eagerEotThreshold = Optional.empty(); + + private Optional sampleRate = Optional.empty(); + + private Optional encoding = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(V2ConnectOptions other) { + model(other.getModel()); + encoding(other.getEncoding()); + sampleRate(other.getSampleRate()); + eagerEotThreshold(other.getEagerEotThreshold()); + eotThreshold(other.getEotThreshold()); + eotTimeoutMs(other.getEotTimeoutMs()); + keyterm(other.getKeyterm()); + mipOptOut(other.getMipOptOut()); + tag(other.getTag()); + return this; + } + + @java.lang.Override + @JsonSetter("model") + public _FinalStage model(@NotNull String model) { + this.model = Objects.requireNonNull(model, "model must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage tag(ListenV2Tag 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 _FinalStage mipOptOut(ListenV2MipOptOut mipOptOut) { + this.mipOptOut = Optional.ofNullable(mipOptOut); + return this; + } + + @java.lang.Override + @JsonSetter(value = "mip_opt_out", nulls = Nulls.SKIP) + public _FinalStage mipOptOut(Optional mipOptOut) { + this.mipOptOut = mipOptOut; + return this; + } + + @java.lang.Override + public _FinalStage keyterm(ListenV2Keyterm keyterm) { + this.keyterm = Optional.ofNullable(keyterm); + return this; + } + + @java.lang.Override + @JsonSetter(value = "keyterm", nulls = Nulls.SKIP) + public _FinalStage keyterm(Optional keyterm) { + this.keyterm = keyterm; + return this; + } + + @java.lang.Override + public _FinalStage eotTimeoutMs(ListenV2EotTimeoutMs eotTimeoutMs) { + this.eotTimeoutMs = Optional.ofNullable(eotTimeoutMs); + return this; + } + + @java.lang.Override + @JsonSetter(value = "eot_timeout_ms", nulls = Nulls.SKIP) + public _FinalStage eotTimeoutMs(Optional eotTimeoutMs) { + this.eotTimeoutMs = eotTimeoutMs; + return this; + } + + @java.lang.Override + public _FinalStage eotThreshold(ListenV2EotThreshold eotThreshold) { + this.eotThreshold = Optional.ofNullable(eotThreshold); + return this; + } + + @java.lang.Override + @JsonSetter(value = "eot_threshold", nulls = Nulls.SKIP) + public _FinalStage eotThreshold(Optional eotThreshold) { + this.eotThreshold = eotThreshold; + return this; + } + + @java.lang.Override + public _FinalStage eagerEotThreshold(ListenV2EagerEotThreshold eagerEotThreshold) { + this.eagerEotThreshold = Optional.ofNullable(eagerEotThreshold); + return this; + } + + @java.lang.Override + @JsonSetter(value = "eager_eot_threshold", nulls = Nulls.SKIP) + public _FinalStage eagerEotThreshold(Optional eagerEotThreshold) { + this.eagerEotThreshold = eagerEotThreshold; + return this; + } + + @java.lang.Override + public _FinalStage sampleRate(ListenV2SampleRate sampleRate) { + this.sampleRate = Optional.ofNullable(sampleRate); + return this; + } + + @java.lang.Override + @JsonSetter(value = "sample_rate", nulls = Nulls.SKIP) + public _FinalStage sampleRate(Optional sampleRate) { + this.sampleRate = sampleRate; + return this; + } + + @java.lang.Override + public _FinalStage encoding(ListenV2Encoding encoding) { + this.encoding = Optional.ofNullable(encoding); + return this; + } + + @java.lang.Override + @JsonSetter(value = "encoding", nulls = Nulls.SKIP) + public _FinalStage encoding(Optional encoding) { + this.encoding = encoding; + return this; + } + + @java.lang.Override + public V2ConnectOptions build() { + return new V2ConnectOptions( + model, + encoding, + sampleRate, + eagerEotThreshold, + eotThreshold, + eotTimeoutMs, + keyterm, + mipOptOut, + tag, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/listen/v2/websocket/V2WebSocketClient.java b/src/main/java/com/deepgram/resources/listen/v2/websocket/V2WebSocketClient.java new file mode 100644 index 0000000..7de5666 --- /dev/null +++ b/src/main/java/com/deepgram/resources/listen/v2/websocket/V2WebSocketClient.java @@ -0,0 +1,388 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.listen.v2.websocket; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.DisconnectReason; +import com.deepgram.core.ObjectMappers; +import com.deepgram.core.ReconnectingWebSocketListener; +import com.deepgram.core.WebSocketReadyState; +import com.deepgram.resources.listen.v2.types.ListenV2CloseStream; +import com.deepgram.resources.listen.v2.types.ListenV2Connected; +import com.deepgram.resources.listen.v2.types.ListenV2FatalError; +import com.deepgram.resources.listen.v2.types.ListenV2TurnInfo; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ScheduledExecutorService; +import java.util.function.Consumer; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.WebSocket; +import okio.ByteString; + +/** + * WebSocket client for the v2 channel. + * Provides real-time bidirectional communication with strongly-typed messages. + */ +public class V2WebSocketClient implements AutoCloseable { + protected final ClientOptions clientOptions; + + private final ObjectMapper objectMapper; + + private final OkHttpClient okHttpClient; + + private ScheduledExecutorService timeoutExecutor; + + private volatile WebSocketReadyState readyState = WebSocketReadyState.CLOSED; + + private volatile Runnable onConnectedHandler; + + private volatile Consumer onDisconnectedHandler; + + private volatile Consumer onErrorHandler; + + private volatile Consumer onMessageHandler; + + private volatile ReconnectingWebSocketListener.ReconnectOptions reconnectOptions; + + private CompletableFuture connectionFuture; + + private ReconnectingWebSocketListener reconnectingListener; + + private volatile Consumer connectedHandler; + + private volatile Consumer turnInfoHandler; + + private volatile Consumer errorHandler; + + /** + * Creates a new async WebSocket client for the v2 channel. + */ + public V2WebSocketClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.objectMapper = ObjectMappers.JSON_MAPPER; + this.okHttpClient = clientOptions.httpClient(); + } + + /** + * Establishes the WebSocket connection asynchronously with automatic reconnection. + * @return a CompletableFuture that completes when the connection is established + * @param options connection options including query parameters + */ + public CompletableFuture connect(V2ConnectOptions options) { + connectionFuture = new CompletableFuture<>(); + String baseUrl = clientOptions.environment().getProductionURL(); + String fullPath = "/v2/listen"; + if (baseUrl.endsWith("/") && fullPath.startsWith("/")) { + fullPath = fullPath.substring(1); + } else if (!baseUrl.endsWith("/") && !fullPath.startsWith("/")) { + fullPath = "/" + fullPath; + } + // OkHttp's HttpUrl only supports http/https schemes; convert wss/ws for URL parsing + if (baseUrl.startsWith("wss://")) { + baseUrl = "https://" + baseUrl.substring(6); + } else if (baseUrl.startsWith("ws://")) { + baseUrl = "http://" + baseUrl.substring(5); + } + HttpUrl parsedUrl = HttpUrl.parse(baseUrl + fullPath); + if (parsedUrl == null) { + throw new IllegalArgumentException("Invalid WebSocket URL: " + baseUrl + fullPath); + } + HttpUrl.Builder urlBuilder = parsedUrl.newBuilder(); + urlBuilder.addQueryParameter("model", String.valueOf(options.getModel())); + if (options.getEncoding() != null && options.getEncoding().isPresent()) { + urlBuilder.addQueryParameter( + "encoding", String.valueOf(options.getEncoding().get())); + } + if (options.getSampleRate() != null && options.getSampleRate().isPresent()) { + urlBuilder.addQueryParameter( + "sample_rate", String.valueOf(options.getSampleRate().get())); + } + if (options.getEagerEotThreshold() != null + && options.getEagerEotThreshold().isPresent()) { + urlBuilder.addQueryParameter( + "eager_eot_threshold", + String.valueOf(options.getEagerEotThreshold().get())); + } + if (options.getEotThreshold() != null && options.getEotThreshold().isPresent()) { + urlBuilder.addQueryParameter( + "eot_threshold", String.valueOf(options.getEotThreshold().get())); + } + if (options.getEotTimeoutMs() != null && options.getEotTimeoutMs().isPresent()) { + urlBuilder.addQueryParameter( + "eot_timeout_ms", String.valueOf(options.getEotTimeoutMs().get())); + } + if (options.getKeyterm() != null && options.getKeyterm().isPresent()) { + urlBuilder.addQueryParameter( + "keyterm", String.valueOf(options.getKeyterm().get())); + } + if (options.getMipOptOut() != null && options.getMipOptOut().isPresent()) { + urlBuilder.addQueryParameter( + "mip_opt_out", String.valueOf(options.getMipOptOut().get())); + } + if (options.getTag() != null && options.getTag().isPresent()) { + urlBuilder.addQueryParameter("tag", String.valueOf(options.getTag().get())); + } + Request.Builder requestBuilder = new Request.Builder().url(urlBuilder.build()); + clientOptions.headers(null).forEach(requestBuilder::addHeader); + final Request request = requestBuilder.build(); + this.readyState = WebSocketReadyState.CONNECTING; + ReconnectingWebSocketListener.ReconnectOptions reconnectOpts = this.reconnectOptions != null + ? this.reconnectOptions + : ReconnectingWebSocketListener.ReconnectOptions.builder().build(); + this.reconnectingListener = + new ReconnectingWebSocketListener(reconnectOpts, () -> { + if (clientOptions.webSocketFactory().isPresent()) { + return clientOptions.webSocketFactory().get().create(request, this.reconnectingListener); + } else { + return okHttpClient.newWebSocket(request, this.reconnectingListener); + } + }) { + @Override + protected void onWebSocketOpen(WebSocket webSocket, Response response) { + readyState = WebSocketReadyState.OPEN; + if (onConnectedHandler != null) { + onConnectedHandler.run(); + } + connectionFuture.complete(null); + } + + @Override + protected void onWebSocketMessage(WebSocket webSocket, String text) { + handleIncomingMessage(text); + } + + @Override + protected void onWebSocketBinaryMessage(WebSocket webSocket, ByteString bytes) {} + + @Override + protected void onWebSocketFailure(WebSocket webSocket, Throwable t, Response response) { + readyState = WebSocketReadyState.CLOSED; + if (onErrorHandler != null) { + onErrorHandler.accept(new RuntimeException(t)); + } + connectionFuture.completeExceptionally(t); + } + + @Override + protected void onWebSocketClosed(WebSocket webSocket, int code, String reason) { + readyState = WebSocketReadyState.CLOSED; + if (onDisconnectedHandler != null) { + onDisconnectedHandler.accept(new DisconnectReason(code, reason)); + } + } + }; + reconnectingListener.connect(); + return connectionFuture; + } + + /** + * Disconnects the WebSocket connection and releases resources. + */ + public void disconnect() { + reconnectingListener.disconnect(); + if (timeoutExecutor != null) { + timeoutExecutor.shutdownNow(); + timeoutExecutor = null; + } + } + + /** + * Gets the current state of the WebSocket connection. + * + * This provides the actual connection state, similar to the W3C WebSocket API. + * + * @return the current WebSocket ready state + */ + public WebSocketReadyState getReadyState() { + return readyState; + } + + /** + * Sends a ListenV2Media message to the server asynchronously. + * @param message the message to send + * @return a CompletableFuture that completes when the message is sent + */ + public CompletableFuture sendMedia(ByteString message) { + CompletableFuture future = new CompletableFuture<>(); + try { + assertSocketIsOpen(); + // Use reconnecting listener's sendBinary method which handles queuing + reconnectingListener.sendBinary(message); + future.complete(null); + } catch (Exception e) { + future.completeExceptionally(new RuntimeException("Failed to send binary data", e)); + } + return future; + } + + /** + * Sends a ListenV2CloseStream message to the server asynchronously. + * @param message the message to send + * @return a CompletableFuture that completes when the message is sent + */ + public CompletableFuture sendCloseStream(ListenV2CloseStream message) { + return sendMessage(message); + } + + /** + * Registers a handler for ListenV2Connected messages from the server. + * @param handler the handler to invoke when a message is received + */ + public void onConnected(Consumer handler) { + this.connectedHandler = handler; + } + + /** + * Registers a handler for ListenV2TurnInfo messages from the server. + * @param handler the handler to invoke when a message is received + */ + public void onTurnInfo(Consumer handler) { + this.turnInfoHandler = handler; + } + + /** + * Registers a handler for ListenV2FatalError messages from the server. + * @param handler the handler to invoke when a message is received + */ + public void onErrorMessage(Consumer handler) { + this.errorHandler = handler; + } + + /** + * Registers a handler called when the connection is established. + * @param handler the handler to invoke when connected + */ + public void onConnected(Runnable handler) { + this.onConnectedHandler = handler; + } + + /** + * Registers a handler called when the connection is closed. + * @param handler the handler to invoke when disconnected + */ + public void onDisconnected(Consumer handler) { + this.onDisconnectedHandler = handler; + } + + /** + * Registers a handler called when an error occurs. + * @param handler the handler to invoke on error + */ + public void onError(Consumer handler) { + this.onErrorHandler = handler; + } + + /** + * Registers a handler called for every incoming text message. + * The handler receives the raw JSON string before type-specific dispatch. + * @param handler the handler to invoke with the raw message JSON + */ + public void onMessage(Consumer handler) { + this.onMessageHandler = handler; + } + + /** + * Configures reconnection behavior. Must be called before {@link #connect}. + * + * @param options the reconnection options (backoff, retries, queue size) + */ + public void reconnectOptions(ReconnectingWebSocketListener.ReconnectOptions options) { + this.reconnectOptions = options; + } + + /** + * Closes this WebSocket client, releasing all resources. + * Equivalent to calling {@link #disconnect()}. + */ + @Override + public void close() { + disconnect(); + } + + /** + * Ensures the WebSocket is connected and ready to send messages. + * @throws IllegalStateException if the socket is not connected or not open + */ + private void assertSocketIsOpen() { + if (reconnectingListener.getWebSocket() == null) { + throw new IllegalStateException("WebSocket is not connected. Call connect() first."); + } + if (readyState != WebSocketReadyState.OPEN) { + throw new IllegalStateException("WebSocket is not open. Current state: " + readyState); + } + } + + private CompletableFuture sendMessage(Object body) { + CompletableFuture future = new CompletableFuture<>(); + try { + assertSocketIsOpen(); + String json = objectMapper.writeValueAsString(body); + // Use reconnecting listener's send method which handles queuing + reconnectingListener.send(json); + future.complete(null); + } catch (IllegalStateException e) { + future.completeExceptionally(e); + } catch (Exception e) { + future.completeExceptionally(new RuntimeException("Failed to send message", e)); + } + return future; + } + + private void handleIncomingMessage(String json) { + try { + if (onMessageHandler != null) { + onMessageHandler.accept(json); + } + JsonNode node = objectMapper.readTree(json); + if (node == null || node.isNull()) { + throw new IllegalArgumentException("Received null or invalid JSON message"); + } + JsonNode typeNode = node.get("type"); + if (typeNode == null || typeNode.isNull()) { + throw new IllegalArgumentException("Message missing 'type' field"); + } + String type = typeNode.asText(); + switch (type) { + case "Connected": + if (connectedHandler != null) { + ListenV2Connected event = objectMapper.treeToValue(node, ListenV2Connected.class); + if (event != null) { + connectedHandler.accept(event); + } + } + break; + case "TurnInfo": + if (turnInfoHandler != null) { + ListenV2TurnInfo event = objectMapper.treeToValue(node, ListenV2TurnInfo.class); + if (event != null) { + turnInfoHandler.accept(event); + } + } + break; + case "Error": + if (errorHandler != null) { + ListenV2FatalError event = objectMapper.treeToValue(node, ListenV2FatalError.class); + if (event != null) { + errorHandler.accept(event); + } + } + break; + default: + if (onErrorHandler != null) { + onErrorHandler.accept(new RuntimeException("Unknown WebSocket message type: '" + type + + "'. Update your SDK version to support new message types.")); + } + break; + } + } catch (Exception e) { + if (onErrorHandler != null) { + onErrorHandler.accept(e); + } + } + } +} diff --git a/src/main/java/com/deepgram/resources/manage/AsyncManageClient.java b/src/main/java/com/deepgram/resources/manage/AsyncManageClient.java new file mode 100644 index 0000000..4964b06 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/AsyncManageClient.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.Suppliers; +import com.deepgram.resources.manage.v1.AsyncV1Client; +import java.util.function.Supplier; + +public class AsyncManageClient { + protected final ClientOptions clientOptions; + + protected final Supplier v1Client; + + public AsyncManageClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.v1Client = Suppliers.memoize(() -> new AsyncV1Client(clientOptions)); + } + + public AsyncV1Client v1() { + return this.v1Client.get(); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/ManageClient.java b/src/main/java/com/deepgram/resources/manage/ManageClient.java new file mode 100644 index 0000000..a81bdc1 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/ManageClient.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.Suppliers; +import com.deepgram.resources.manage.v1.V1Client; +import java.util.function.Supplier; + +public class ManageClient { + protected final ClientOptions clientOptions; + + protected final Supplier v1Client; + + public ManageClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.v1Client = Suppliers.memoize(() -> new V1Client(clientOptions)); + } + + public V1Client v1() { + return this.v1Client.get(); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/AsyncV1Client.java b/src/main/java/com/deepgram/resources/manage/v1/AsyncV1Client.java new file mode 100644 index 0000000..a9e1d7b --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/AsyncV1Client.java @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.Suppliers; +import com.deepgram.resources.manage.v1.models.AsyncModelsClient; +import com.deepgram.resources.manage.v1.projects.AsyncProjectsClient; +import java.util.function.Supplier; + +public class AsyncV1Client { + protected final ClientOptions clientOptions; + + protected final Supplier modelsClient; + + protected final Supplier projectsClient; + + public AsyncV1Client(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.modelsClient = Suppliers.memoize(() -> new AsyncModelsClient(clientOptions)); + this.projectsClient = Suppliers.memoize(() -> new AsyncProjectsClient(clientOptions)); + } + + public AsyncModelsClient models() { + return this.modelsClient.get(); + } + + public AsyncProjectsClient projects() { + return this.projectsClient.get(); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/V1Client.java b/src/main/java/com/deepgram/resources/manage/v1/V1Client.java new file mode 100644 index 0000000..9c7ede0 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/V1Client.java @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.Suppliers; +import com.deepgram.resources.manage.v1.models.ModelsClient; +import com.deepgram.resources.manage.v1.projects.ProjectsClient; +import java.util.function.Supplier; + +public class V1Client { + protected final ClientOptions clientOptions; + + protected final Supplier modelsClient; + + protected final Supplier projectsClient; + + public V1Client(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.modelsClient = Suppliers.memoize(() -> new ModelsClient(clientOptions)); + this.projectsClient = Suppliers.memoize(() -> new ProjectsClient(clientOptions)); + } + + public ModelsClient models() { + return this.modelsClient.get(); + } + + public ProjectsClient projects() { + return this.projectsClient.get(); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/models/AsyncModelsClient.java b/src/main/java/com/deepgram/resources/manage/v1/models/AsyncModelsClient.java new file mode 100644 index 0000000..50bc8dd --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/models/AsyncModelsClient.java @@ -0,0 +1,71 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.models; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.RequestOptions; +import com.deepgram.resources.manage.v1.models.requests.ModelsListRequest; +import com.deepgram.types.GetModelV1Response; +import com.deepgram.types.ListModelsV1Response; +import java.util.concurrent.CompletableFuture; + +public class AsyncModelsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawModelsClient rawClient; + + public AsyncModelsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawModelsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawModelsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns metadata on all the latest public models. To retrieve custom models, use Get Project Models. + */ + public CompletableFuture list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Returns metadata on all the latest public models. To retrieve custom models, use Get Project Models. + */ + public CompletableFuture list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Returns metadata on all the latest public models. To retrieve custom models, use Get Project Models. + */ + public CompletableFuture list(ModelsListRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + /** + * Returns metadata on all the latest public models. To retrieve custom models, use Get Project Models. + */ + public CompletableFuture list(ModelsListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Returns metadata for a specific public model + */ + public CompletableFuture get(String modelId) { + return this.rawClient.get(modelId).thenApply(response -> response.body()); + } + + /** + * Returns metadata for a specific public model + */ + public CompletableFuture get(String modelId, RequestOptions requestOptions) { + return this.rawClient.get(modelId, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/models/AsyncRawModelsClient.java b/src/main/java/com/deepgram/resources/manage/v1/models/AsyncRawModelsClient.java new file mode 100644 index 0000000..34aebc2 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/models/AsyncRawModelsClient.java @@ -0,0 +1,191 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.models; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.DeepgramApiApiException; +import com.deepgram.core.DeepgramApiException; +import com.deepgram.core.DeepgramApiHttpResponse; +import com.deepgram.core.ObjectMappers; +import com.deepgram.core.QueryStringMapper; +import com.deepgram.core.RequestOptions; +import com.deepgram.errors.BadRequestError; +import com.deepgram.resources.manage.v1.models.requests.ModelsListRequest; +import com.deepgram.types.GetModelV1Response; +import com.deepgram.types.ListModelsV1Response; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawModelsClient { + protected final ClientOptions clientOptions; + + public AsyncRawModelsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns metadata on all the latest public models. To retrieve custom models, use Get Project Models. + */ + public CompletableFuture> list() { + return list(ModelsListRequest.builder().build()); + } + + /** + * Returns metadata on all the latest public models. To retrieve custom models, use Get Project Models. + */ + public CompletableFuture> list(RequestOptions requestOptions) { + return list(ModelsListRequest.builder().build(), requestOptions); + } + + /** + * Returns metadata on all the latest public models. To retrieve custom models, use Get Project Models. + */ + public CompletableFuture> list(ModelsListRequest request) { + return list(request, null); + } + + /** + * Returns metadata on all the latest public models. To retrieve custom models, use Get Project Models. + */ + public CompletableFuture> list( + ModelsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/models"); + if (request.getIncludeOutdated().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "include_outdated", request.getIncludeOutdated().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListModelsV1Response.class), + response)); + return; + } + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Returns metadata for a specific public model + */ + public CompletableFuture> get(String modelId) { + return get(modelId, null); + } + + /** + * Returns metadata for a specific public model + */ + public CompletableFuture> get( + String modelId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/models") + .addPathSegment(modelId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetModelV1Response.class), + response)); + return; + } + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/models/ModelsClient.java b/src/main/java/com/deepgram/resources/manage/v1/models/ModelsClient.java new file mode 100644 index 0000000..c84fb11 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/models/ModelsClient.java @@ -0,0 +1,70 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.models; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.RequestOptions; +import com.deepgram.resources.manage.v1.models.requests.ModelsListRequest; +import com.deepgram.types.GetModelV1Response; +import com.deepgram.types.ListModelsV1Response; + +public class ModelsClient { + protected final ClientOptions clientOptions; + + private final RawModelsClient rawClient; + + public ModelsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawModelsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawModelsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns metadata on all the latest public models. To retrieve custom models, use Get Project Models. + */ + public ListModelsV1Response list() { + return this.rawClient.list().body(); + } + + /** + * Returns metadata on all the latest public models. To retrieve custom models, use Get Project Models. + */ + public ListModelsV1Response list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Returns metadata on all the latest public models. To retrieve custom models, use Get Project Models. + */ + public ListModelsV1Response list(ModelsListRequest request) { + return this.rawClient.list(request).body(); + } + + /** + * Returns metadata on all the latest public models. To retrieve custom models, use Get Project Models. + */ + public ListModelsV1Response list(ModelsListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + /** + * Returns metadata for a specific public model + */ + public GetModelV1Response get(String modelId) { + return this.rawClient.get(modelId).body(); + } + + /** + * Returns metadata for a specific public model + */ + public GetModelV1Response get(String modelId, RequestOptions requestOptions) { + return this.rawClient.get(modelId, requestOptions).body(); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/models/RawModelsClient.java b/src/main/java/com/deepgram/resources/manage/v1/models/RawModelsClient.java new file mode 100644 index 0000000..7e60a5a --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/models/RawModelsClient.java @@ -0,0 +1,156 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.models; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.DeepgramApiApiException; +import com.deepgram.core.DeepgramApiException; +import com.deepgram.core.DeepgramApiHttpResponse; +import com.deepgram.core.ObjectMappers; +import com.deepgram.core.QueryStringMapper; +import com.deepgram.core.RequestOptions; +import com.deepgram.errors.BadRequestError; +import com.deepgram.resources.manage.v1.models.requests.ModelsListRequest; +import com.deepgram.types.GetModelV1Response; +import com.deepgram.types.ListModelsV1Response; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawModelsClient { + protected final ClientOptions clientOptions; + + public RawModelsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns metadata on all the latest public models. To retrieve custom models, use Get Project Models. + */ + public DeepgramApiHttpResponse list() { + return list(ModelsListRequest.builder().build()); + } + + /** + * Returns metadata on all the latest public models. To retrieve custom models, use Get Project Models. + */ + public DeepgramApiHttpResponse list(RequestOptions requestOptions) { + return list(ModelsListRequest.builder().build(), requestOptions); + } + + /** + * Returns metadata on all the latest public models. To retrieve custom models, use Get Project Models. + */ + public DeepgramApiHttpResponse list(ModelsListRequest request) { + return list(request, null); + } + + /** + * Returns metadata on all the latest public models. To retrieve custom models, use Get Project Models. + */ + public DeepgramApiHttpResponse list( + ModelsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/models"); + if (request.getIncludeOutdated().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "include_outdated", request.getIncludeOutdated().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListModelsV1Response.class), response); + } + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new DeepgramApiException("Network error executing HTTP request", e); + } + } + + /** + * Returns metadata for a specific public model + */ + public DeepgramApiHttpResponse get(String modelId) { + return get(modelId, null); + } + + /** + * Returns metadata for a specific public model + */ + public DeepgramApiHttpResponse get(String modelId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/models") + .addPathSegment(modelId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetModelV1Response.class), response); + } + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new DeepgramApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/models/requests/ModelsListRequest.java b/src/main/java/com/deepgram/resources/manage/v1/models/requests/ModelsListRequest.java new file mode 100644 index 0000000..d5e17bc --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/models/requests/ModelsListRequest.java @@ -0,0 +1,111 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.models.requests; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ModelsListRequest.Builder.class) +public final class ModelsListRequest { + private final Optional includeOutdated; + + private final Map additionalProperties; + + private ModelsListRequest(Optional includeOutdated, Map additionalProperties) { + this.includeOutdated = includeOutdated; + this.additionalProperties = additionalProperties; + } + + /** + * @return

non-latest versions of models

+ */ + @JsonIgnore + public Optional getIncludeOutdated() { + return includeOutdated; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ModelsListRequest && equalTo((ModelsListRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ModelsListRequest other) { + return includeOutdated.equals(other.includeOutdated); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.includeOutdated); + } + + @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 includeOutdated = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ModelsListRequest other) { + includeOutdated(other.getIncludeOutdated()); + return this; + } + + /** + *

returns non-latest versions of models

+ */ + @JsonSetter(value = "include_outdated", nulls = Nulls.SKIP) + public Builder includeOutdated(Optional includeOutdated) { + this.includeOutdated = includeOutdated; + return this; + } + + public Builder includeOutdated(Boolean includeOutdated) { + this.includeOutdated = Optional.ofNullable(includeOutdated); + return this; + } + + public ModelsListRequest build() { + return new ModelsListRequest(includeOutdated, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/AsyncProjectsClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/AsyncProjectsClient.java new file mode 100644 index 0000000..08ae851 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/AsyncProjectsClient.java @@ -0,0 +1,183 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.RequestOptions; +import com.deepgram.core.Suppliers; +import com.deepgram.resources.manage.v1.projects.billing.AsyncBillingClient; +import com.deepgram.resources.manage.v1.projects.keys.AsyncKeysClient; +import com.deepgram.resources.manage.v1.projects.members.AsyncMembersClient; +import com.deepgram.resources.manage.v1.projects.models.AsyncModelsClient; +import com.deepgram.resources.manage.v1.projects.requests.AsyncRequestsClient; +import com.deepgram.resources.manage.v1.projects.requests.ProjectsGetRequest; +import com.deepgram.resources.manage.v1.projects.requests.UpdateProjectV1Request; +import com.deepgram.resources.manage.v1.projects.usage.AsyncUsageClient; +import com.deepgram.types.DeleteProjectV1Response; +import com.deepgram.types.GetProjectV1Response; +import com.deepgram.types.LeaveProjectV1Response; +import com.deepgram.types.ListProjectsV1Response; +import com.deepgram.types.UpdateProjectV1Response; +import java.util.concurrent.CompletableFuture; +import java.util.function.Supplier; + +public class AsyncProjectsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawProjectsClient rawClient; + + protected final Supplier keysClient; + + protected final Supplier membersClient; + + protected final Supplier modelsClient; + + protected final Supplier requestsClient; + + protected final Supplier usageClient; + + protected final Supplier billingClient; + + public AsyncProjectsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawProjectsClient(clientOptions); + this.keysClient = Suppliers.memoize(() -> new AsyncKeysClient(clientOptions)); + this.membersClient = Suppliers.memoize(() -> new AsyncMembersClient(clientOptions)); + this.modelsClient = Suppliers.memoize(() -> new AsyncModelsClient(clientOptions)); + this.requestsClient = Suppliers.memoize(() -> new AsyncRequestsClient(clientOptions)); + this.usageClient = Suppliers.memoize(() -> new AsyncUsageClient(clientOptions)); + this.billingClient = Suppliers.memoize(() -> new AsyncBillingClient(clientOptions)); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawProjectsClient withRawResponse() { + return this.rawClient; + } + + /** + * Retrieves basic information about the projects associated with the API key + */ + public CompletableFuture list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + /** + * Retrieves basic information about the projects associated with the API key + */ + public CompletableFuture list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves information about the specified project + */ + public CompletableFuture get(String projectId) { + return this.rawClient.get(projectId).thenApply(response -> response.body()); + } + + /** + * Retrieves information about the specified project + */ + public CompletableFuture get(String projectId, RequestOptions requestOptions) { + return this.rawClient.get(projectId, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves information about the specified project + */ + public CompletableFuture get(String projectId, ProjectsGetRequest request) { + return this.rawClient.get(projectId, request).thenApply(response -> response.body()); + } + + /** + * Retrieves information about the specified project + */ + public CompletableFuture get( + String projectId, ProjectsGetRequest request, RequestOptions requestOptions) { + return this.rawClient.get(projectId, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Deletes the specified project + */ + public CompletableFuture delete(String projectId) { + return this.rawClient.delete(projectId).thenApply(response -> response.body()); + } + + /** + * Deletes the specified project + */ + public CompletableFuture delete(String projectId, RequestOptions requestOptions) { + return this.rawClient.delete(projectId, requestOptions).thenApply(response -> response.body()); + } + + /** + * Updates the name or other properties of an existing project + */ + public CompletableFuture update(String projectId) { + return this.rawClient.update(projectId).thenApply(response -> response.body()); + } + + /** + * Updates the name or other properties of an existing project + */ + public CompletableFuture update(String projectId, RequestOptions requestOptions) { + return this.rawClient.update(projectId, requestOptions).thenApply(response -> response.body()); + } + + /** + * Updates the name or other properties of an existing project + */ + public CompletableFuture update(String projectId, UpdateProjectV1Request request) { + return this.rawClient.update(projectId, request).thenApply(response -> response.body()); + } + + /** + * Updates the name or other properties of an existing project + */ + public CompletableFuture update( + String projectId, UpdateProjectV1Request request, RequestOptions requestOptions) { + return this.rawClient.update(projectId, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Removes the authenticated account from the specific project + */ + public CompletableFuture leave(String projectId) { + return this.rawClient.leave(projectId).thenApply(response -> response.body()); + } + + /** + * Removes the authenticated account from the specific project + */ + public CompletableFuture leave(String projectId, RequestOptions requestOptions) { + return this.rawClient.leave(projectId, requestOptions).thenApply(response -> response.body()); + } + + public AsyncKeysClient keys() { + return this.keysClient.get(); + } + + public AsyncMembersClient members() { + return this.membersClient.get(); + } + + public AsyncModelsClient models() { + return this.modelsClient.get(); + } + + public AsyncRequestsClient requests() { + return this.requestsClient.get(); + } + + public AsyncUsageClient usage() { + return this.usageClient.get(); + } + + public AsyncBillingClient billing() { + return this.billingClient.get(); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/AsyncRawProjectsClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/AsyncRawProjectsClient.java new file mode 100644 index 0000000..865a04b --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/AsyncRawProjectsClient.java @@ -0,0 +1,434 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.DeepgramApiApiException; +import com.deepgram.core.DeepgramApiException; +import com.deepgram.core.DeepgramApiHttpResponse; +import com.deepgram.core.MediaTypes; +import com.deepgram.core.ObjectMappers; +import com.deepgram.core.QueryStringMapper; +import com.deepgram.core.RequestOptions; +import com.deepgram.errors.BadRequestError; +import com.deepgram.resources.manage.v1.projects.requests.ProjectsGetRequest; +import com.deepgram.resources.manage.v1.projects.requests.UpdateProjectV1Request; +import com.deepgram.types.DeleteProjectV1Response; +import com.deepgram.types.GetProjectV1Response; +import com.deepgram.types.LeaveProjectV1Response; +import com.deepgram.types.ListProjectsV1Response; +import com.deepgram.types.UpdateProjectV1Response; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawProjectsClient { + protected final ClientOptions clientOptions; + + public AsyncRawProjectsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Retrieves basic information about the projects associated with the API key + */ + public CompletableFuture> list() { + return list(null); + } + + /** + * Retrieves basic information about the projects associated with the API key + */ + public CompletableFuture> list(RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListProjectsV1Response.class), + response)); + return; + } + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves information about the specified project + */ + public CompletableFuture> get(String projectId) { + return get(projectId, ProjectsGetRequest.builder().build()); + } + + /** + * Retrieves information about the specified project + */ + public CompletableFuture> get( + String projectId, RequestOptions requestOptions) { + return get(projectId, ProjectsGetRequest.builder().build(), requestOptions); + } + + /** + * Retrieves information about the specified project + */ + public CompletableFuture> get( + String projectId, ProjectsGetRequest request) { + return get(projectId, request, null); + } + + /** + * Retrieves information about the specified project + */ + public CompletableFuture> get( + String projectId, ProjectsGetRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId); + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getPage().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "page", request.getPage().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetProjectV1Response.class), + response)); + return; + } + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Deletes the specified project + */ + public CompletableFuture> delete(String projectId) { + return delete(projectId, null); + } + + /** + * Deletes the specified project + */ + public CompletableFuture> delete( + String projectId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteProjectV1Response.class), + response)); + return; + } + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Updates the name or other properties of an existing project + */ + public CompletableFuture> update(String projectId) { + return update(projectId, UpdateProjectV1Request.builder().build()); + } + + /** + * Updates the name or other properties of an existing project + */ + public CompletableFuture> update( + String projectId, RequestOptions requestOptions) { + return update(projectId, UpdateProjectV1Request.builder().build(), requestOptions); + } + + /** + * Updates the name or other properties of an existing project + */ + public CompletableFuture> update( + String projectId, UpdateProjectV1Request request) { + return update(projectId, request, null); + } + + /** + * Updates the name or other properties of an existing project + */ + public CompletableFuture> update( + String projectId, UpdateProjectV1Request request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new DeepgramApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdateProjectV1Response.class), + response)); + return; + } + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Removes the authenticated account from the specific project + */ + public CompletableFuture> leave(String projectId) { + return leave(projectId, null); + } + + /** + * Removes the authenticated account from the specific project + */ + public CompletableFuture> leave( + String projectId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("leave"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, LeaveProjectV1Response.class), + response)); + return; + } + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/ProjectsClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/ProjectsClient.java new file mode 100644 index 0000000..770081c --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/ProjectsClient.java @@ -0,0 +1,181 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.RequestOptions; +import com.deepgram.core.Suppliers; +import com.deepgram.resources.manage.v1.projects.billing.BillingClient; +import com.deepgram.resources.manage.v1.projects.keys.KeysClient; +import com.deepgram.resources.manage.v1.projects.members.MembersClient; +import com.deepgram.resources.manage.v1.projects.models.ModelsClient; +import com.deepgram.resources.manage.v1.projects.requests.ProjectsGetRequest; +import com.deepgram.resources.manage.v1.projects.requests.RequestsClient; +import com.deepgram.resources.manage.v1.projects.requests.UpdateProjectV1Request; +import com.deepgram.resources.manage.v1.projects.usage.UsageClient; +import com.deepgram.types.DeleteProjectV1Response; +import com.deepgram.types.GetProjectV1Response; +import com.deepgram.types.LeaveProjectV1Response; +import com.deepgram.types.ListProjectsV1Response; +import com.deepgram.types.UpdateProjectV1Response; +import java.util.function.Supplier; + +public class ProjectsClient { + protected final ClientOptions clientOptions; + + private final RawProjectsClient rawClient; + + protected final Supplier keysClient; + + protected final Supplier membersClient; + + protected final Supplier modelsClient; + + protected final Supplier requestsClient; + + protected final Supplier usageClient; + + protected final Supplier billingClient; + + public ProjectsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawProjectsClient(clientOptions); + this.keysClient = Suppliers.memoize(() -> new KeysClient(clientOptions)); + this.membersClient = Suppliers.memoize(() -> new MembersClient(clientOptions)); + this.modelsClient = Suppliers.memoize(() -> new ModelsClient(clientOptions)); + this.requestsClient = Suppliers.memoize(() -> new RequestsClient(clientOptions)); + this.usageClient = Suppliers.memoize(() -> new UsageClient(clientOptions)); + this.billingClient = Suppliers.memoize(() -> new BillingClient(clientOptions)); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawProjectsClient withRawResponse() { + return this.rawClient; + } + + /** + * Retrieves basic information about the projects associated with the API key + */ + public ListProjectsV1Response list() { + return this.rawClient.list().body(); + } + + /** + * Retrieves basic information about the projects associated with the API key + */ + public ListProjectsV1Response list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + /** + * Retrieves information about the specified project + */ + public GetProjectV1Response get(String projectId) { + return this.rawClient.get(projectId).body(); + } + + /** + * Retrieves information about the specified project + */ + public GetProjectV1Response get(String projectId, RequestOptions requestOptions) { + return this.rawClient.get(projectId, requestOptions).body(); + } + + /** + * Retrieves information about the specified project + */ + public GetProjectV1Response get(String projectId, ProjectsGetRequest request) { + return this.rawClient.get(projectId, request).body(); + } + + /** + * Retrieves information about the specified project + */ + public GetProjectV1Response get(String projectId, ProjectsGetRequest request, RequestOptions requestOptions) { + return this.rawClient.get(projectId, request, requestOptions).body(); + } + + /** + * Deletes the specified project + */ + public DeleteProjectV1Response delete(String projectId) { + return this.rawClient.delete(projectId).body(); + } + + /** + * Deletes the specified project + */ + public DeleteProjectV1Response delete(String projectId, RequestOptions requestOptions) { + return this.rawClient.delete(projectId, requestOptions).body(); + } + + /** + * Updates the name or other properties of an existing project + */ + public UpdateProjectV1Response update(String projectId) { + return this.rawClient.update(projectId).body(); + } + + /** + * Updates the name or other properties of an existing project + */ + public UpdateProjectV1Response update(String projectId, RequestOptions requestOptions) { + return this.rawClient.update(projectId, requestOptions).body(); + } + + /** + * Updates the name or other properties of an existing project + */ + public UpdateProjectV1Response update(String projectId, UpdateProjectV1Request request) { + return this.rawClient.update(projectId, request).body(); + } + + /** + * Updates the name or other properties of an existing project + */ + public UpdateProjectV1Response update( + String projectId, UpdateProjectV1Request request, RequestOptions requestOptions) { + return this.rawClient.update(projectId, request, requestOptions).body(); + } + + /** + * Removes the authenticated account from the specific project + */ + public LeaveProjectV1Response leave(String projectId) { + return this.rawClient.leave(projectId).body(); + } + + /** + * Removes the authenticated account from the specific project + */ + public LeaveProjectV1Response leave(String projectId, RequestOptions requestOptions) { + return this.rawClient.leave(projectId, requestOptions).body(); + } + + public KeysClient keys() { + return this.keysClient.get(); + } + + public MembersClient members() { + return this.membersClient.get(); + } + + public ModelsClient models() { + return this.modelsClient.get(); + } + + public RequestsClient requests() { + return this.requestsClient.get(); + } + + public UsageClient usage() { + return this.usageClient.get(); + } + + public BillingClient billing() { + return this.billingClient.get(); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/RawProjectsClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/RawProjectsClient.java new file mode 100644 index 0000000..30eba5d --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/RawProjectsClient.java @@ -0,0 +1,353 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.DeepgramApiApiException; +import com.deepgram.core.DeepgramApiException; +import com.deepgram.core.DeepgramApiHttpResponse; +import com.deepgram.core.MediaTypes; +import com.deepgram.core.ObjectMappers; +import com.deepgram.core.QueryStringMapper; +import com.deepgram.core.RequestOptions; +import com.deepgram.errors.BadRequestError; +import com.deepgram.resources.manage.v1.projects.requests.ProjectsGetRequest; +import com.deepgram.resources.manage.v1.projects.requests.UpdateProjectV1Request; +import com.deepgram.types.DeleteProjectV1Response; +import com.deepgram.types.GetProjectV1Response; +import com.deepgram.types.LeaveProjectV1Response; +import com.deepgram.types.ListProjectsV1Response; +import com.deepgram.types.UpdateProjectV1Response; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawProjectsClient { + protected final ClientOptions clientOptions; + + public RawProjectsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Retrieves basic information about the projects associated with the API key + */ + public DeepgramApiHttpResponse list() { + return list(null); + } + + /** + * Retrieves basic information about the projects associated with the API key + */ + public DeepgramApiHttpResponse list(RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListProjectsV1Response.class), + response); + } + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new DeepgramApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves information about the specified project + */ + public DeepgramApiHttpResponse get(String projectId) { + return get(projectId, ProjectsGetRequest.builder().build()); + } + + /** + * Retrieves information about the specified project + */ + public DeepgramApiHttpResponse get(String projectId, RequestOptions requestOptions) { + return get(projectId, ProjectsGetRequest.builder().build(), requestOptions); + } + + /** + * Retrieves information about the specified project + */ + public DeepgramApiHttpResponse get(String projectId, ProjectsGetRequest request) { + return get(projectId, request, null); + } + + /** + * Retrieves information about the specified project + */ + public DeepgramApiHttpResponse get( + String projectId, ProjectsGetRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId); + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getPage().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "page", request.getPage().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetProjectV1Response.class), response); + } + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new DeepgramApiException("Network error executing HTTP request", e); + } + } + + /** + * Deletes the specified project + */ + public DeepgramApiHttpResponse delete(String projectId) { + return delete(projectId, null); + } + + /** + * Deletes the specified project + */ + public DeepgramApiHttpResponse delete(String projectId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteProjectV1Response.class), + response); + } + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new DeepgramApiException("Network error executing HTTP request", e); + } + } + + /** + * Updates the name or other properties of an existing project + */ + public DeepgramApiHttpResponse update(String projectId) { + return update(projectId, UpdateProjectV1Request.builder().build()); + } + + /** + * Updates the name or other properties of an existing project + */ + public DeepgramApiHttpResponse update(String projectId, RequestOptions requestOptions) { + return update(projectId, UpdateProjectV1Request.builder().build(), requestOptions); + } + + /** + * Updates the name or other properties of an existing project + */ + public DeepgramApiHttpResponse update(String projectId, UpdateProjectV1Request request) { + return update(projectId, request, null); + } + + /** + * Updates the name or other properties of an existing project + */ + public DeepgramApiHttpResponse update( + String projectId, UpdateProjectV1Request request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new DeepgramApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdateProjectV1Response.class), + response); + } + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new DeepgramApiException("Network error executing HTTP request", e); + } + } + + /** + * Removes the authenticated account from the specific project + */ + public DeepgramApiHttpResponse leave(String projectId) { + return leave(projectId, null); + } + + /** + * Removes the authenticated account from the specific project + */ + public DeepgramApiHttpResponse leave(String projectId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("leave"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, LeaveProjectV1Response.class), + response); + } + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new DeepgramApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/billing/AsyncBillingClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/billing/AsyncBillingClient.java new file mode 100644 index 0000000..fcc8ddb --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/billing/AsyncBillingClient.java @@ -0,0 +1,48 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.billing; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.Suppliers; +import com.deepgram.resources.manage.v1.projects.billing.balances.AsyncBalancesClient; +import com.deepgram.resources.manage.v1.projects.billing.breakdown.AsyncBreakdownClient; +import com.deepgram.resources.manage.v1.projects.billing.fields.AsyncFieldsClient; +import com.deepgram.resources.manage.v1.projects.billing.purchases.AsyncPurchasesClient; +import java.util.function.Supplier; + +public class AsyncBillingClient { + protected final ClientOptions clientOptions; + + protected final Supplier balancesClient; + + protected final Supplier breakdownClient; + + protected final Supplier fieldsClient; + + protected final Supplier purchasesClient; + + public AsyncBillingClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.balancesClient = Suppliers.memoize(() -> new AsyncBalancesClient(clientOptions)); + this.breakdownClient = Suppliers.memoize(() -> new AsyncBreakdownClient(clientOptions)); + this.fieldsClient = Suppliers.memoize(() -> new AsyncFieldsClient(clientOptions)); + this.purchasesClient = Suppliers.memoize(() -> new AsyncPurchasesClient(clientOptions)); + } + + public AsyncBalancesClient balances() { + return this.balancesClient.get(); + } + + public AsyncBreakdownClient breakdown() { + return this.breakdownClient.get(); + } + + public AsyncFieldsClient fields() { + return this.fieldsClient.get(); + } + + public AsyncPurchasesClient purchases() { + return this.purchasesClient.get(); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/billing/BillingClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/billing/BillingClient.java new file mode 100644 index 0000000..333e335 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/billing/BillingClient.java @@ -0,0 +1,48 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.billing; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.Suppliers; +import com.deepgram.resources.manage.v1.projects.billing.balances.BalancesClient; +import com.deepgram.resources.manage.v1.projects.billing.breakdown.BreakdownClient; +import com.deepgram.resources.manage.v1.projects.billing.fields.FieldsClient; +import com.deepgram.resources.manage.v1.projects.billing.purchases.PurchasesClient; +import java.util.function.Supplier; + +public class BillingClient { + protected final ClientOptions clientOptions; + + protected final Supplier balancesClient; + + protected final Supplier breakdownClient; + + protected final Supplier fieldsClient; + + protected final Supplier purchasesClient; + + public BillingClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.balancesClient = Suppliers.memoize(() -> new BalancesClient(clientOptions)); + this.breakdownClient = Suppliers.memoize(() -> new BreakdownClient(clientOptions)); + this.fieldsClient = Suppliers.memoize(() -> new FieldsClient(clientOptions)); + this.purchasesClient = Suppliers.memoize(() -> new PurchasesClient(clientOptions)); + } + + public BalancesClient balances() { + return this.balancesClient.get(); + } + + public BreakdownClient breakdown() { + return this.breakdownClient.get(); + } + + public FieldsClient fields() { + return this.fieldsClient.get(); + } + + public PurchasesClient purchases() { + return this.purchasesClient.get(); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/billing/balances/AsyncBalancesClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/billing/balances/AsyncBalancesClient.java new file mode 100644 index 0000000..5320901 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/billing/balances/AsyncBalancesClient.java @@ -0,0 +1,57 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.billing.balances; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.RequestOptions; +import com.deepgram.types.GetProjectBalanceV1Response; +import com.deepgram.types.ListProjectBalancesV1Response; +import java.util.concurrent.CompletableFuture; + +public class AsyncBalancesClient { + protected final ClientOptions clientOptions; + + private final AsyncRawBalancesClient rawClient; + + public AsyncBalancesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawBalancesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawBalancesClient withRawResponse() { + return this.rawClient; + } + + /** + * Generates a list of outstanding balances for the specified project + */ + public CompletableFuture list(String projectId) { + return this.rawClient.list(projectId).thenApply(response -> response.body()); + } + + /** + * Generates a list of outstanding balances for the specified project + */ + public CompletableFuture list(String projectId, RequestOptions requestOptions) { + return this.rawClient.list(projectId, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves details about the specified balance + */ + public CompletableFuture get(String projectId, String balanceId) { + return this.rawClient.get(projectId, balanceId).thenApply(response -> response.body()); + } + + /** + * Retrieves details about the specified balance + */ + public CompletableFuture get( + String projectId, String balanceId, RequestOptions requestOptions) { + return this.rawClient.get(projectId, balanceId, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/billing/balances/AsyncRawBalancesClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/billing/balances/AsyncRawBalancesClient.java new file mode 100644 index 0000000..53a7ec4 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/billing/balances/AsyncRawBalancesClient.java @@ -0,0 +1,178 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.billing.balances; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.DeepgramApiApiException; +import com.deepgram.core.DeepgramApiException; +import com.deepgram.core.DeepgramApiHttpResponse; +import com.deepgram.core.ObjectMappers; +import com.deepgram.core.RequestOptions; +import com.deepgram.errors.BadRequestError; +import com.deepgram.types.GetProjectBalanceV1Response; +import com.deepgram.types.ListProjectBalancesV1Response; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawBalancesClient { + protected final ClientOptions clientOptions; + + public AsyncRawBalancesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Generates a list of outstanding balances for the specified project + */ + public CompletableFuture> list(String projectId) { + return list(projectId, null); + } + + /** + * Generates a list of outstanding balances for the specified project + */ + public CompletableFuture> list( + String projectId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("balances"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListProjectBalancesV1Response.class), + response)); + return; + } + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves details about the specified balance + */ + public CompletableFuture> get( + String projectId, String balanceId) { + return get(projectId, balanceId, null); + } + + /** + * Retrieves details about the specified balance + */ + public CompletableFuture> get( + String projectId, String balanceId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("balances") + .addPathSegment(balanceId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, GetProjectBalanceV1Response.class), + response)); + return; + } + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/billing/balances/BalancesClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/billing/balances/BalancesClient.java new file mode 100644 index 0000000..3ff4bcf --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/billing/balances/BalancesClient.java @@ -0,0 +1,55 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.billing.balances; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.RequestOptions; +import com.deepgram.types.GetProjectBalanceV1Response; +import com.deepgram.types.ListProjectBalancesV1Response; + +public class BalancesClient { + protected final ClientOptions clientOptions; + + private final RawBalancesClient rawClient; + + public BalancesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawBalancesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawBalancesClient withRawResponse() { + return this.rawClient; + } + + /** + * Generates a list of outstanding balances for the specified project + */ + public ListProjectBalancesV1Response list(String projectId) { + return this.rawClient.list(projectId).body(); + } + + /** + * Generates a list of outstanding balances for the specified project + */ + public ListProjectBalancesV1Response list(String projectId, RequestOptions requestOptions) { + return this.rawClient.list(projectId, requestOptions).body(); + } + + /** + * Retrieves details about the specified balance + */ + public GetProjectBalanceV1Response get(String projectId, String balanceId) { + return this.rawClient.get(projectId, balanceId).body(); + } + + /** + * Retrieves details about the specified balance + */ + public GetProjectBalanceV1Response get(String projectId, String balanceId, RequestOptions requestOptions) { + return this.rawClient.get(projectId, balanceId, requestOptions).body(); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/billing/balances/RawBalancesClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/billing/balances/RawBalancesClient.java new file mode 100644 index 0000000..94d997e --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/billing/balances/RawBalancesClient.java @@ -0,0 +1,143 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.billing.balances; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.DeepgramApiApiException; +import com.deepgram.core.DeepgramApiException; +import com.deepgram.core.DeepgramApiHttpResponse; +import com.deepgram.core.ObjectMappers; +import com.deepgram.core.RequestOptions; +import com.deepgram.errors.BadRequestError; +import com.deepgram.types.GetProjectBalanceV1Response; +import com.deepgram.types.ListProjectBalancesV1Response; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawBalancesClient { + protected final ClientOptions clientOptions; + + public RawBalancesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Generates a list of outstanding balances for the specified project + */ + public DeepgramApiHttpResponse list(String projectId) { + return list(projectId, null); + } + + /** + * Generates a list of outstanding balances for the specified project + */ + public DeepgramApiHttpResponse list( + String projectId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("balances"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListProjectBalancesV1Response.class), + response); + } + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new DeepgramApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves details about the specified balance + */ + public DeepgramApiHttpResponse get(String projectId, String balanceId) { + return get(projectId, balanceId, null); + } + + /** + * Retrieves details about the specified balance + */ + public DeepgramApiHttpResponse get( + String projectId, String balanceId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("balances") + .addPathSegment(balanceId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetProjectBalanceV1Response.class), + response); + } + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new DeepgramApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/billing/breakdown/AsyncBreakdownClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/billing/breakdown/AsyncBreakdownClient.java new file mode 100644 index 0000000..a916a5a --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/billing/breakdown/AsyncBreakdownClient.java @@ -0,0 +1,57 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.billing.breakdown; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.RequestOptions; +import com.deepgram.resources.manage.v1.projects.billing.breakdown.requests.BreakdownListRequest; +import com.deepgram.types.BillingBreakdownV1Response; +import java.util.concurrent.CompletableFuture; + +public class AsyncBreakdownClient { + protected final ClientOptions clientOptions; + + private final AsyncRawBreakdownClient rawClient; + + public AsyncBreakdownClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawBreakdownClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawBreakdownClient withRawResponse() { + return this.rawClient; + } + + /** + * Retrieves the billing summary for a specific project, with various filter options or by grouping options. + */ + public CompletableFuture list(String projectId) { + return this.rawClient.list(projectId).thenApply(response -> response.body()); + } + + /** + * Retrieves the billing summary for a specific project, with various filter options or by grouping options. + */ + public CompletableFuture list(String projectId, RequestOptions requestOptions) { + return this.rawClient.list(projectId, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the billing summary for a specific project, with various filter options or by grouping options. + */ + public CompletableFuture list(String projectId, BreakdownListRequest request) { + return this.rawClient.list(projectId, request).thenApply(response -> response.body()); + } + + /** + * Retrieves the billing summary for a specific project, with various filter options or by grouping options. + */ + public CompletableFuture list( + String projectId, BreakdownListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(projectId, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/billing/breakdown/AsyncRawBreakdownClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/billing/breakdown/AsyncRawBreakdownClient.java new file mode 100644 index 0000000..2f2cd67 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/billing/breakdown/AsyncRawBreakdownClient.java @@ -0,0 +1,149 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.billing.breakdown; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.DeepgramApiApiException; +import com.deepgram.core.DeepgramApiException; +import com.deepgram.core.DeepgramApiHttpResponse; +import com.deepgram.core.ObjectMappers; +import com.deepgram.core.QueryStringMapper; +import com.deepgram.core.RequestOptions; +import com.deepgram.errors.BadRequestError; +import com.deepgram.resources.manage.v1.projects.billing.breakdown.requests.BreakdownListRequest; +import com.deepgram.types.BillingBreakdownV1Response; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawBreakdownClient { + protected final ClientOptions clientOptions; + + public AsyncRawBreakdownClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Retrieves the billing summary for a specific project, with various filter options or by grouping options. + */ + public CompletableFuture> list(String projectId) { + return list(projectId, BreakdownListRequest.builder().build()); + } + + /** + * Retrieves the billing summary for a specific project, with various filter options or by grouping options. + */ + public CompletableFuture> list( + String projectId, RequestOptions requestOptions) { + return list(projectId, BreakdownListRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the billing summary for a specific project, with various filter options or by grouping options. + */ + public CompletableFuture> list( + String projectId, BreakdownListRequest request) { + return list(projectId, request, null); + } + + /** + * Retrieves the billing summary for a specific project, with various filter options or by grouping options. + */ + public CompletableFuture> list( + String projectId, BreakdownListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("billing") + .addPathSegments("breakdown"); + if (request.getStart().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "start", request.getStart().get(), false); + } + if (request.getEnd().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "end", request.getEnd().get(), false); + } + if (request.getAccessor().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "accessor", request.getAccessor().get(), false); + } + if (request.getDeployment().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "deployment", request.getDeployment().get(), false); + } + if (request.getTag().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "tag", request.getTag().get(), false); + } + if (request.getLineItem().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "line_item", request.getLineItem().get(), false); + } + if (request.getGrouping().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "grouping", request.getGrouping().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, BillingBreakdownV1Response.class), + response)); + return; + } + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/billing/breakdown/BreakdownClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/billing/breakdown/BreakdownClient.java new file mode 100644 index 0000000..ba407e0 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/billing/breakdown/BreakdownClient.java @@ -0,0 +1,56 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.billing.breakdown; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.RequestOptions; +import com.deepgram.resources.manage.v1.projects.billing.breakdown.requests.BreakdownListRequest; +import com.deepgram.types.BillingBreakdownV1Response; + +public class BreakdownClient { + protected final ClientOptions clientOptions; + + private final RawBreakdownClient rawClient; + + public BreakdownClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawBreakdownClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawBreakdownClient withRawResponse() { + return this.rawClient; + } + + /** + * Retrieves the billing summary for a specific project, with various filter options or by grouping options. + */ + public BillingBreakdownV1Response list(String projectId) { + return this.rawClient.list(projectId).body(); + } + + /** + * Retrieves the billing summary for a specific project, with various filter options or by grouping options. + */ + public BillingBreakdownV1Response list(String projectId, RequestOptions requestOptions) { + return this.rawClient.list(projectId, requestOptions).body(); + } + + /** + * Retrieves the billing summary for a specific project, with various filter options or by grouping options. + */ + public BillingBreakdownV1Response list(String projectId, BreakdownListRequest request) { + return this.rawClient.list(projectId, request).body(); + } + + /** + * Retrieves the billing summary for a specific project, with various filter options or by grouping options. + */ + public BillingBreakdownV1Response list( + String projectId, BreakdownListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(projectId, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/billing/breakdown/RawBreakdownClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/billing/breakdown/RawBreakdownClient.java new file mode 100644 index 0000000..a1c21d3 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/billing/breakdown/RawBreakdownClient.java @@ -0,0 +1,128 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.billing.breakdown; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.DeepgramApiApiException; +import com.deepgram.core.DeepgramApiException; +import com.deepgram.core.DeepgramApiHttpResponse; +import com.deepgram.core.ObjectMappers; +import com.deepgram.core.QueryStringMapper; +import com.deepgram.core.RequestOptions; +import com.deepgram.errors.BadRequestError; +import com.deepgram.resources.manage.v1.projects.billing.breakdown.requests.BreakdownListRequest; +import com.deepgram.types.BillingBreakdownV1Response; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawBreakdownClient { + protected final ClientOptions clientOptions; + + public RawBreakdownClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Retrieves the billing summary for a specific project, with various filter options or by grouping options. + */ + public DeepgramApiHttpResponse list(String projectId) { + return list(projectId, BreakdownListRequest.builder().build()); + } + + /** + * Retrieves the billing summary for a specific project, with various filter options or by grouping options. + */ + public DeepgramApiHttpResponse list(String projectId, RequestOptions requestOptions) { + return list(projectId, BreakdownListRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the billing summary for a specific project, with various filter options or by grouping options. + */ + public DeepgramApiHttpResponse list(String projectId, BreakdownListRequest request) { + return list(projectId, request, null); + } + + /** + * Retrieves the billing summary for a specific project, with various filter options or by grouping options. + */ + public DeepgramApiHttpResponse list( + String projectId, BreakdownListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("billing") + .addPathSegments("breakdown"); + if (request.getStart().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "start", request.getStart().get(), false); + } + if (request.getEnd().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "end", request.getEnd().get(), false); + } + if (request.getAccessor().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "accessor", request.getAccessor().get(), false); + } + if (request.getDeployment().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "deployment", request.getDeployment().get(), false); + } + if (request.getTag().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "tag", request.getTag().get(), false); + } + if (request.getLineItem().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "line_item", request.getLineItem().get(), false); + } + if (request.getGrouping().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "grouping", request.getGrouping().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, BillingBreakdownV1Response.class), + response); + } + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new DeepgramApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/billing/breakdown/requests/BreakdownListRequest.java b/src/main/java/com/deepgram/resources/manage/v1/projects/billing/breakdown/requests/BreakdownListRequest.java new file mode 100644 index 0000000..eb39f2b --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/billing/breakdown/requests/BreakdownListRequest.java @@ -0,0 +1,304 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.billing.breakdown.requests; + +import com.deepgram.core.ObjectMappers; +import com.deepgram.resources.manage.v1.projects.billing.breakdown.types.BreakdownListRequestDeployment; +import com.deepgram.resources.manage.v1.projects.billing.breakdown.types.BreakdownListRequestGroupingItem; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.Collections; +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 = BreakdownListRequest.Builder.class) +public final class BreakdownListRequest { + private final Optional> grouping; + + private final Optional start; + + private final Optional end; + + private final Optional accessor; + + private final Optional deployment; + + private final Optional tag; + + private final Optional lineItem; + + private final Map additionalProperties; + + private BreakdownListRequest( + Optional> grouping, + Optional start, + Optional end, + Optional accessor, + Optional deployment, + Optional tag, + Optional lineItem, + Map additionalProperties) { + this.grouping = grouping; + this.start = start; + this.end = end; + this.accessor = accessor; + this.deployment = deployment; + this.tag = tag; + this.lineItem = lineItem; + this.additionalProperties = additionalProperties; + } + + /** + * @return Group billing breakdown by one or more dimensions (accessor, deployment, line_item, tags) + */ + @JsonIgnore + public Optional> getGrouping() { + return grouping; + } + + /** + * @return Start date of the requested date range. Format accepted is YYYY-MM-DD + */ + @JsonIgnore + public Optional getStart() { + return start; + } + + /** + * @return End date of the requested date range. Format accepted is YYYY-MM-DD + */ + @JsonIgnore + public Optional getEnd() { + return end; + } + + /** + * @return Filter for requests where a specific accessor was used + */ + @JsonIgnore + public Optional getAccessor() { + return accessor; + } + + /** + * @return Filter for requests where a specific deployment was used + */ + @JsonIgnore + public Optional getDeployment() { + return deployment; + } + + /** + * @return Filter for requests where a specific tag was used + */ + @JsonIgnore + public Optional getTag() { + return tag; + } + + /** + * @return Filter requests by line item (e.g. streaming::nova-3) + */ + @JsonIgnore + public Optional getLineItem() { + return lineItem; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BreakdownListRequest && equalTo((BreakdownListRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(BreakdownListRequest other) { + return grouping.equals(other.grouping) + && start.equals(other.start) + && end.equals(other.end) + && accessor.equals(other.accessor) + && deployment.equals(other.deployment) + && tag.equals(other.tag) + && lineItem.equals(other.lineItem); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.grouping, this.start, this.end, this.accessor, this.deployment, this.tag, this.lineItem); + } + + @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> grouping = Optional.empty(); + + private Optional start = Optional.empty(); + + private Optional end = Optional.empty(); + + private Optional accessor = Optional.empty(); + + private Optional deployment = Optional.empty(); + + private Optional tag = Optional.empty(); + + private Optional lineItem = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(BreakdownListRequest other) { + grouping(other.getGrouping()); + start(other.getStart()); + end(other.getEnd()); + accessor(other.getAccessor()); + deployment(other.getDeployment()); + tag(other.getTag()); + lineItem(other.getLineItem()); + return this; + } + + /** + *

Group billing breakdown by one or more dimensions (accessor, deployment, line_item, tags)

+ */ + @JsonSetter(value = "grouping", nulls = Nulls.SKIP) + public Builder grouping(Optional> grouping) { + this.grouping = grouping; + return this; + } + + public Builder grouping(List grouping) { + this.grouping = Optional.ofNullable(grouping); + return this; + } + + public Builder grouping(BreakdownListRequestGroupingItem grouping) { + this.grouping = Optional.of(Collections.singletonList(grouping)); + return this; + } + + /** + *

Start date of the requested date range. Format accepted is YYYY-MM-DD

+ */ + @JsonSetter(value = "start", nulls = Nulls.SKIP) + public Builder start(Optional start) { + this.start = start; + return this; + } + + public Builder start(String start) { + this.start = Optional.ofNullable(start); + return this; + } + + /** + *

End date of the requested date range. Format accepted is YYYY-MM-DD

+ */ + @JsonSetter(value = "end", nulls = Nulls.SKIP) + public Builder end(Optional end) { + this.end = end; + return this; + } + + public Builder end(String end) { + this.end = Optional.ofNullable(end); + return this; + } + + /** + *

Filter for requests where a specific accessor was used

+ */ + @JsonSetter(value = "accessor", nulls = Nulls.SKIP) + public Builder accessor(Optional accessor) { + this.accessor = accessor; + return this; + } + + public Builder accessor(String accessor) { + this.accessor = Optional.ofNullable(accessor); + return this; + } + + /** + *

Filter for requests where a specific deployment was used

+ */ + @JsonSetter(value = "deployment", nulls = Nulls.SKIP) + public Builder deployment(Optional deployment) { + this.deployment = deployment; + return this; + } + + public Builder deployment(BreakdownListRequestDeployment deployment) { + this.deployment = Optional.ofNullable(deployment); + return this; + } + + /** + *

Filter for requests where a specific tag was used

+ */ + @JsonSetter(value = "tag", nulls = Nulls.SKIP) + public Builder tag(Optional tag) { + this.tag = tag; + return this; + } + + public Builder tag(String tag) { + this.tag = Optional.ofNullable(tag); + return this; + } + + /** + *

Filter requests by line item (e.g. streaming::nova-3)

+ */ + @JsonSetter(value = "line_item", nulls = Nulls.SKIP) + public Builder lineItem(Optional lineItem) { + this.lineItem = lineItem; + return this; + } + + public Builder lineItem(String lineItem) { + this.lineItem = Optional.ofNullable(lineItem); + return this; + } + + public BreakdownListRequest build() { + return new BreakdownListRequest( + grouping, start, end, accessor, deployment, tag, lineItem, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/billing/breakdown/types/BreakdownListRequestDeployment.java b/src/main/java/com/deepgram/resources/manage/v1/projects/billing/breakdown/types/BreakdownListRequestDeployment.java new file mode 100644 index 0000000..48fa821 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/billing/breakdown/types/BreakdownListRequestDeployment.java @@ -0,0 +1,96 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.billing.breakdown.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class BreakdownListRequestDeployment { + public static final BreakdownListRequestDeployment SELF_HOSTED = + new BreakdownListRequestDeployment(Value.SELF_HOSTED, "self-hosted"); + + public static final BreakdownListRequestDeployment BETA = new BreakdownListRequestDeployment(Value.BETA, "beta"); + + public static final BreakdownListRequestDeployment HOSTED = + new BreakdownListRequestDeployment(Value.HOSTED, "hosted"); + + private final Value value; + + private final String string; + + BreakdownListRequestDeployment(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof BreakdownListRequestDeployment + && this.string.equals(((BreakdownListRequestDeployment) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SELF_HOSTED: + return visitor.visitSelfHosted(); + case BETA: + return visitor.visitBeta(); + case HOSTED: + return visitor.visitHosted(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static BreakdownListRequestDeployment valueOf(String value) { + switch (value) { + case "self-hosted": + return SELF_HOSTED; + case "beta": + return BETA; + case "hosted": + return HOSTED; + default: + return new BreakdownListRequestDeployment(Value.UNKNOWN, value); + } + } + + public enum Value { + HOSTED, + + BETA, + + SELF_HOSTED, + + UNKNOWN + } + + public interface Visitor { + T visitHosted(); + + T visitBeta(); + + T visitSelfHosted(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/billing/breakdown/types/BreakdownListRequestGroupingItem.java b/src/main/java/com/deepgram/resources/manage/v1/projects/billing/breakdown/types/BreakdownListRequestGroupingItem.java new file mode 100644 index 0000000..88f124d --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/billing/breakdown/types/BreakdownListRequestGroupingItem.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.billing.breakdown.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class BreakdownListRequestGroupingItem { + public static final BreakdownListRequestGroupingItem TAGS = + new BreakdownListRequestGroupingItem(Value.TAGS, "tags"); + + public static final BreakdownListRequestGroupingItem ACCESSOR = + new BreakdownListRequestGroupingItem(Value.ACCESSOR, "accessor"); + + public static final BreakdownListRequestGroupingItem DEPLOYMENT = + new BreakdownListRequestGroupingItem(Value.DEPLOYMENT, "deployment"); + + public static final BreakdownListRequestGroupingItem LINE_ITEM = + new BreakdownListRequestGroupingItem(Value.LINE_ITEM, "line_item"); + + private final Value value; + + private final String string; + + BreakdownListRequestGroupingItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof BreakdownListRequestGroupingItem + && this.string.equals(((BreakdownListRequestGroupingItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case TAGS: + return visitor.visitTags(); + case ACCESSOR: + return visitor.visitAccessor(); + case DEPLOYMENT: + return visitor.visitDeployment(); + case LINE_ITEM: + return visitor.visitLineItem(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static BreakdownListRequestGroupingItem valueOf(String value) { + switch (value) { + case "tags": + return TAGS; + case "accessor": + return ACCESSOR; + case "deployment": + return DEPLOYMENT; + case "line_item": + return LINE_ITEM; + default: + return new BreakdownListRequestGroupingItem(Value.UNKNOWN, value); + } + } + + public enum Value { + ACCESSOR, + + DEPLOYMENT, + + LINE_ITEM, + + TAGS, + + UNKNOWN + } + + public interface Visitor { + T visitAccessor(); + + T visitDeployment(); + + T visitLineItem(); + + T visitTags(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/billing/fields/AsyncFieldsClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/billing/fields/AsyncFieldsClient.java new file mode 100644 index 0000000..f1988c9 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/billing/fields/AsyncFieldsClient.java @@ -0,0 +1,57 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.billing.fields; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.RequestOptions; +import com.deepgram.resources.manage.v1.projects.billing.fields.requests.FieldsListRequest; +import com.deepgram.types.ListBillingFieldsV1Response; +import java.util.concurrent.CompletableFuture; + +public class AsyncFieldsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawFieldsClient rawClient; + + public AsyncFieldsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawFieldsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawFieldsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists the accessors, deployment types, tags, and line items used for billing data in the specified time period. Use this endpoint if you want to filter your results from the Billing Breakdown endpoint and want to know what filters are available. + */ + public CompletableFuture list(String projectId) { + return this.rawClient.list(projectId).thenApply(response -> response.body()); + } + + /** + * Lists the accessors, deployment types, tags, and line items used for billing data in the specified time period. Use this endpoint if you want to filter your results from the Billing Breakdown endpoint and want to know what filters are available. + */ + public CompletableFuture list(String projectId, RequestOptions requestOptions) { + return this.rawClient.list(projectId, requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists the accessors, deployment types, tags, and line items used for billing data in the specified time period. Use this endpoint if you want to filter your results from the Billing Breakdown endpoint and want to know what filters are available. + */ + public CompletableFuture list(String projectId, FieldsListRequest request) { + return this.rawClient.list(projectId, request).thenApply(response -> response.body()); + } + + /** + * Lists the accessors, deployment types, tags, and line items used for billing data in the specified time period. Use this endpoint if you want to filter your results from the Billing Breakdown endpoint and want to know what filters are available. + */ + public CompletableFuture list( + String projectId, FieldsListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(projectId, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/billing/fields/AsyncRawFieldsClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/billing/fields/AsyncRawFieldsClient.java new file mode 100644 index 0000000..c05c0e6 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/billing/fields/AsyncRawFieldsClient.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.billing.fields; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.DeepgramApiApiException; +import com.deepgram.core.DeepgramApiException; +import com.deepgram.core.DeepgramApiHttpResponse; +import com.deepgram.core.ObjectMappers; +import com.deepgram.core.QueryStringMapper; +import com.deepgram.core.RequestOptions; +import com.deepgram.errors.BadRequestError; +import com.deepgram.resources.manage.v1.projects.billing.fields.requests.FieldsListRequest; +import com.deepgram.types.ListBillingFieldsV1Response; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawFieldsClient { + protected final ClientOptions clientOptions; + + public AsyncRawFieldsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists the accessors, deployment types, tags, and line items used for billing data in the specified time period. Use this endpoint if you want to filter your results from the Billing Breakdown endpoint and want to know what filters are available. + */ + public CompletableFuture> list(String projectId) { + return list(projectId, FieldsListRequest.builder().build()); + } + + /** + * Lists the accessors, deployment types, tags, and line items used for billing data in the specified time period. Use this endpoint if you want to filter your results from the Billing Breakdown endpoint and want to know what filters are available. + */ + public CompletableFuture> list( + String projectId, RequestOptions requestOptions) { + return list(projectId, FieldsListRequest.builder().build(), requestOptions); + } + + /** + * Lists the accessors, deployment types, tags, and line items used for billing data in the specified time period. Use this endpoint if you want to filter your results from the Billing Breakdown endpoint and want to know what filters are available. + */ + public CompletableFuture> list( + String projectId, FieldsListRequest request) { + return list(projectId, request, null); + } + + /** + * Lists the accessors, deployment types, tags, and line items used for billing data in the specified time period. Use this endpoint if you want to filter your results from the Billing Breakdown endpoint and want to know what filters are available. + */ + public CompletableFuture> list( + String projectId, FieldsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("billing") + .addPathSegments("fields"); + if (request.getStart().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "start", request.getStart().get(), false); + } + if (request.getEnd().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "end", request.getEnd().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListBillingFieldsV1Response.class), + response)); + return; + } + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/billing/fields/FieldsClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/billing/fields/FieldsClient.java new file mode 100644 index 0000000..0e11348 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/billing/fields/FieldsClient.java @@ -0,0 +1,56 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.billing.fields; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.RequestOptions; +import com.deepgram.resources.manage.v1.projects.billing.fields.requests.FieldsListRequest; +import com.deepgram.types.ListBillingFieldsV1Response; + +public class FieldsClient { + protected final ClientOptions clientOptions; + + private final RawFieldsClient rawClient; + + public FieldsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawFieldsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawFieldsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists the accessors, deployment types, tags, and line items used for billing data in the specified time period. Use this endpoint if you want to filter your results from the Billing Breakdown endpoint and want to know what filters are available. + */ + public ListBillingFieldsV1Response list(String projectId) { + return this.rawClient.list(projectId).body(); + } + + /** + * Lists the accessors, deployment types, tags, and line items used for billing data in the specified time period. Use this endpoint if you want to filter your results from the Billing Breakdown endpoint and want to know what filters are available. + */ + public ListBillingFieldsV1Response list(String projectId, RequestOptions requestOptions) { + return this.rawClient.list(projectId, requestOptions).body(); + } + + /** + * Lists the accessors, deployment types, tags, and line items used for billing data in the specified time period. Use this endpoint if you want to filter your results from the Billing Breakdown endpoint and want to know what filters are available. + */ + public ListBillingFieldsV1Response list(String projectId, FieldsListRequest request) { + return this.rawClient.list(projectId, request).body(); + } + + /** + * Lists the accessors, deployment types, tags, and line items used for billing data in the specified time period. Use this endpoint if you want to filter your results from the Billing Breakdown endpoint and want to know what filters are available. + */ + public ListBillingFieldsV1Response list( + String projectId, FieldsListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(projectId, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/billing/fields/RawFieldsClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/billing/fields/RawFieldsClient.java new file mode 100644 index 0000000..b64a684 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/billing/fields/RawFieldsClient.java @@ -0,0 +1,109 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.billing.fields; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.DeepgramApiApiException; +import com.deepgram.core.DeepgramApiException; +import com.deepgram.core.DeepgramApiHttpResponse; +import com.deepgram.core.ObjectMappers; +import com.deepgram.core.QueryStringMapper; +import com.deepgram.core.RequestOptions; +import com.deepgram.errors.BadRequestError; +import com.deepgram.resources.manage.v1.projects.billing.fields.requests.FieldsListRequest; +import com.deepgram.types.ListBillingFieldsV1Response; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawFieldsClient { + protected final ClientOptions clientOptions; + + public RawFieldsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists the accessors, deployment types, tags, and line items used for billing data in the specified time period. Use this endpoint if you want to filter your results from the Billing Breakdown endpoint and want to know what filters are available. + */ + public DeepgramApiHttpResponse list(String projectId) { + return list(projectId, FieldsListRequest.builder().build()); + } + + /** + * Lists the accessors, deployment types, tags, and line items used for billing data in the specified time period. Use this endpoint if you want to filter your results from the Billing Breakdown endpoint and want to know what filters are available. + */ + public DeepgramApiHttpResponse list(String projectId, RequestOptions requestOptions) { + return list(projectId, FieldsListRequest.builder().build(), requestOptions); + } + + /** + * Lists the accessors, deployment types, tags, and line items used for billing data in the specified time period. Use this endpoint if you want to filter your results from the Billing Breakdown endpoint and want to know what filters are available. + */ + public DeepgramApiHttpResponse list(String projectId, FieldsListRequest request) { + return list(projectId, request, null); + } + + /** + * Lists the accessors, deployment types, tags, and line items used for billing data in the specified time period. Use this endpoint if you want to filter your results from the Billing Breakdown endpoint and want to know what filters are available. + */ + public DeepgramApiHttpResponse list( + String projectId, FieldsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("billing") + .addPathSegments("fields"); + if (request.getStart().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "start", request.getStart().get(), false); + } + if (request.getEnd().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "end", request.getEnd().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListBillingFieldsV1Response.class), + response); + } + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new DeepgramApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/billing/fields/requests/FieldsListRequest.java b/src/main/java/com/deepgram/resources/manage/v1/projects/billing/fields/requests/FieldsListRequest.java new file mode 100644 index 0000000..6043aeb --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/billing/fields/requests/FieldsListRequest.java @@ -0,0 +1,139 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.billing.fields.requests; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = FieldsListRequest.Builder.class) +public final class FieldsListRequest { + private final Optional start; + + private final Optional end; + + private final Map additionalProperties; + + private FieldsListRequest(Optional start, Optional end, Map additionalProperties) { + this.start = start; + this.end = end; + this.additionalProperties = additionalProperties; + } + + /** + * @return Start date of the requested date range. Format accepted is YYYY-MM-DD + */ + @JsonIgnore + public Optional getStart() { + return start; + } + + /** + * @return End date of the requested date range. Format accepted is YYYY-MM-DD + */ + @JsonIgnore + public Optional getEnd() { + return end; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FieldsListRequest && equalTo((FieldsListRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(FieldsListRequest other) { + return start.equals(other.start) && end.equals(other.end); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.start, this.end); + } + + @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 start = Optional.empty(); + + private Optional end = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(FieldsListRequest other) { + start(other.getStart()); + end(other.getEnd()); + return this; + } + + /** + *

Start date of the requested date range. Format accepted is YYYY-MM-DD

+ */ + @JsonSetter(value = "start", nulls = Nulls.SKIP) + public Builder start(Optional start) { + this.start = start; + return this; + } + + public Builder start(String start) { + this.start = Optional.ofNullable(start); + return this; + } + + /** + *

End date of the requested date range. Format accepted is YYYY-MM-DD

+ */ + @JsonSetter(value = "end", nulls = Nulls.SKIP) + public Builder end(Optional end) { + this.end = end; + return this; + } + + public Builder end(String end) { + this.end = Optional.ofNullable(end); + return this; + } + + public FieldsListRequest build() { + return new FieldsListRequest(start, end, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/billing/purchases/AsyncPurchasesClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/billing/purchases/AsyncPurchasesClient.java new file mode 100644 index 0000000..bb6830b --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/billing/purchases/AsyncPurchasesClient.java @@ -0,0 +1,57 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.billing.purchases; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.RequestOptions; +import com.deepgram.resources.manage.v1.projects.billing.purchases.requests.PurchasesListRequest; +import com.deepgram.types.ListProjectPurchasesV1Response; +import java.util.concurrent.CompletableFuture; + +public class AsyncPurchasesClient { + protected final ClientOptions clientOptions; + + private final AsyncRawPurchasesClient rawClient; + + public AsyncPurchasesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawPurchasesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawPurchasesClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns the original purchased amount on an order transaction + */ + public CompletableFuture list(String projectId) { + return this.rawClient.list(projectId).thenApply(response -> response.body()); + } + + /** + * Returns the original purchased amount on an order transaction + */ + public CompletableFuture list(String projectId, RequestOptions requestOptions) { + return this.rawClient.list(projectId, requestOptions).thenApply(response -> response.body()); + } + + /** + * Returns the original purchased amount on an order transaction + */ + public CompletableFuture list(String projectId, PurchasesListRequest request) { + return this.rawClient.list(projectId, request).thenApply(response -> response.body()); + } + + /** + * Returns the original purchased amount on an order transaction + */ + public CompletableFuture list( + String projectId, PurchasesListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(projectId, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/billing/purchases/AsyncRawPurchasesClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/billing/purchases/AsyncRawPurchasesClient.java new file mode 100644 index 0000000..99d7689 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/billing/purchases/AsyncRawPurchasesClient.java @@ -0,0 +1,126 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.billing.purchases; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.DeepgramApiApiException; +import com.deepgram.core.DeepgramApiException; +import com.deepgram.core.DeepgramApiHttpResponse; +import com.deepgram.core.ObjectMappers; +import com.deepgram.core.QueryStringMapper; +import com.deepgram.core.RequestOptions; +import com.deepgram.errors.BadRequestError; +import com.deepgram.resources.manage.v1.projects.billing.purchases.requests.PurchasesListRequest; +import com.deepgram.types.ListProjectPurchasesV1Response; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawPurchasesClient { + protected final ClientOptions clientOptions; + + public AsyncRawPurchasesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns the original purchased amount on an order transaction + */ + public CompletableFuture> list(String projectId) { + return list(projectId, PurchasesListRequest.builder().build()); + } + + /** + * Returns the original purchased amount on an order transaction + */ + public CompletableFuture> list( + String projectId, RequestOptions requestOptions) { + return list(projectId, PurchasesListRequest.builder().build(), requestOptions); + } + + /** + * Returns the original purchased amount on an order transaction + */ + public CompletableFuture> list( + String projectId, PurchasesListRequest request) { + return list(projectId, request, null); + } + + /** + * Returns the original purchased amount on an order transaction + */ + public CompletableFuture> list( + String projectId, PurchasesListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("purchases"); + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListProjectPurchasesV1Response.class), + response)); + return; + } + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/billing/purchases/PurchasesClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/billing/purchases/PurchasesClient.java new file mode 100644 index 0000000..c6eedcb --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/billing/purchases/PurchasesClient.java @@ -0,0 +1,56 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.billing.purchases; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.RequestOptions; +import com.deepgram.resources.manage.v1.projects.billing.purchases.requests.PurchasesListRequest; +import com.deepgram.types.ListProjectPurchasesV1Response; + +public class PurchasesClient { + protected final ClientOptions clientOptions; + + private final RawPurchasesClient rawClient; + + public PurchasesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawPurchasesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawPurchasesClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns the original purchased amount on an order transaction + */ + public ListProjectPurchasesV1Response list(String projectId) { + return this.rawClient.list(projectId).body(); + } + + /** + * Returns the original purchased amount on an order transaction + */ + public ListProjectPurchasesV1Response list(String projectId, RequestOptions requestOptions) { + return this.rawClient.list(projectId, requestOptions).body(); + } + + /** + * Returns the original purchased amount on an order transaction + */ + public ListProjectPurchasesV1Response list(String projectId, PurchasesListRequest request) { + return this.rawClient.list(projectId, request).body(); + } + + /** + * Returns the original purchased amount on an order transaction + */ + public ListProjectPurchasesV1Response list( + String projectId, PurchasesListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(projectId, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/billing/purchases/RawPurchasesClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/billing/purchases/RawPurchasesClient.java new file mode 100644 index 0000000..54933c6 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/billing/purchases/RawPurchasesClient.java @@ -0,0 +1,107 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.billing.purchases; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.DeepgramApiApiException; +import com.deepgram.core.DeepgramApiException; +import com.deepgram.core.DeepgramApiHttpResponse; +import com.deepgram.core.ObjectMappers; +import com.deepgram.core.QueryStringMapper; +import com.deepgram.core.RequestOptions; +import com.deepgram.errors.BadRequestError; +import com.deepgram.resources.manage.v1.projects.billing.purchases.requests.PurchasesListRequest; +import com.deepgram.types.ListProjectPurchasesV1Response; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawPurchasesClient { + protected final ClientOptions clientOptions; + + public RawPurchasesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns the original purchased amount on an order transaction + */ + public DeepgramApiHttpResponse list(String projectId) { + return list(projectId, PurchasesListRequest.builder().build()); + } + + /** + * Returns the original purchased amount on an order transaction + */ + public DeepgramApiHttpResponse list( + String projectId, RequestOptions requestOptions) { + return list(projectId, PurchasesListRequest.builder().build(), requestOptions); + } + + /** + * Returns the original purchased amount on an order transaction + */ + public DeepgramApiHttpResponse list( + String projectId, PurchasesListRequest request) { + return list(projectId, request, null); + } + + /** + * Returns the original purchased amount on an order transaction + */ + public DeepgramApiHttpResponse list( + String projectId, PurchasesListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("purchases"); + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListProjectPurchasesV1Response.class), + response); + } + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new DeepgramApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/billing/purchases/requests/PurchasesListRequest.java b/src/main/java/com/deepgram/resources/manage/v1/projects/billing/purchases/requests/PurchasesListRequest.java new file mode 100644 index 0000000..891502b --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/billing/purchases/requests/PurchasesListRequest.java @@ -0,0 +1,111 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.billing.purchases.requests; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PurchasesListRequest.Builder.class) +public final class PurchasesListRequest { + private final Optional limit; + + private final Map additionalProperties; + + private PurchasesListRequest(Optional limit, Map additionalProperties) { + this.limit = limit; + this.additionalProperties = additionalProperties; + } + + /** + * @return Number of results to return per page. Default 10. Range [1,1000] + */ + @JsonIgnore + public Optional getLimit() { + return limit; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PurchasesListRequest && equalTo((PurchasesListRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PurchasesListRequest other) { + return limit.equals(other.limit); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.limit); + } + + @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(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PurchasesListRequest other) { + limit(other.getLimit()); + return this; + } + + /** + *

Number of results to return per page. Default 10. Range [1,1000]

+ */ + @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; + } + + public PurchasesListRequest build() { + return new PurchasesListRequest(limit, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/keys/AsyncKeysClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/keys/AsyncKeysClient.java new file mode 100644 index 0000000..d7fdea5 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/keys/AsyncKeysClient.java @@ -0,0 +1,106 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.keys; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.RequestOptions; +import com.deepgram.resources.manage.v1.projects.keys.requests.KeysListRequest; +import com.deepgram.types.CreateKeyV1RequestOne; +import com.deepgram.types.CreateKeyV1Response; +import com.deepgram.types.DeleteProjectKeyV1Response; +import com.deepgram.types.GetProjectKeyV1Response; +import com.deepgram.types.ListProjectKeysV1Response; +import java.util.concurrent.CompletableFuture; + +public class AsyncKeysClient { + protected final ClientOptions clientOptions; + + private final AsyncRawKeysClient rawClient; + + public AsyncKeysClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawKeysClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawKeysClient withRawResponse() { + return this.rawClient; + } + + /** + * Retrieves all API keys associated with the specified project + */ + public CompletableFuture list(String projectId) { + return this.rawClient.list(projectId).thenApply(response -> response.body()); + } + + /** + * Retrieves all API keys associated with the specified project + */ + public CompletableFuture list(String projectId, RequestOptions requestOptions) { + return this.rawClient.list(projectId, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves all API keys associated with the specified project + */ + public CompletableFuture list(String projectId, KeysListRequest request) { + return this.rawClient.list(projectId, request).thenApply(response -> response.body()); + } + + /** + * Retrieves all API keys associated with the specified project + */ + public CompletableFuture list( + String projectId, KeysListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(projectId, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Creates a new API key with specified settings for the project + */ + public CompletableFuture create(String projectId, CreateKeyV1RequestOne request) { + return this.rawClient.create(projectId, request).thenApply(response -> response.body()); + } + + /** + * Creates a new API key with specified settings for the project + */ + public CompletableFuture create( + String projectId, CreateKeyV1RequestOne request, RequestOptions requestOptions) { + return this.rawClient.create(projectId, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves information about a specified API key + */ + public CompletableFuture get(String projectId, String keyId) { + return this.rawClient.get(projectId, keyId).thenApply(response -> response.body()); + } + + /** + * Retrieves information about a specified API key + */ + public CompletableFuture get( + String projectId, String keyId, RequestOptions requestOptions) { + return this.rawClient.get(projectId, keyId, requestOptions).thenApply(response -> response.body()); + } + + /** + * Deletes an API key for a specific project + */ + public CompletableFuture delete(String projectId, String keyId) { + return this.rawClient.delete(projectId, keyId).thenApply(response -> response.body()); + } + + /** + * Deletes an API key for a specific project + */ + public CompletableFuture delete( + String projectId, String keyId, RequestOptions requestOptions) { + return this.rawClient.delete(projectId, keyId, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/keys/AsyncRawKeysClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/keys/AsyncRawKeysClient.java new file mode 100644 index 0000000..e6a3575 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/keys/AsyncRawKeysClient.java @@ -0,0 +1,355 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.keys; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.DeepgramApiApiException; +import com.deepgram.core.DeepgramApiException; +import com.deepgram.core.DeepgramApiHttpResponse; +import com.deepgram.core.MediaTypes; +import com.deepgram.core.ObjectMappers; +import com.deepgram.core.QueryStringMapper; +import com.deepgram.core.RequestOptions; +import com.deepgram.errors.BadRequestError; +import com.deepgram.resources.manage.v1.projects.keys.requests.KeysListRequest; +import com.deepgram.types.CreateKeyV1RequestOne; +import com.deepgram.types.CreateKeyV1Response; +import com.deepgram.types.DeleteProjectKeyV1Response; +import com.deepgram.types.GetProjectKeyV1Response; +import com.deepgram.types.ListProjectKeysV1Response; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawKeysClient { + protected final ClientOptions clientOptions; + + public AsyncRawKeysClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Retrieves all API keys associated with the specified project + */ + public CompletableFuture> list(String projectId) { + return list(projectId, KeysListRequest.builder().build()); + } + + /** + * Retrieves all API keys associated with the specified project + */ + public CompletableFuture> list( + String projectId, RequestOptions requestOptions) { + return list(projectId, KeysListRequest.builder().build(), requestOptions); + } + + /** + * Retrieves all API keys associated with the specified project + */ + public CompletableFuture> list( + String projectId, KeysListRequest request) { + return list(projectId, request, null); + } + + /** + * Retrieves all API keys associated with the specified project + */ + public CompletableFuture> list( + String projectId, KeysListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("keys"); + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListProjectKeysV1Response.class), + response)); + return; + } + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Creates a new API key with specified settings for the project + */ + public CompletableFuture> create( + String projectId, CreateKeyV1RequestOne request) { + return create(projectId, request, null); + } + + /** + * Creates a new API key with specified settings for the project + */ + public CompletableFuture> create( + String projectId, CreateKeyV1RequestOne request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("keys"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new DeepgramApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateKeyV1Response.class), + response)); + return; + } + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves information about a specified API key + */ + public CompletableFuture> get(String projectId, String keyId) { + return get(projectId, keyId, null); + } + + /** + * Retrieves information about a specified API key + */ + public CompletableFuture> get( + String projectId, String keyId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("keys") + .addPathSegment(keyId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetProjectKeyV1Response.class), + response)); + return; + } + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Deletes an API key for a specific project + */ + public CompletableFuture> delete( + String projectId, String keyId) { + return delete(projectId, keyId, null); + } + + /** + * Deletes an API key for a specific project + */ + public CompletableFuture> delete( + String projectId, String keyId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("keys") + .addPathSegment(keyId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, DeleteProjectKeyV1Response.class), + response)); + return; + } + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/keys/KeysClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/keys/KeysClient.java new file mode 100644 index 0000000..fc68c2a --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/keys/KeysClient.java @@ -0,0 +1,101 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.keys; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.RequestOptions; +import com.deepgram.resources.manage.v1.projects.keys.requests.KeysListRequest; +import com.deepgram.types.CreateKeyV1RequestOne; +import com.deepgram.types.CreateKeyV1Response; +import com.deepgram.types.DeleteProjectKeyV1Response; +import com.deepgram.types.GetProjectKeyV1Response; +import com.deepgram.types.ListProjectKeysV1Response; + +public class KeysClient { + protected final ClientOptions clientOptions; + + private final RawKeysClient rawClient; + + public KeysClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawKeysClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawKeysClient withRawResponse() { + return this.rawClient; + } + + /** + * Retrieves all API keys associated with the specified project + */ + public ListProjectKeysV1Response list(String projectId) { + return this.rawClient.list(projectId).body(); + } + + /** + * Retrieves all API keys associated with the specified project + */ + public ListProjectKeysV1Response list(String projectId, RequestOptions requestOptions) { + return this.rawClient.list(projectId, requestOptions).body(); + } + + /** + * Retrieves all API keys associated with the specified project + */ + public ListProjectKeysV1Response list(String projectId, KeysListRequest request) { + return this.rawClient.list(projectId, request).body(); + } + + /** + * Retrieves all API keys associated with the specified project + */ + public ListProjectKeysV1Response list(String projectId, KeysListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(projectId, request, requestOptions).body(); + } + + /** + * Creates a new API key with specified settings for the project + */ + public CreateKeyV1Response create(String projectId, CreateKeyV1RequestOne request) { + return this.rawClient.create(projectId, request).body(); + } + + /** + * Creates a new API key with specified settings for the project + */ + public CreateKeyV1Response create(String projectId, CreateKeyV1RequestOne request, RequestOptions requestOptions) { + return this.rawClient.create(projectId, request, requestOptions).body(); + } + + /** + * Retrieves information about a specified API key + */ + public GetProjectKeyV1Response get(String projectId, String keyId) { + return this.rawClient.get(projectId, keyId).body(); + } + + /** + * Retrieves information about a specified API key + */ + public GetProjectKeyV1Response get(String projectId, String keyId, RequestOptions requestOptions) { + return this.rawClient.get(projectId, keyId, requestOptions).body(); + } + + /** + * Deletes an API key for a specific project + */ + public DeleteProjectKeyV1Response delete(String projectId, String keyId) { + return this.rawClient.delete(projectId, keyId).body(); + } + + /** + * Deletes an API key for a specific project + */ + public DeleteProjectKeyV1Response delete(String projectId, String keyId, RequestOptions requestOptions) { + return this.rawClient.delete(projectId, keyId, requestOptions).body(); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/keys/RawKeysClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/keys/RawKeysClient.java new file mode 100644 index 0000000..5d5625d --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/keys/RawKeysClient.java @@ -0,0 +1,288 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.keys; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.DeepgramApiApiException; +import com.deepgram.core.DeepgramApiException; +import com.deepgram.core.DeepgramApiHttpResponse; +import com.deepgram.core.MediaTypes; +import com.deepgram.core.ObjectMappers; +import com.deepgram.core.QueryStringMapper; +import com.deepgram.core.RequestOptions; +import com.deepgram.errors.BadRequestError; +import com.deepgram.resources.manage.v1.projects.keys.requests.KeysListRequest; +import com.deepgram.types.CreateKeyV1RequestOne; +import com.deepgram.types.CreateKeyV1Response; +import com.deepgram.types.DeleteProjectKeyV1Response; +import com.deepgram.types.GetProjectKeyV1Response; +import com.deepgram.types.ListProjectKeysV1Response; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawKeysClient { + protected final ClientOptions clientOptions; + + public RawKeysClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Retrieves all API keys associated with the specified project + */ + public DeepgramApiHttpResponse list(String projectId) { + return list(projectId, KeysListRequest.builder().build()); + } + + /** + * Retrieves all API keys associated with the specified project + */ + public DeepgramApiHttpResponse list(String projectId, RequestOptions requestOptions) { + return list(projectId, KeysListRequest.builder().build(), requestOptions); + } + + /** + * Retrieves all API keys associated with the specified project + */ + public DeepgramApiHttpResponse list(String projectId, KeysListRequest request) { + return list(projectId, request, null); + } + + /** + * Retrieves all API keys associated with the specified project + */ + public DeepgramApiHttpResponse list( + String projectId, KeysListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("keys"); + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListProjectKeysV1Response.class), + response); + } + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new DeepgramApiException("Network error executing HTTP request", e); + } + } + + /** + * Creates a new API key with specified settings for the project + */ + public DeepgramApiHttpResponse create(String projectId, CreateKeyV1RequestOne request) { + return create(projectId, request, null); + } + + /** + * Creates a new API key with specified settings for the project + */ + public DeepgramApiHttpResponse create( + String projectId, CreateKeyV1RequestOne request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("keys"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new DeepgramApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateKeyV1Response.class), response); + } + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new DeepgramApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves information about a specified API key + */ + public DeepgramApiHttpResponse get(String projectId, String keyId) { + return get(projectId, keyId, null); + } + + /** + * Retrieves information about a specified API key + */ + public DeepgramApiHttpResponse get( + String projectId, String keyId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("keys") + .addPathSegment(keyId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetProjectKeyV1Response.class), + response); + } + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new DeepgramApiException("Network error executing HTTP request", e); + } + } + + /** + * Deletes an API key for a specific project + */ + public DeepgramApiHttpResponse delete(String projectId, String keyId) { + return delete(projectId, keyId, null); + } + + /** + * Deletes an API key for a specific project + */ + public DeepgramApiHttpResponse delete( + String projectId, String keyId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("keys") + .addPathSegment(keyId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteProjectKeyV1Response.class), + response); + } + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new DeepgramApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/keys/requests/KeysListRequest.java b/src/main/java/com/deepgram/resources/manage/v1/projects/keys/requests/KeysListRequest.java new file mode 100644 index 0000000..d18d7fb --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/keys/requests/KeysListRequest.java @@ -0,0 +1,112 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.keys.requests; + +import com.deepgram.core.ObjectMappers; +import com.deepgram.resources.manage.v1.projects.keys.types.KeysListRequestStatus; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = KeysListRequest.Builder.class) +public final class KeysListRequest { + private final Optional status; + + private final Map additionalProperties; + + private KeysListRequest(Optional status, Map additionalProperties) { + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return Only return keys with a specific status + */ + @JsonIgnore + public Optional getStatus() { + return status; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof KeysListRequest && equalTo((KeysListRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(KeysListRequest other) { + return status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.status); + } + + @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 status = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(KeysListRequest other) { + status(other.getStatus()); + return this; + } + + /** + *

Only return keys with a specific status

+ */ + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(KeysListRequestStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + public KeysListRequest build() { + return new KeysListRequest(status, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/keys/types/KeysListRequestStatus.java b/src/main/java/com/deepgram/resources/manage/v1/projects/keys/types/KeysListRequestStatus.java new file mode 100644 index 0000000..d262fbd --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/keys/types/KeysListRequestStatus.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.keys.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class KeysListRequestStatus { + public static final KeysListRequestStatus EXPIRED = new KeysListRequestStatus(Value.EXPIRED, "expired"); + + public static final KeysListRequestStatus ACTIVE = new KeysListRequestStatus(Value.ACTIVE, "active"); + + private final Value value; + + private final String string; + + KeysListRequestStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof KeysListRequestStatus + && this.string.equals(((KeysListRequestStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case EXPIRED: + return visitor.visitExpired(); + case ACTIVE: + return visitor.visitActive(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static KeysListRequestStatus valueOf(String value) { + switch (value) { + case "expired": + return EXPIRED; + case "active": + return ACTIVE; + default: + return new KeysListRequestStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + ACTIVE, + + EXPIRED, + + UNKNOWN + } + + public interface Visitor { + T visitActive(); + + T visitExpired(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/members/AsyncMembersClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/members/AsyncMembersClient.java new file mode 100644 index 0000000..c422f4a --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/members/AsyncMembersClient.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.members; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.RequestOptions; +import com.deepgram.core.Suppliers; +import com.deepgram.resources.manage.v1.projects.members.invites.AsyncInvitesClient; +import com.deepgram.resources.manage.v1.projects.members.scopes.AsyncScopesClient; +import com.deepgram.types.DeleteProjectMemberV1Response; +import com.deepgram.types.ListProjectMembersV1Response; +import java.util.concurrent.CompletableFuture; +import java.util.function.Supplier; + +public class AsyncMembersClient { + protected final ClientOptions clientOptions; + + private final AsyncRawMembersClient rawClient; + + protected final Supplier invitesClient; + + protected final Supplier scopesClient; + + public AsyncMembersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawMembersClient(clientOptions); + this.invitesClient = Suppliers.memoize(() -> new AsyncInvitesClient(clientOptions)); + this.scopesClient = Suppliers.memoize(() -> new AsyncScopesClient(clientOptions)); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawMembersClient withRawResponse() { + return this.rawClient; + } + + /** + * Retrieves a list of members for a given project + */ + public CompletableFuture list(String projectId) { + return this.rawClient.list(projectId).thenApply(response -> response.body()); + } + + /** + * Retrieves a list of members for a given project + */ + public CompletableFuture list(String projectId, RequestOptions requestOptions) { + return this.rawClient.list(projectId, requestOptions).thenApply(response -> response.body()); + } + + /** + * Removes a member from the project using their unique member ID + */ + public CompletableFuture delete(String projectId, String memberId) { + return this.rawClient.delete(projectId, memberId).thenApply(response -> response.body()); + } + + /** + * Removes a member from the project using their unique member ID + */ + public CompletableFuture delete( + String projectId, String memberId, RequestOptions requestOptions) { + return this.rawClient.delete(projectId, memberId, requestOptions).thenApply(response -> response.body()); + } + + public AsyncInvitesClient invites() { + return this.invitesClient.get(); + } + + public AsyncScopesClient scopes() { + return this.scopesClient.get(); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/members/AsyncRawMembersClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/members/AsyncRawMembersClient.java new file mode 100644 index 0000000..3547dee --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/members/AsyncRawMembersClient.java @@ -0,0 +1,178 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.members; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.DeepgramApiApiException; +import com.deepgram.core.DeepgramApiException; +import com.deepgram.core.DeepgramApiHttpResponse; +import com.deepgram.core.ObjectMappers; +import com.deepgram.core.RequestOptions; +import com.deepgram.errors.BadRequestError; +import com.deepgram.types.DeleteProjectMemberV1Response; +import com.deepgram.types.ListProjectMembersV1Response; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawMembersClient { + protected final ClientOptions clientOptions; + + public AsyncRawMembersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Retrieves a list of members for a given project + */ + public CompletableFuture> list(String projectId) { + return list(projectId, null); + } + + /** + * Retrieves a list of members for a given project + */ + public CompletableFuture> list( + String projectId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("members"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListProjectMembersV1Response.class), + response)); + return; + } + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Removes a member from the project using their unique member ID + */ + public CompletableFuture> delete( + String projectId, String memberId) { + return delete(projectId, memberId, null); + } + + /** + * Removes a member from the project using their unique member ID + */ + public CompletableFuture> delete( + String projectId, String memberId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("members") + .addPathSegment(memberId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, DeleteProjectMemberV1Response.class), + response)); + return; + } + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/members/MembersClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/members/MembersClient.java new file mode 100644 index 0000000..01bb854 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/members/MembersClient.java @@ -0,0 +1,73 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.members; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.RequestOptions; +import com.deepgram.core.Suppliers; +import com.deepgram.resources.manage.v1.projects.members.invites.InvitesClient; +import com.deepgram.resources.manage.v1.projects.members.scopes.ScopesClient; +import com.deepgram.types.DeleteProjectMemberV1Response; +import com.deepgram.types.ListProjectMembersV1Response; +import java.util.function.Supplier; + +public class MembersClient { + protected final ClientOptions clientOptions; + + private final RawMembersClient rawClient; + + protected final Supplier invitesClient; + + protected final Supplier scopesClient; + + public MembersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawMembersClient(clientOptions); + this.invitesClient = Suppliers.memoize(() -> new InvitesClient(clientOptions)); + this.scopesClient = Suppliers.memoize(() -> new ScopesClient(clientOptions)); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawMembersClient withRawResponse() { + return this.rawClient; + } + + /** + * Retrieves a list of members for a given project + */ + public ListProjectMembersV1Response list(String projectId) { + return this.rawClient.list(projectId).body(); + } + + /** + * Retrieves a list of members for a given project + */ + public ListProjectMembersV1Response list(String projectId, RequestOptions requestOptions) { + return this.rawClient.list(projectId, requestOptions).body(); + } + + /** + * Removes a member from the project using their unique member ID + */ + public DeleteProjectMemberV1Response delete(String projectId, String memberId) { + return this.rawClient.delete(projectId, memberId).body(); + } + + /** + * Removes a member from the project using their unique member ID + */ + public DeleteProjectMemberV1Response delete(String projectId, String memberId, RequestOptions requestOptions) { + return this.rawClient.delete(projectId, memberId, requestOptions).body(); + } + + public InvitesClient invites() { + return this.invitesClient.get(); + } + + public ScopesClient scopes() { + return this.scopesClient.get(); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/members/RawMembersClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/members/RawMembersClient.java new file mode 100644 index 0000000..34623da --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/members/RawMembersClient.java @@ -0,0 +1,142 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.members; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.DeepgramApiApiException; +import com.deepgram.core.DeepgramApiException; +import com.deepgram.core.DeepgramApiHttpResponse; +import com.deepgram.core.ObjectMappers; +import com.deepgram.core.RequestOptions; +import com.deepgram.errors.BadRequestError; +import com.deepgram.types.DeleteProjectMemberV1Response; +import com.deepgram.types.ListProjectMembersV1Response; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawMembersClient { + protected final ClientOptions clientOptions; + + public RawMembersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Retrieves a list of members for a given project + */ + public DeepgramApiHttpResponse list(String projectId) { + return list(projectId, null); + } + + /** + * Retrieves a list of members for a given project + */ + public DeepgramApiHttpResponse list(String projectId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("members"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListProjectMembersV1Response.class), + response); + } + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new DeepgramApiException("Network error executing HTTP request", e); + } + } + + /** + * Removes a member from the project using their unique member ID + */ + public DeepgramApiHttpResponse delete(String projectId, String memberId) { + return delete(projectId, memberId, null); + } + + /** + * Removes a member from the project using their unique member ID + */ + public DeepgramApiHttpResponse delete( + String projectId, String memberId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("members") + .addPathSegment(memberId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteProjectMemberV1Response.class), + response); + } + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new DeepgramApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/members/invites/AsyncInvitesClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/members/invites/AsyncInvitesClient.java new file mode 100644 index 0000000..5ecd829 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/members/invites/AsyncInvitesClient.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.members.invites; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.RequestOptions; +import com.deepgram.resources.manage.v1.projects.members.invites.requests.CreateProjectInviteV1Request; +import com.deepgram.types.CreateProjectInviteV1Response; +import com.deepgram.types.DeleteProjectInviteV1Response; +import com.deepgram.types.ListProjectInvitesV1Response; +import java.util.concurrent.CompletableFuture; + +public class AsyncInvitesClient { + protected final ClientOptions clientOptions; + + private final AsyncRawInvitesClient rawClient; + + public AsyncInvitesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawInvitesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawInvitesClient withRawResponse() { + return this.rawClient; + } + + /** + * Generates a list of invites for a specific project + */ + public CompletableFuture list(String projectId) { + return this.rawClient.list(projectId).thenApply(response -> response.body()); + } + + /** + * Generates a list of invites for a specific project + */ + public CompletableFuture list(String projectId, RequestOptions requestOptions) { + return this.rawClient.list(projectId, requestOptions).thenApply(response -> response.body()); + } + + /** + * Generates an invite for a specific project + */ + public CompletableFuture create( + String projectId, CreateProjectInviteV1Request request) { + return this.rawClient.create(projectId, request).thenApply(response -> response.body()); + } + + /** + * Generates an invite for a specific project + */ + public CompletableFuture create( + String projectId, CreateProjectInviteV1Request request, RequestOptions requestOptions) { + return this.rawClient.create(projectId, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Deletes an invite for a specific project + */ + public CompletableFuture delete(String projectId, String email) { + return this.rawClient.delete(projectId, email).thenApply(response -> response.body()); + } + + /** + * Deletes an invite for a specific project + */ + public CompletableFuture delete( + String projectId, String email, RequestOptions requestOptions) { + return this.rawClient.delete(projectId, email, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/members/invites/AsyncRawInvitesClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/members/invites/AsyncRawInvitesClient.java new file mode 100644 index 0000000..cb49699 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/members/invites/AsyncRawInvitesClient.java @@ -0,0 +1,262 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.members.invites; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.DeepgramApiApiException; +import com.deepgram.core.DeepgramApiException; +import com.deepgram.core.DeepgramApiHttpResponse; +import com.deepgram.core.MediaTypes; +import com.deepgram.core.ObjectMappers; +import com.deepgram.core.RequestOptions; +import com.deepgram.errors.BadRequestError; +import com.deepgram.resources.manage.v1.projects.members.invites.requests.CreateProjectInviteV1Request; +import com.deepgram.types.CreateProjectInviteV1Response; +import com.deepgram.types.DeleteProjectInviteV1Response; +import com.deepgram.types.ListProjectInvitesV1Response; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawInvitesClient { + protected final ClientOptions clientOptions; + + public AsyncRawInvitesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Generates a list of invites for a specific project + */ + public CompletableFuture> list(String projectId) { + return list(projectId, null); + } + + /** + * Generates a list of invites for a specific project + */ + public CompletableFuture> list( + String projectId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("invites"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListProjectInvitesV1Response.class), + response)); + return; + } + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Generates an invite for a specific project + */ + public CompletableFuture> create( + String projectId, CreateProjectInviteV1Request request) { + return create(projectId, request, null); + } + + /** + * Generates an invite for a specific project + */ + public CompletableFuture> create( + String projectId, CreateProjectInviteV1Request request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("invites"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new DeepgramApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, CreateProjectInviteV1Response.class), + response)); + return; + } + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Deletes an invite for a specific project + */ + public CompletableFuture> delete( + String projectId, String email) { + return delete(projectId, email, null); + } + + /** + * Deletes an invite for a specific project + */ + public CompletableFuture> delete( + String projectId, String email, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("invites") + .addPathSegment(email); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, DeleteProjectInviteV1Response.class), + response)); + return; + } + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/members/invites/InvitesClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/members/invites/InvitesClient.java new file mode 100644 index 0000000..2ea510f --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/members/invites/InvitesClient.java @@ -0,0 +1,72 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.members.invites; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.RequestOptions; +import com.deepgram.resources.manage.v1.projects.members.invites.requests.CreateProjectInviteV1Request; +import com.deepgram.types.CreateProjectInviteV1Response; +import com.deepgram.types.DeleteProjectInviteV1Response; +import com.deepgram.types.ListProjectInvitesV1Response; + +public class InvitesClient { + protected final ClientOptions clientOptions; + + private final RawInvitesClient rawClient; + + public InvitesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawInvitesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawInvitesClient withRawResponse() { + return this.rawClient; + } + + /** + * Generates a list of invites for a specific project + */ + public ListProjectInvitesV1Response list(String projectId) { + return this.rawClient.list(projectId).body(); + } + + /** + * Generates a list of invites for a specific project + */ + public ListProjectInvitesV1Response list(String projectId, RequestOptions requestOptions) { + return this.rawClient.list(projectId, requestOptions).body(); + } + + /** + * Generates an invite for a specific project + */ + public CreateProjectInviteV1Response create(String projectId, CreateProjectInviteV1Request request) { + return this.rawClient.create(projectId, request).body(); + } + + /** + * Generates an invite for a specific project + */ + public CreateProjectInviteV1Response create( + String projectId, CreateProjectInviteV1Request request, RequestOptions requestOptions) { + return this.rawClient.create(projectId, request, requestOptions).body(); + } + + /** + * Deletes an invite for a specific project + */ + public DeleteProjectInviteV1Response delete(String projectId, String email) { + return this.rawClient.delete(projectId, email).body(); + } + + /** + * Deletes an invite for a specific project + */ + public DeleteProjectInviteV1Response delete(String projectId, String email, RequestOptions requestOptions) { + return this.rawClient.delete(projectId, email, requestOptions).body(); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/members/invites/RawInvitesClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/members/invites/RawInvitesClient.java new file mode 100644 index 0000000..32af770 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/members/invites/RawInvitesClient.java @@ -0,0 +1,211 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.members.invites; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.DeepgramApiApiException; +import com.deepgram.core.DeepgramApiException; +import com.deepgram.core.DeepgramApiHttpResponse; +import com.deepgram.core.MediaTypes; +import com.deepgram.core.ObjectMappers; +import com.deepgram.core.RequestOptions; +import com.deepgram.errors.BadRequestError; +import com.deepgram.resources.manage.v1.projects.members.invites.requests.CreateProjectInviteV1Request; +import com.deepgram.types.CreateProjectInviteV1Response; +import com.deepgram.types.DeleteProjectInviteV1Response; +import com.deepgram.types.ListProjectInvitesV1Response; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawInvitesClient { + protected final ClientOptions clientOptions; + + public RawInvitesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Generates a list of invites for a specific project + */ + public DeepgramApiHttpResponse list(String projectId) { + return list(projectId, null); + } + + /** + * Generates a list of invites for a specific project + */ + public DeepgramApiHttpResponse list(String projectId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("invites"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListProjectInvitesV1Response.class), + response); + } + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new DeepgramApiException("Network error executing HTTP request", e); + } + } + + /** + * Generates an invite for a specific project + */ + public DeepgramApiHttpResponse create( + String projectId, CreateProjectInviteV1Request request) { + return create(projectId, request, null); + } + + /** + * Generates an invite for a specific project + */ + public DeepgramApiHttpResponse create( + String projectId, CreateProjectInviteV1Request request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("invites"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new DeepgramApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateProjectInviteV1Response.class), + response); + } + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new DeepgramApiException("Network error executing HTTP request", e); + } + } + + /** + * Deletes an invite for a specific project + */ + public DeepgramApiHttpResponse delete(String projectId, String email) { + return delete(projectId, email, null); + } + + /** + * Deletes an invite for a specific project + */ + public DeepgramApiHttpResponse delete( + String projectId, String email, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("invites") + .addPathSegment(email); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteProjectInviteV1Response.class), + response); + } + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new DeepgramApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/members/invites/requests/CreateProjectInviteV1Request.java b/src/main/java/com/deepgram/resources/manage/v1/projects/members/invites/requests/CreateProjectInviteV1Request.java new file mode 100644 index 0000000..223785a --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/members/invites/requests/CreateProjectInviteV1Request.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.members.invites.requests; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateProjectInviteV1Request.Builder.class) +public final class CreateProjectInviteV1Request { + private final String email; + + private final String scope; + + private final Map additionalProperties; + + private CreateProjectInviteV1Request(String email, String scope, Map additionalProperties) { + this.email = email; + this.scope = scope; + this.additionalProperties = additionalProperties; + } + + /** + * @return The email address of the invitee + */ + @JsonProperty("email") + public String getEmail() { + return email; + } + + /** + * @return The scope of the invitee + */ + @JsonProperty("scope") + public String getScope() { + return scope; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateProjectInviteV1Request && equalTo((CreateProjectInviteV1Request) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateProjectInviteV1Request other) { + return email.equals(other.email) && scope.equals(other.scope); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.email, this.scope); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static EmailStage builder() { + return new Builder(); + } + + public interface EmailStage { + /** + *

The email address of the invitee

+ */ + ScopeStage email(@NotNull String email); + + Builder from(CreateProjectInviteV1Request other); + } + + public interface ScopeStage { + /** + *

The scope of the invitee

+ */ + _FinalStage scope(@NotNull String scope); + } + + public interface _FinalStage { + CreateProjectInviteV1Request build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements EmailStage, ScopeStage, _FinalStage { + private String email; + + private String scope; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateProjectInviteV1Request other) { + email(other.getEmail()); + scope(other.getScope()); + return this; + } + + /** + *

The email address of the invitee

+ *

The email address of the invitee

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

The scope of the invitee

+ *

The scope of the invitee

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("scope") + public _FinalStage scope(@NotNull String scope) { + this.scope = Objects.requireNonNull(scope, "scope must not be null"); + return this; + } + + @java.lang.Override + public CreateProjectInviteV1Request build() { + return new CreateProjectInviteV1Request(email, scope, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/members/scopes/AsyncRawScopesClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/members/scopes/AsyncRawScopesClient.java new file mode 100644 index 0000000..b0dcab0 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/members/scopes/AsyncRawScopesClient.java @@ -0,0 +1,198 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.members.scopes; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.DeepgramApiApiException; +import com.deepgram.core.DeepgramApiException; +import com.deepgram.core.DeepgramApiHttpResponse; +import com.deepgram.core.MediaTypes; +import com.deepgram.core.ObjectMappers; +import com.deepgram.core.RequestOptions; +import com.deepgram.errors.BadRequestError; +import com.deepgram.resources.manage.v1.projects.members.scopes.requests.UpdateProjectMemberScopesV1Request; +import com.deepgram.types.ListProjectMemberScopesV1Response; +import com.deepgram.types.UpdateProjectMemberScopesV1Response; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawScopesClient { + protected final ClientOptions clientOptions; + + public AsyncRawScopesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Retrieves a list of scopes for a specific member + */ + public CompletableFuture> list( + String projectId, String memberId) { + return list(projectId, memberId, null); + } + + /** + * Retrieves a list of scopes for a specific member + */ + public CompletableFuture> list( + String projectId, String memberId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("members") + .addPathSegment(memberId) + .addPathSegments("scopes"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListProjectMemberScopesV1Response.class), + response)); + return; + } + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Updates the scopes for a specific member + */ + public CompletableFuture> update( + String projectId, String memberId, UpdateProjectMemberScopesV1Request request) { + return update(projectId, memberId, request, null); + } + + /** + * Updates the scopes for a specific member + */ + public CompletableFuture> update( + String projectId, + String memberId, + UpdateProjectMemberScopesV1Request request, + RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("members") + .addPathSegment(memberId) + .addPathSegments("scopes"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new DeepgramApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PUT", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, UpdateProjectMemberScopesV1Response.class), + response)); + return; + } + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/members/scopes/AsyncScopesClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/members/scopes/AsyncScopesClient.java new file mode 100644 index 0000000..18bbcac --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/members/scopes/AsyncScopesClient.java @@ -0,0 +1,65 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.members.scopes; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.RequestOptions; +import com.deepgram.resources.manage.v1.projects.members.scopes.requests.UpdateProjectMemberScopesV1Request; +import com.deepgram.types.ListProjectMemberScopesV1Response; +import com.deepgram.types.UpdateProjectMemberScopesV1Response; +import java.util.concurrent.CompletableFuture; + +public class AsyncScopesClient { + protected final ClientOptions clientOptions; + + private final AsyncRawScopesClient rawClient; + + public AsyncScopesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawScopesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawScopesClient withRawResponse() { + return this.rawClient; + } + + /** + * Retrieves a list of scopes for a specific member + */ + public CompletableFuture list(String projectId, String memberId) { + return this.rawClient.list(projectId, memberId).thenApply(response -> response.body()); + } + + /** + * Retrieves a list of scopes for a specific member + */ + public CompletableFuture list( + String projectId, String memberId, RequestOptions requestOptions) { + return this.rawClient.list(projectId, memberId, requestOptions).thenApply(response -> response.body()); + } + + /** + * Updates the scopes for a specific member + */ + public CompletableFuture update( + String projectId, String memberId, UpdateProjectMemberScopesV1Request request) { + return this.rawClient.update(projectId, memberId, request).thenApply(response -> response.body()); + } + + /** + * Updates the scopes for a specific member + */ + public CompletableFuture update( + String projectId, + String memberId, + UpdateProjectMemberScopesV1Request request, + RequestOptions requestOptions) { + return this.rawClient + .update(projectId, memberId, request, requestOptions) + .thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/members/scopes/RawScopesClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/members/scopes/RawScopesClient.java new file mode 100644 index 0000000..9993a44 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/members/scopes/RawScopesClient.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.members.scopes; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.DeepgramApiApiException; +import com.deepgram.core.DeepgramApiException; +import com.deepgram.core.DeepgramApiHttpResponse; +import com.deepgram.core.MediaTypes; +import com.deepgram.core.ObjectMappers; +import com.deepgram.core.RequestOptions; +import com.deepgram.errors.BadRequestError; +import com.deepgram.resources.manage.v1.projects.members.scopes.requests.UpdateProjectMemberScopesV1Request; +import com.deepgram.types.ListProjectMemberScopesV1Response; +import com.deepgram.types.UpdateProjectMemberScopesV1Response; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawScopesClient { + protected final ClientOptions clientOptions; + + public RawScopesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Retrieves a list of scopes for a specific member + */ + public DeepgramApiHttpResponse list(String projectId, String memberId) { + return list(projectId, memberId, null); + } + + /** + * Retrieves a list of scopes for a specific member + */ + public DeepgramApiHttpResponse list( + String projectId, String memberId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("members") + .addPathSegment(memberId) + .addPathSegments("scopes"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListProjectMemberScopesV1Response.class), + response); + } + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new DeepgramApiException("Network error executing HTTP request", e); + } + } + + /** + * Updates the scopes for a specific member + */ + public DeepgramApiHttpResponse update( + String projectId, String memberId, UpdateProjectMemberScopesV1Request request) { + return update(projectId, memberId, request, null); + } + + /** + * Updates the scopes for a specific member + */ + public DeepgramApiHttpResponse update( + String projectId, + String memberId, + UpdateProjectMemberScopesV1Request request, + RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("members") + .addPathSegment(memberId) + .addPathSegments("scopes"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new DeepgramApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("PUT", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, UpdateProjectMemberScopesV1Response.class), + response); + } + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new DeepgramApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/members/scopes/ScopesClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/members/scopes/ScopesClient.java new file mode 100644 index 0000000..476ed47 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/members/scopes/ScopesClient.java @@ -0,0 +1,63 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.members.scopes; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.RequestOptions; +import com.deepgram.resources.manage.v1.projects.members.scopes.requests.UpdateProjectMemberScopesV1Request; +import com.deepgram.types.ListProjectMemberScopesV1Response; +import com.deepgram.types.UpdateProjectMemberScopesV1Response; + +public class ScopesClient { + protected final ClientOptions clientOptions; + + private final RawScopesClient rawClient; + + public ScopesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawScopesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawScopesClient withRawResponse() { + return this.rawClient; + } + + /** + * Retrieves a list of scopes for a specific member + */ + public ListProjectMemberScopesV1Response list(String projectId, String memberId) { + return this.rawClient.list(projectId, memberId).body(); + } + + /** + * Retrieves a list of scopes for a specific member + */ + public ListProjectMemberScopesV1Response list(String projectId, String memberId, RequestOptions requestOptions) { + return this.rawClient.list(projectId, memberId, requestOptions).body(); + } + + /** + * Updates the scopes for a specific member + */ + public UpdateProjectMemberScopesV1Response update( + String projectId, String memberId, UpdateProjectMemberScopesV1Request request) { + return this.rawClient.update(projectId, memberId, request).body(); + } + + /** + * Updates the scopes for a specific member + */ + public UpdateProjectMemberScopesV1Response update( + String projectId, + String memberId, + UpdateProjectMemberScopesV1Request request, + RequestOptions requestOptions) { + return this.rawClient + .update(projectId, memberId, request, requestOptions) + .body(); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/members/scopes/requests/UpdateProjectMemberScopesV1Request.java b/src/main/java/com/deepgram/resources/manage/v1/projects/members/scopes/requests/UpdateProjectMemberScopesV1Request.java new file mode 100644 index 0000000..4bbb024 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/members/scopes/requests/UpdateProjectMemberScopesV1Request.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.members.scopes.requests; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateProjectMemberScopesV1Request.Builder.class) +public final class UpdateProjectMemberScopesV1Request { + private final String scope; + + private final Map additionalProperties; + + private UpdateProjectMemberScopesV1Request(String scope, Map additionalProperties) { + this.scope = scope; + this.additionalProperties = additionalProperties; + } + + /** + * @return A scope to update + */ + @JsonProperty("scope") + public String getScope() { + return scope; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateProjectMemberScopesV1Request + && equalTo((UpdateProjectMemberScopesV1Request) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateProjectMemberScopesV1Request other) { + return scope.equals(other.scope); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.scope); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ScopeStage builder() { + return new Builder(); + } + + public interface ScopeStage { + /** + *

A scope to update

+ */ + _FinalStage scope(@NotNull String scope); + + Builder from(UpdateProjectMemberScopesV1Request other); + } + + public interface _FinalStage { + UpdateProjectMemberScopesV1Request build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ScopeStage, _FinalStage { + private String scope; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateProjectMemberScopesV1Request other) { + scope(other.getScope()); + return this; + } + + /** + *

A scope to update

+ *

A scope to update

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("scope") + public _FinalStage scope(@NotNull String scope) { + this.scope = Objects.requireNonNull(scope, "scope must not be null"); + return this; + } + + @java.lang.Override + public UpdateProjectMemberScopesV1Request build() { + return new UpdateProjectMemberScopesV1Request(scope, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/models/AsyncModelsClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/models/AsyncModelsClient.java new file mode 100644 index 0000000..46e071d --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/models/AsyncModelsClient.java @@ -0,0 +1,72 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.models; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.RequestOptions; +import com.deepgram.resources.manage.v1.projects.models.requests.ModelsListRequest; +import com.deepgram.types.GetModelV1Response; +import com.deepgram.types.ListModelsV1Response; +import java.util.concurrent.CompletableFuture; + +public class AsyncModelsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawModelsClient rawClient; + + public AsyncModelsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawModelsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawModelsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns metadata on all the latest models that a specific project has access to, including non-public models + */ + public CompletableFuture list(String projectId) { + return this.rawClient.list(projectId).thenApply(response -> response.body()); + } + + /** + * Returns metadata on all the latest models that a specific project has access to, including non-public models + */ + public CompletableFuture list(String projectId, RequestOptions requestOptions) { + return this.rawClient.list(projectId, requestOptions).thenApply(response -> response.body()); + } + + /** + * Returns metadata on all the latest models that a specific project has access to, including non-public models + */ + public CompletableFuture list(String projectId, ModelsListRequest request) { + return this.rawClient.list(projectId, request).thenApply(response -> response.body()); + } + + /** + * Returns metadata on all the latest models that a specific project has access to, including non-public models + */ + public CompletableFuture list( + String projectId, ModelsListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(projectId, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Returns metadata for a specific model + */ + public CompletableFuture get(String projectId, String modelId) { + return this.rawClient.get(projectId, modelId).thenApply(response -> response.body()); + } + + /** + * Returns metadata for a specific model + */ + public CompletableFuture get(String projectId, String modelId, RequestOptions requestOptions) { + return this.rawClient.get(projectId, modelId, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/models/AsyncRawModelsClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/models/AsyncRawModelsClient.java new file mode 100644 index 0000000..da8d98d --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/models/AsyncRawModelsClient.java @@ -0,0 +1,197 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.models; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.DeepgramApiApiException; +import com.deepgram.core.DeepgramApiException; +import com.deepgram.core.DeepgramApiHttpResponse; +import com.deepgram.core.ObjectMappers; +import com.deepgram.core.QueryStringMapper; +import com.deepgram.core.RequestOptions; +import com.deepgram.errors.BadRequestError; +import com.deepgram.resources.manage.v1.projects.models.requests.ModelsListRequest; +import com.deepgram.types.GetModelV1Response; +import com.deepgram.types.ListModelsV1Response; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawModelsClient { + protected final ClientOptions clientOptions; + + public AsyncRawModelsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns metadata on all the latest models that a specific project has access to, including non-public models + */ + public CompletableFuture> list(String projectId) { + return list(projectId, ModelsListRequest.builder().build()); + } + + /** + * Returns metadata on all the latest models that a specific project has access to, including non-public models + */ + public CompletableFuture> list( + String projectId, RequestOptions requestOptions) { + return list(projectId, ModelsListRequest.builder().build(), requestOptions); + } + + /** + * Returns metadata on all the latest models that a specific project has access to, including non-public models + */ + public CompletableFuture> list( + String projectId, ModelsListRequest request) { + return list(projectId, request, null); + } + + /** + * Returns metadata on all the latest models that a specific project has access to, including non-public models + */ + public CompletableFuture> list( + String projectId, ModelsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("models"); + if (request.getIncludeOutdated().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "include_outdated", request.getIncludeOutdated().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListModelsV1Response.class), + response)); + return; + } + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Returns metadata for a specific model + */ + public CompletableFuture> get(String projectId, String modelId) { + return get(projectId, modelId, null); + } + + /** + * Returns metadata for a specific model + */ + public CompletableFuture> get( + String projectId, String modelId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("models") + .addPathSegment(modelId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetModelV1Response.class), + response)); + return; + } + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/models/ModelsClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/models/ModelsClient.java new file mode 100644 index 0000000..26b8622 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/models/ModelsClient.java @@ -0,0 +1,70 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.models; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.RequestOptions; +import com.deepgram.resources.manage.v1.projects.models.requests.ModelsListRequest; +import com.deepgram.types.GetModelV1Response; +import com.deepgram.types.ListModelsV1Response; + +public class ModelsClient { + protected final ClientOptions clientOptions; + + private final RawModelsClient rawClient; + + public ModelsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawModelsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawModelsClient withRawResponse() { + return this.rawClient; + } + + /** + * Returns metadata on all the latest models that a specific project has access to, including non-public models + */ + public ListModelsV1Response list(String projectId) { + return this.rawClient.list(projectId).body(); + } + + /** + * Returns metadata on all the latest models that a specific project has access to, including non-public models + */ + public ListModelsV1Response list(String projectId, RequestOptions requestOptions) { + return this.rawClient.list(projectId, requestOptions).body(); + } + + /** + * Returns metadata on all the latest models that a specific project has access to, including non-public models + */ + public ListModelsV1Response list(String projectId, ModelsListRequest request) { + return this.rawClient.list(projectId, request).body(); + } + + /** + * Returns metadata on all the latest models that a specific project has access to, including non-public models + */ + public ListModelsV1Response list(String projectId, ModelsListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(projectId, request, requestOptions).body(); + } + + /** + * Returns metadata for a specific model + */ + public GetModelV1Response get(String projectId, String modelId) { + return this.rawClient.get(projectId, modelId).body(); + } + + /** + * Returns metadata for a specific model + */ + public GetModelV1Response get(String projectId, String modelId, RequestOptions requestOptions) { + return this.rawClient.get(projectId, modelId, requestOptions).body(); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/models/RawModelsClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/models/RawModelsClient.java new file mode 100644 index 0000000..966c8f7 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/models/RawModelsClient.java @@ -0,0 +1,161 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.models; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.DeepgramApiApiException; +import com.deepgram.core.DeepgramApiException; +import com.deepgram.core.DeepgramApiHttpResponse; +import com.deepgram.core.ObjectMappers; +import com.deepgram.core.QueryStringMapper; +import com.deepgram.core.RequestOptions; +import com.deepgram.errors.BadRequestError; +import com.deepgram.resources.manage.v1.projects.models.requests.ModelsListRequest; +import com.deepgram.types.GetModelV1Response; +import com.deepgram.types.ListModelsV1Response; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawModelsClient { + protected final ClientOptions clientOptions; + + public RawModelsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Returns metadata on all the latest models that a specific project has access to, including non-public models + */ + public DeepgramApiHttpResponse list(String projectId) { + return list(projectId, ModelsListRequest.builder().build()); + } + + /** + * Returns metadata on all the latest models that a specific project has access to, including non-public models + */ + public DeepgramApiHttpResponse list(String projectId, RequestOptions requestOptions) { + return list(projectId, ModelsListRequest.builder().build(), requestOptions); + } + + /** + * Returns metadata on all the latest models that a specific project has access to, including non-public models + */ + public DeepgramApiHttpResponse list(String projectId, ModelsListRequest request) { + return list(projectId, request, null); + } + + /** + * Returns metadata on all the latest models that a specific project has access to, including non-public models + */ + public DeepgramApiHttpResponse list( + String projectId, ModelsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("models"); + if (request.getIncludeOutdated().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "include_outdated", request.getIncludeOutdated().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListModelsV1Response.class), response); + } + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new DeepgramApiException("Network error executing HTTP request", e); + } + } + + /** + * Returns metadata for a specific model + */ + public DeepgramApiHttpResponse get(String projectId, String modelId) { + return get(projectId, modelId, null); + } + + /** + * Returns metadata for a specific model + */ + public DeepgramApiHttpResponse get( + String projectId, String modelId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("models") + .addPathSegment(modelId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetModelV1Response.class), response); + } + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new DeepgramApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/models/requests/ModelsListRequest.java b/src/main/java/com/deepgram/resources/manage/v1/projects/models/requests/ModelsListRequest.java new file mode 100644 index 0000000..ae16285 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/models/requests/ModelsListRequest.java @@ -0,0 +1,111 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.models.requests; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ModelsListRequest.Builder.class) +public final class ModelsListRequest { + private final Optional includeOutdated; + + private final Map additionalProperties; + + private ModelsListRequest(Optional includeOutdated, Map additionalProperties) { + this.includeOutdated = includeOutdated; + this.additionalProperties = additionalProperties; + } + + /** + * @return

non-latest versions of models

+ */ + @JsonIgnore + public Optional getIncludeOutdated() { + return includeOutdated; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ModelsListRequest && equalTo((ModelsListRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ModelsListRequest other) { + return includeOutdated.equals(other.includeOutdated); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.includeOutdated); + } + + @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 includeOutdated = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ModelsListRequest other) { + includeOutdated(other.getIncludeOutdated()); + return this; + } + + /** + *

returns non-latest versions of models

+ */ + @JsonSetter(value = "include_outdated", nulls = Nulls.SKIP) + public Builder includeOutdated(Optional includeOutdated) { + this.includeOutdated = includeOutdated; + return this; + } + + public Builder includeOutdated(Boolean includeOutdated) { + this.includeOutdated = Optional.ofNullable(includeOutdated); + return this; + } + + public ModelsListRequest build() { + return new ModelsListRequest(includeOutdated, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/requests/AsyncRawRequestsClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/requests/AsyncRawRequestsClient.java new file mode 100644 index 0000000..73ae0fa --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/requests/AsyncRawRequestsClient.java @@ -0,0 +1,235 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.requests; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.DeepgramApiApiException; +import com.deepgram.core.DeepgramApiException; +import com.deepgram.core.DeepgramApiHttpResponse; +import com.deepgram.core.ObjectMappers; +import com.deepgram.core.QueryStringMapper; +import com.deepgram.core.RequestOptions; +import com.deepgram.errors.BadRequestError; +import com.deepgram.resources.manage.v1.projects.requests.requests.RequestsListRequest; +import com.deepgram.types.GetProjectRequestV1Response; +import com.deepgram.types.ListProjectRequestsV1Response; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawRequestsClient { + protected final ClientOptions clientOptions; + + public AsyncRawRequestsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Generates a list of requests for a specific project + */ + public CompletableFuture> list(String projectId) { + return list(projectId, RequestsListRequest.builder().build()); + } + + /** + * Generates a list of requests for a specific project + */ + public CompletableFuture> list( + String projectId, RequestOptions requestOptions) { + return list(projectId, RequestsListRequest.builder().build(), requestOptions); + } + + /** + * Generates a list of requests for a specific project + */ + public CompletableFuture> list( + String projectId, RequestsListRequest request) { + return list(projectId, request, null); + } + + /** + * Generates a list of requests for a specific project + */ + public CompletableFuture> list( + String projectId, RequestsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("requests"); + if (request.getStart().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "start", request.getStart().get(), false); + } + if (request.getEnd().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "end", request.getEnd().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getPage().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "page", request.getPage().get(), false); + } + if (request.getAccessor().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "accessor", request.getAccessor().get(), false); + } + if (request.getRequestId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "request_id", request.getRequestId().get(), false); + } + if (request.getDeployment().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "deployment", request.getDeployment().get(), false); + } + if (request.getEndpoint().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "endpoint", request.getEndpoint().get(), false); + } + if (request.getMethod().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "method", request.getMethod().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListProjectRequestsV1Response.class), + response)); + return; + } + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Retrieves a specific request for a specific project + */ + public CompletableFuture> get( + String projectId, String requestId) { + return get(projectId, requestId, null); + } + + /** + * Retrieves a specific request for a specific project + */ + public CompletableFuture> get( + String projectId, String requestId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("requests") + .addPathSegment(requestId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, GetProjectRequestV1Response.class), + response)); + return; + } + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/requests/AsyncRequestsClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/requests/AsyncRequestsClient.java new file mode 100644 index 0000000..9011e73 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/requests/AsyncRequestsClient.java @@ -0,0 +1,73 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.requests; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.RequestOptions; +import com.deepgram.resources.manage.v1.projects.requests.requests.RequestsListRequest; +import com.deepgram.types.GetProjectRequestV1Response; +import com.deepgram.types.ListProjectRequestsV1Response; +import java.util.concurrent.CompletableFuture; + +public class AsyncRequestsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawRequestsClient rawClient; + + public AsyncRequestsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawRequestsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawRequestsClient withRawResponse() { + return this.rawClient; + } + + /** + * Generates a list of requests for a specific project + */ + public CompletableFuture list(String projectId) { + return this.rawClient.list(projectId).thenApply(response -> response.body()); + } + + /** + * Generates a list of requests for a specific project + */ + public CompletableFuture list(String projectId, RequestOptions requestOptions) { + return this.rawClient.list(projectId, requestOptions).thenApply(response -> response.body()); + } + + /** + * Generates a list of requests for a specific project + */ + public CompletableFuture list(String projectId, RequestsListRequest request) { + return this.rawClient.list(projectId, request).thenApply(response -> response.body()); + } + + /** + * Generates a list of requests for a specific project + */ + public CompletableFuture list( + String projectId, RequestsListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(projectId, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves a specific request for a specific project + */ + public CompletableFuture get(String projectId, String requestId) { + return this.rawClient.get(projectId, requestId).thenApply(response -> response.body()); + } + + /** + * Retrieves a specific request for a specific project + */ + public CompletableFuture get( + String projectId, String requestId, RequestOptions requestOptions) { + return this.rawClient.get(projectId, requestId, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/requests/ProjectsGetRequest.java b/src/main/java/com/deepgram/resources/manage/v1/projects/requests/ProjectsGetRequest.java new file mode 100644 index 0000000..46bf0f7 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/requests/ProjectsGetRequest.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.requests; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ProjectsGetRequest.Builder.class) +public final class ProjectsGetRequest { + private final Optional limit; + + private final Optional page; + + private final Map additionalProperties; + + private ProjectsGetRequest( + Optional limit, Optional page, Map additionalProperties) { + this.limit = limit; + this.page = page; + this.additionalProperties = additionalProperties; + } + + /** + * @return Number of results to return per page. Default 10. Range [1,1000] + */ + @JsonIgnore + public Optional getLimit() { + return limit; + } + + /** + * @return Navigate and return the results to retrieve specific portions of information of the response + */ + @JsonIgnore + public Optional getPage() { + return page; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ProjectsGetRequest && equalTo((ProjectsGetRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ProjectsGetRequest other) { + return limit.equals(other.limit) && page.equals(other.page); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.limit, this.page); + } + + @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 page = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ProjectsGetRequest other) { + limit(other.getLimit()); + page(other.getPage()); + return this; + } + + /** + *

Number of results to return per page. Default 10. Range [1,1000]

+ */ + @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; + } + + /** + *

Navigate and return the results to retrieve specific portions of information of the response

+ */ + @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; + } + + public ProjectsGetRequest build() { + return new ProjectsGetRequest(limit, page, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/requests/RawRequestsClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/requests/RawRequestsClient.java new file mode 100644 index 0000000..66c5c54 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/requests/RawRequestsClient.java @@ -0,0 +1,199 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.requests; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.DeepgramApiApiException; +import com.deepgram.core.DeepgramApiException; +import com.deepgram.core.DeepgramApiHttpResponse; +import com.deepgram.core.ObjectMappers; +import com.deepgram.core.QueryStringMapper; +import com.deepgram.core.RequestOptions; +import com.deepgram.errors.BadRequestError; +import com.deepgram.resources.manage.v1.projects.requests.requests.RequestsListRequest; +import com.deepgram.types.GetProjectRequestV1Response; +import com.deepgram.types.ListProjectRequestsV1Response; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawRequestsClient { + protected final ClientOptions clientOptions; + + public RawRequestsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Generates a list of requests for a specific project + */ + public DeepgramApiHttpResponse list(String projectId) { + return list(projectId, RequestsListRequest.builder().build()); + } + + /** + * Generates a list of requests for a specific project + */ + public DeepgramApiHttpResponse list( + String projectId, RequestOptions requestOptions) { + return list(projectId, RequestsListRequest.builder().build(), requestOptions); + } + + /** + * Generates a list of requests for a specific project + */ + public DeepgramApiHttpResponse list(String projectId, RequestsListRequest request) { + return list(projectId, request, null); + } + + /** + * Generates a list of requests for a specific project + */ + public DeepgramApiHttpResponse list( + String projectId, RequestsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("requests"); + if (request.getStart().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "start", request.getStart().get(), false); + } + if (request.getEnd().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "end", request.getEnd().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getPage().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "page", request.getPage().get(), false); + } + if (request.getAccessor().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "accessor", request.getAccessor().get(), false); + } + if (request.getRequestId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "request_id", request.getRequestId().get(), false); + } + if (request.getDeployment().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "deployment", request.getDeployment().get(), false); + } + if (request.getEndpoint().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "endpoint", request.getEndpoint().get(), false); + } + if (request.getMethod().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "method", request.getMethod().get(), false); + } + if (request.getStatus().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "status", request.getStatus().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListProjectRequestsV1Response.class), + response); + } + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new DeepgramApiException("Network error executing HTTP request", e); + } + } + + /** + * Retrieves a specific request for a specific project + */ + public DeepgramApiHttpResponse get(String projectId, String requestId) { + return get(projectId, requestId, null); + } + + /** + * Retrieves a specific request for a specific project + */ + public DeepgramApiHttpResponse get( + String projectId, String requestId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("requests") + .addPathSegment(requestId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetProjectRequestV1Response.class), + response); + } + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new DeepgramApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/requests/RequestsClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/requests/RequestsClient.java new file mode 100644 index 0000000..07bc5da --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/requests/RequestsClient.java @@ -0,0 +1,71 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.requests; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.RequestOptions; +import com.deepgram.resources.manage.v1.projects.requests.requests.RequestsListRequest; +import com.deepgram.types.GetProjectRequestV1Response; +import com.deepgram.types.ListProjectRequestsV1Response; + +public class RequestsClient { + protected final ClientOptions clientOptions; + + private final RawRequestsClient rawClient; + + public RequestsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawRequestsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawRequestsClient withRawResponse() { + return this.rawClient; + } + + /** + * Generates a list of requests for a specific project + */ + public ListProjectRequestsV1Response list(String projectId) { + return this.rawClient.list(projectId).body(); + } + + /** + * Generates a list of requests for a specific project + */ + public ListProjectRequestsV1Response list(String projectId, RequestOptions requestOptions) { + return this.rawClient.list(projectId, requestOptions).body(); + } + + /** + * Generates a list of requests for a specific project + */ + public ListProjectRequestsV1Response list(String projectId, RequestsListRequest request) { + return this.rawClient.list(projectId, request).body(); + } + + /** + * Generates a list of requests for a specific project + */ + public ListProjectRequestsV1Response list( + String projectId, RequestsListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(projectId, request, requestOptions).body(); + } + + /** + * Retrieves a specific request for a specific project + */ + public GetProjectRequestV1Response get(String projectId, String requestId) { + return this.rawClient.get(projectId, requestId).body(); + } + + /** + * Retrieves a specific request for a specific project + */ + public GetProjectRequestV1Response get(String projectId, String requestId, RequestOptions requestOptions) { + return this.rawClient.get(projectId, requestId, requestOptions).body(); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/requests/UpdateProjectV1Request.java b/src/main/java/com/deepgram/resources/manage/v1/projects/requests/UpdateProjectV1Request.java new file mode 100644 index 0000000..9c306fd --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/requests/UpdateProjectV1Request.java @@ -0,0 +1,111 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.requests; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateProjectV1Request.Builder.class) +public final class UpdateProjectV1Request { + private final Optional name; + + private final Map additionalProperties; + + private UpdateProjectV1Request(Optional name, Map additionalProperties) { + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return The name of the project + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateProjectV1Request && equalTo((UpdateProjectV1Request) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateProjectV1Request 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(UpdateProjectV1Request other) { + name(other.getName()); + return this; + } + + /** + *

The name of the project

+ */ + @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 UpdateProjectV1Request build() { + return new UpdateProjectV1Request(name, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/requests/requests/RequestsListRequest.java b/src/main/java/com/deepgram/resources/manage/v1/projects/requests/requests/RequestsListRequest.java new file mode 100644 index 0000000..ec38331 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/requests/requests/RequestsListRequest.java @@ -0,0 +1,409 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.requests.requests; + +import com.deepgram.core.ObjectMappers; +import com.deepgram.resources.manage.v1.projects.requests.types.RequestsListRequestDeployment; +import com.deepgram.resources.manage.v1.projects.requests.types.RequestsListRequestEndpoint; +import com.deepgram.resources.manage.v1.projects.requests.types.RequestsListRequestMethod; +import com.deepgram.resources.manage.v1.projects.requests.types.RequestsListRequestStatus; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +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 = RequestsListRequest.Builder.class) +public final class RequestsListRequest { + private final Optional start; + + private final Optional end; + + private final Optional limit; + + private final Optional page; + + private final Optional accessor; + + private final Optional requestId; + + private final Optional deployment; + + private final Optional endpoint; + + private final Optional method; + + private final Optional status; + + private final Map additionalProperties; + + private RequestsListRequest( + Optional start, + Optional end, + Optional limit, + Optional page, + Optional accessor, + Optional requestId, + Optional deployment, + Optional endpoint, + Optional method, + Optional status, + Map additionalProperties) { + this.start = start; + this.end = end; + this.limit = limit; + this.page = page; + this.accessor = accessor; + this.requestId = requestId; + this.deployment = deployment; + this.endpoint = endpoint; + this.method = method; + this.status = status; + this.additionalProperties = additionalProperties; + } + + /** + * @return Start date of the requested date range. Formats accepted are YYYY-MM-DD, YYYY-MM-DDTHH:MM:SS, or YYYY-MM-DDTHH:MM:SS+HH:MM + */ + @JsonIgnore + public Optional getStart() { + return start; + } + + /** + * @return End date of the requested date range. Formats accepted are YYYY-MM-DD, YYYY-MM-DDTHH:MM:SS, or YYYY-MM-DDTHH:MM:SS+HH:MM + */ + @JsonIgnore + public Optional getEnd() { + return end; + } + + /** + * @return Number of results to return per page. Default 10. Range [1,1000] + */ + @JsonIgnore + public Optional getLimit() { + return limit; + } + + /** + * @return Navigate and return the results to retrieve specific portions of information of the response + */ + @JsonIgnore + public Optional getPage() { + return page; + } + + /** + * @return Filter for requests where a specific accessor was used + */ + @JsonIgnore + public Optional getAccessor() { + return accessor; + } + + /** + * @return Filter for a specific request id + */ + @JsonIgnore + public Optional getRequestId() { + return requestId; + } + + /** + * @return Filter for requests where a specific deployment was used + */ + @JsonIgnore + public Optional getDeployment() { + return deployment; + } + + /** + * @return Filter for requests where a specific endpoint was used + */ + @JsonIgnore + public Optional getEndpoint() { + return endpoint; + } + + /** + * @return Filter for requests where a specific method was used + */ + @JsonIgnore + public Optional getMethod() { + return method; + } + + /** + * @return Filter for requests that succeeded (status code < 300) or failed (status code >=400) + */ + @JsonIgnore + public Optional getStatus() { + return status; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestsListRequest && equalTo((RequestsListRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RequestsListRequest other) { + return start.equals(other.start) + && end.equals(other.end) + && limit.equals(other.limit) + && page.equals(other.page) + && accessor.equals(other.accessor) + && requestId.equals(other.requestId) + && deployment.equals(other.deployment) + && endpoint.equals(other.endpoint) + && method.equals(other.method) + && status.equals(other.status); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.start, + this.end, + this.limit, + this.page, + this.accessor, + this.requestId, + this.deployment, + this.endpoint, + this.method, + this.status); + } + + @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 start = Optional.empty(); + + private Optional end = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional page = Optional.empty(); + + private Optional accessor = Optional.empty(); + + private Optional requestId = Optional.empty(); + + private Optional deployment = Optional.empty(); + + private Optional endpoint = Optional.empty(); + + private Optional method = Optional.empty(); + + private Optional status = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RequestsListRequest other) { + start(other.getStart()); + end(other.getEnd()); + limit(other.getLimit()); + page(other.getPage()); + accessor(other.getAccessor()); + requestId(other.getRequestId()); + deployment(other.getDeployment()); + endpoint(other.getEndpoint()); + method(other.getMethod()); + status(other.getStatus()); + return this; + } + + /** + *

Start date of the requested date range. Formats accepted are YYYY-MM-DD, YYYY-MM-DDTHH:MM:SS, or YYYY-MM-DDTHH:MM:SS+HH:MM

+ */ + @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; + } + + /** + *

End date of the requested date range. Formats accepted are YYYY-MM-DD, YYYY-MM-DDTHH:MM:SS, or YYYY-MM-DDTHH:MM:SS+HH:MM

+ */ + @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; + } + + /** + *

Number of results to return per page. Default 10. Range [1,1000]

+ */ + @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; + } + + /** + *

Navigate and return the results to retrieve specific portions of information of the response

+ */ + @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; + } + + /** + *

Filter for requests where a specific accessor was used

+ */ + @JsonSetter(value = "accessor", nulls = Nulls.SKIP) + public Builder accessor(Optional accessor) { + this.accessor = accessor; + return this; + } + + public Builder accessor(String accessor) { + this.accessor = Optional.ofNullable(accessor); + return this; + } + + /** + *

Filter for a specific request id

+ */ + @JsonSetter(value = "request_id", nulls = Nulls.SKIP) + public Builder requestId(Optional requestId) { + this.requestId = requestId; + return this; + } + + public Builder requestId(String requestId) { + this.requestId = Optional.ofNullable(requestId); + return this; + } + + /** + *

Filter for requests where a specific deployment was used

+ */ + @JsonSetter(value = "deployment", nulls = Nulls.SKIP) + public Builder deployment(Optional deployment) { + this.deployment = deployment; + return this; + } + + public Builder deployment(RequestsListRequestDeployment deployment) { + this.deployment = Optional.ofNullable(deployment); + return this; + } + + /** + *

Filter for requests where a specific endpoint was used

+ */ + @JsonSetter(value = "endpoint", nulls = Nulls.SKIP) + public Builder endpoint(Optional endpoint) { + this.endpoint = endpoint; + return this; + } + + public Builder endpoint(RequestsListRequestEndpoint endpoint) { + this.endpoint = Optional.ofNullable(endpoint); + return this; + } + + /** + *

Filter for requests where a specific method was used

+ */ + @JsonSetter(value = "method", nulls = Nulls.SKIP) + public Builder method(Optional method) { + this.method = method; + return this; + } + + public Builder method(RequestsListRequestMethod method) { + this.method = Optional.ofNullable(method); + return this; + } + + /** + *

Filter for requests that succeeded (status code < 300) or failed (status code >=400)

+ */ + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(RequestsListRequestStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + public RequestsListRequest build() { + return new RequestsListRequest( + start, + end, + limit, + page, + accessor, + requestId, + deployment, + endpoint, + method, + status, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/requests/types/RequestsListRequestDeployment.java b/src/main/java/com/deepgram/resources/manage/v1/projects/requests/types/RequestsListRequestDeployment.java new file mode 100644 index 0000000..ed06f8f --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/requests/types/RequestsListRequestDeployment.java @@ -0,0 +1,96 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.requests.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RequestsListRequestDeployment { + public static final RequestsListRequestDeployment SELF_HOSTED = + new RequestsListRequestDeployment(Value.SELF_HOSTED, "self-hosted"); + + public static final RequestsListRequestDeployment BETA = new RequestsListRequestDeployment(Value.BETA, "beta"); + + public static final RequestsListRequestDeployment HOSTED = + new RequestsListRequestDeployment(Value.HOSTED, "hosted"); + + private final Value value; + + private final String string; + + RequestsListRequestDeployment(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RequestsListRequestDeployment + && this.string.equals(((RequestsListRequestDeployment) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SELF_HOSTED: + return visitor.visitSelfHosted(); + case BETA: + return visitor.visitBeta(); + case HOSTED: + return visitor.visitHosted(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RequestsListRequestDeployment valueOf(String value) { + switch (value) { + case "self-hosted": + return SELF_HOSTED; + case "beta": + return BETA; + case "hosted": + return HOSTED; + default: + return new RequestsListRequestDeployment(Value.UNKNOWN, value); + } + } + + public enum Value { + HOSTED, + + BETA, + + SELF_HOSTED, + + UNKNOWN + } + + public interface Visitor { + T visitHosted(); + + T visitBeta(); + + T visitSelfHosted(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/requests/types/RequestsListRequestEndpoint.java b/src/main/java/com/deepgram/resources/manage/v1/projects/requests/types/RequestsListRequestEndpoint.java new file mode 100644 index 0000000..c431f1d --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/requests/types/RequestsListRequestEndpoint.java @@ -0,0 +1,104 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.requests.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RequestsListRequestEndpoint { + public static final RequestsListRequestEndpoint AGENT = new RequestsListRequestEndpoint(Value.AGENT, "agent"); + + public static final RequestsListRequestEndpoint READ = new RequestsListRequestEndpoint(Value.READ, "read"); + + public static final RequestsListRequestEndpoint LISTEN = new RequestsListRequestEndpoint(Value.LISTEN, "listen"); + + public static final RequestsListRequestEndpoint SPEAK = new RequestsListRequestEndpoint(Value.SPEAK, "speak"); + + private final Value value; + + private final String string; + + RequestsListRequestEndpoint(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RequestsListRequestEndpoint + && this.string.equals(((RequestsListRequestEndpoint) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case AGENT: + return visitor.visitAgent(); + case READ: + return visitor.visitRead(); + case LISTEN: + return visitor.visitListen(); + case SPEAK: + return visitor.visitSpeak(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RequestsListRequestEndpoint valueOf(String value) { + switch (value) { + case "agent": + return AGENT; + case "read": + return READ; + case "listen": + return LISTEN; + case "speak": + return SPEAK; + default: + return new RequestsListRequestEndpoint(Value.UNKNOWN, value); + } + } + + public enum Value { + LISTEN, + + READ, + + SPEAK, + + AGENT, + + UNKNOWN + } + + public interface Visitor { + T visitListen(); + + T visitRead(); + + T visitSpeak(); + + T visitAgent(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/requests/types/RequestsListRequestMethod.java b/src/main/java/com/deepgram/resources/manage/v1/projects/requests/types/RequestsListRequestMethod.java new file mode 100644 index 0000000..b1da845 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/requests/types/RequestsListRequestMethod.java @@ -0,0 +1,95 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.requests.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RequestsListRequestMethod { + public static final RequestsListRequestMethod SYNC = new RequestsListRequestMethod(Value.SYNC, "sync"); + + public static final RequestsListRequestMethod STREAMING = + new RequestsListRequestMethod(Value.STREAMING, "streaming"); + + public static final RequestsListRequestMethod ASYNC = new RequestsListRequestMethod(Value.ASYNC, "async"); + + private final Value value; + + private final String string; + + RequestsListRequestMethod(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RequestsListRequestMethod + && this.string.equals(((RequestsListRequestMethod) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SYNC: + return visitor.visitSync(); + case STREAMING: + return visitor.visitStreaming(); + case ASYNC: + return visitor.visitAsync(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RequestsListRequestMethod valueOf(String value) { + switch (value) { + case "sync": + return SYNC; + case "streaming": + return STREAMING; + case "async": + return ASYNC; + default: + return new RequestsListRequestMethod(Value.UNKNOWN, value); + } + } + + public enum Value { + SYNC, + + ASYNC, + + STREAMING, + + UNKNOWN + } + + public interface Visitor { + T visitSync(); + + T visitAsync(); + + T visitStreaming(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/requests/types/RequestsListRequestStatus.java b/src/main/java/com/deepgram/resources/manage/v1/projects/requests/types/RequestsListRequestStatus.java new file mode 100644 index 0000000..c58d250 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/requests/types/RequestsListRequestStatus.java @@ -0,0 +1,85 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.requests.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class RequestsListRequestStatus { + public static final RequestsListRequestStatus SUCCEEDED = + new RequestsListRequestStatus(Value.SUCCEEDED, "succeeded"); + + public static final RequestsListRequestStatus FAILED = new RequestsListRequestStatus(Value.FAILED, "failed"); + + private final Value value; + + private final String string; + + RequestsListRequestStatus(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof RequestsListRequestStatus + && this.string.equals(((RequestsListRequestStatus) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SUCCEEDED: + return visitor.visitSucceeded(); + case FAILED: + return visitor.visitFailed(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static RequestsListRequestStatus valueOf(String value) { + switch (value) { + case "succeeded": + return SUCCEEDED; + case "failed": + return FAILED; + default: + return new RequestsListRequestStatus(Value.UNKNOWN, value); + } + } + + public enum Value { + SUCCEEDED, + + FAILED, + + UNKNOWN + } + + public interface Visitor { + T visitSucceeded(); + + T visitFailed(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/usage/AsyncRawUsageClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/usage/AsyncRawUsageClient.java new file mode 100644 index 0000000..b65f561 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/usage/AsyncRawUsageClient.java @@ -0,0 +1,294 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.usage; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.DeepgramApiApiException; +import com.deepgram.core.DeepgramApiException; +import com.deepgram.core.DeepgramApiHttpResponse; +import com.deepgram.core.ObjectMappers; +import com.deepgram.core.QueryStringMapper; +import com.deepgram.core.RequestOptions; +import com.deepgram.errors.BadRequestError; +import com.deepgram.resources.manage.v1.projects.usage.requests.UsageGetRequest; +import com.deepgram.types.UsageV1Response; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawUsageClient { + protected final ClientOptions clientOptions; + + public AsyncRawUsageClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Retrieves the usage for a specific project. Use Get Project Usage Breakdown for a more comprehensive usage summary. + */ + public CompletableFuture> get(String projectId) { + return get(projectId, UsageGetRequest.builder().build()); + } + + /** + * Retrieves the usage for a specific project. Use Get Project Usage Breakdown for a more comprehensive usage summary. + */ + public CompletableFuture> get( + String projectId, RequestOptions requestOptions) { + return get(projectId, UsageGetRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the usage for a specific project. Use Get Project Usage Breakdown for a more comprehensive usage summary. + */ + public CompletableFuture> get(String projectId, UsageGetRequest request) { + return get(projectId, request, null); + } + + /** + * Retrieves the usage for a specific project. Use Get Project Usage Breakdown for a more comprehensive usage summary. + */ + public CompletableFuture> get( + String projectId, UsageGetRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("usage"); + if (request.getStart().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "start", request.getStart().get(), false); + } + if (request.getEnd().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "end", request.getEnd().get(), false); + } + if (request.getAccessor().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "accessor", request.getAccessor().get(), false); + } + if (request.getAlternatives().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "alternatives", request.getAlternatives().get(), false); + } + if (request.getCallbackMethod().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "callback_method", request.getCallbackMethod().get(), false); + } + if (request.getCallback().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "callback", request.getCallback().get(), false); + } + if (request.getChannels().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "channels", request.getChannels().get(), false); + } + if (request.getCustomIntentMode().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "custom_intent_mode", request.getCustomIntentMode().get(), false); + } + if (request.getCustomIntent().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "custom_intent", request.getCustomIntent().get(), false); + } + if (request.getCustomTopicMode().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "custom_topic_mode", request.getCustomTopicMode().get(), false); + } + if (request.getCustomTopic().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "custom_topic", request.getCustomTopic().get(), false); + } + if (request.getDeployment().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "deployment", request.getDeployment().get(), false); + } + if (request.getDetectEntities().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "detect_entities", request.getDetectEntities().get(), false); + } + if (request.getDetectLanguage().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "detect_language", request.getDetectLanguage().get(), false); + } + if (request.getDiarize().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "diarize", request.getDiarize().get(), false); + } + if (request.getDictation().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "dictation", request.getDictation().get(), false); + } + if (request.getEncoding().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "encoding", request.getEncoding().get(), false); + } + if (request.getEndpoint().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "endpoint", request.getEndpoint().get(), false); + } + if (request.getExtra().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "extra", request.getExtra().get(), false); + } + if (request.getFillerWords().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "filler_words", request.getFillerWords().get(), false); + } + if (request.getIntents().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "intents", request.getIntents().get(), false); + } + if (request.getKeyterm().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "keyterm", request.getKeyterm().get(), false); + } + if (request.getKeywords().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "keywords", request.getKeywords().get(), false); + } + if (request.getLanguage().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "language", request.getLanguage().get(), false); + } + if (request.getMeasurements().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "measurements", request.getMeasurements().get(), false); + } + if (request.getMethod().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "method", request.getMethod().get(), false); + } + if (request.getModel().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "model", request.getModel().get(), false); + } + if (request.getMultichannel().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "multichannel", request.getMultichannel().get(), false); + } + if (request.getNumerals().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "numerals", request.getNumerals().get(), false); + } + if (request.getParagraphs().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "paragraphs", request.getParagraphs().get(), false); + } + if (request.getProfanityFilter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "profanity_filter", request.getProfanityFilter().get(), false); + } + if (request.getPunctuate().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "punctuate", request.getPunctuate().get(), false); + } + if (request.getRedact().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "redact", request.getRedact().get(), false); + } + if (request.getReplace().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "replace", request.getReplace().get(), false); + } + if (request.getSampleRate().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "sample_rate", request.getSampleRate().get(), false); + } + if (request.getSearch().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "search", request.getSearch().get(), false); + } + if (request.getSentiment().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "sentiment", request.getSentiment().get(), false); + } + if (request.getSmartFormat().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "smart_format", request.getSmartFormat().get(), false); + } + if (request.getSummarize().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "summarize", request.getSummarize().get(), false); + } + if (request.getTag().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "tag", request.getTag().get(), false); + } + if (request.getTopics().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "topics", request.getTopics().get(), false); + } + if (request.getUttSplit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "utt_split", request.getUttSplit().get(), false); + } + if (request.getUtterances().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "utterances", request.getUtterances().get(), false); + } + if (request.getVersion().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "version", request.getVersion().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UsageV1Response.class), + response)); + return; + } + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/usage/AsyncUsageClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/usage/AsyncUsageClient.java new file mode 100644 index 0000000..4d72e3b --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/usage/AsyncUsageClient.java @@ -0,0 +1,75 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.usage; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.RequestOptions; +import com.deepgram.core.Suppliers; +import com.deepgram.resources.manage.v1.projects.usage.breakdown.AsyncBreakdownClient; +import com.deepgram.resources.manage.v1.projects.usage.fields.AsyncFieldsClient; +import com.deepgram.resources.manage.v1.projects.usage.requests.UsageGetRequest; +import com.deepgram.types.UsageV1Response; +import java.util.concurrent.CompletableFuture; +import java.util.function.Supplier; + +public class AsyncUsageClient { + protected final ClientOptions clientOptions; + + private final AsyncRawUsageClient rawClient; + + protected final Supplier breakdownClient; + + protected final Supplier fieldsClient; + + public AsyncUsageClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawUsageClient(clientOptions); + this.breakdownClient = Suppliers.memoize(() -> new AsyncBreakdownClient(clientOptions)); + this.fieldsClient = Suppliers.memoize(() -> new AsyncFieldsClient(clientOptions)); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawUsageClient withRawResponse() { + return this.rawClient; + } + + /** + * Retrieves the usage for a specific project. Use Get Project Usage Breakdown for a more comprehensive usage summary. + */ + public CompletableFuture get(String projectId) { + return this.rawClient.get(projectId).thenApply(response -> response.body()); + } + + /** + * Retrieves the usage for a specific project. Use Get Project Usage Breakdown for a more comprehensive usage summary. + */ + public CompletableFuture get(String projectId, RequestOptions requestOptions) { + return this.rawClient.get(projectId, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the usage for a specific project. Use Get Project Usage Breakdown for a more comprehensive usage summary. + */ + public CompletableFuture get(String projectId, UsageGetRequest request) { + return this.rawClient.get(projectId, request).thenApply(response -> response.body()); + } + + /** + * Retrieves the usage for a specific project. Use Get Project Usage Breakdown for a more comprehensive usage summary. + */ + public CompletableFuture get( + String projectId, UsageGetRequest request, RequestOptions requestOptions) { + return this.rawClient.get(projectId, request, requestOptions).thenApply(response -> response.body()); + } + + public AsyncBreakdownClient breakdown() { + return this.breakdownClient.get(); + } + + public AsyncFieldsClient fields() { + return this.fieldsClient.get(); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/usage/RawUsageClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/usage/RawUsageClient.java new file mode 100644 index 0000000..3b78508 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/usage/RawUsageClient.java @@ -0,0 +1,274 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.usage; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.DeepgramApiApiException; +import com.deepgram.core.DeepgramApiException; +import com.deepgram.core.DeepgramApiHttpResponse; +import com.deepgram.core.ObjectMappers; +import com.deepgram.core.QueryStringMapper; +import com.deepgram.core.RequestOptions; +import com.deepgram.errors.BadRequestError; +import com.deepgram.resources.manage.v1.projects.usage.requests.UsageGetRequest; +import com.deepgram.types.UsageV1Response; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawUsageClient { + protected final ClientOptions clientOptions; + + public RawUsageClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Retrieves the usage for a specific project. Use Get Project Usage Breakdown for a more comprehensive usage summary. + */ + public DeepgramApiHttpResponse get(String projectId) { + return get(projectId, UsageGetRequest.builder().build()); + } + + /** + * Retrieves the usage for a specific project. Use Get Project Usage Breakdown for a more comprehensive usage summary. + */ + public DeepgramApiHttpResponse get(String projectId, RequestOptions requestOptions) { + return get(projectId, UsageGetRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the usage for a specific project. Use Get Project Usage Breakdown for a more comprehensive usage summary. + */ + public DeepgramApiHttpResponse get(String projectId, UsageGetRequest request) { + return get(projectId, request, null); + } + + /** + * Retrieves the usage for a specific project. Use Get Project Usage Breakdown for a more comprehensive usage summary. + */ + public DeepgramApiHttpResponse get( + String projectId, UsageGetRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("usage"); + if (request.getStart().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "start", request.getStart().get(), false); + } + if (request.getEnd().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "end", request.getEnd().get(), false); + } + if (request.getAccessor().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "accessor", request.getAccessor().get(), false); + } + if (request.getAlternatives().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "alternatives", request.getAlternatives().get(), false); + } + if (request.getCallbackMethod().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "callback_method", request.getCallbackMethod().get(), false); + } + if (request.getCallback().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "callback", request.getCallback().get(), false); + } + if (request.getChannels().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "channels", request.getChannels().get(), false); + } + if (request.getCustomIntentMode().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "custom_intent_mode", request.getCustomIntentMode().get(), false); + } + if (request.getCustomIntent().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "custom_intent", request.getCustomIntent().get(), false); + } + if (request.getCustomTopicMode().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "custom_topic_mode", request.getCustomTopicMode().get(), false); + } + if (request.getCustomTopic().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "custom_topic", request.getCustomTopic().get(), false); + } + if (request.getDeployment().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "deployment", request.getDeployment().get(), false); + } + if (request.getDetectEntities().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "detect_entities", request.getDetectEntities().get(), false); + } + if (request.getDetectLanguage().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "detect_language", request.getDetectLanguage().get(), false); + } + if (request.getDiarize().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "diarize", request.getDiarize().get(), false); + } + if (request.getDictation().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "dictation", request.getDictation().get(), false); + } + if (request.getEncoding().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "encoding", request.getEncoding().get(), false); + } + if (request.getEndpoint().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "endpoint", request.getEndpoint().get(), false); + } + if (request.getExtra().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "extra", request.getExtra().get(), false); + } + if (request.getFillerWords().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "filler_words", request.getFillerWords().get(), false); + } + if (request.getIntents().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "intents", request.getIntents().get(), false); + } + if (request.getKeyterm().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "keyterm", request.getKeyterm().get(), false); + } + if (request.getKeywords().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "keywords", request.getKeywords().get(), false); + } + if (request.getLanguage().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "language", request.getLanguage().get(), false); + } + if (request.getMeasurements().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "measurements", request.getMeasurements().get(), false); + } + if (request.getMethod().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "method", request.getMethod().get(), false); + } + if (request.getModel().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "model", request.getModel().get(), false); + } + if (request.getMultichannel().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "multichannel", request.getMultichannel().get(), false); + } + if (request.getNumerals().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "numerals", request.getNumerals().get(), false); + } + if (request.getParagraphs().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "paragraphs", request.getParagraphs().get(), false); + } + if (request.getProfanityFilter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "profanity_filter", request.getProfanityFilter().get(), false); + } + if (request.getPunctuate().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "punctuate", request.getPunctuate().get(), false); + } + if (request.getRedact().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "redact", request.getRedact().get(), false); + } + if (request.getReplace().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "replace", request.getReplace().get(), false); + } + if (request.getSampleRate().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "sample_rate", request.getSampleRate().get(), false); + } + if (request.getSearch().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "search", request.getSearch().get(), false); + } + if (request.getSentiment().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "sentiment", request.getSentiment().get(), false); + } + if (request.getSmartFormat().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "smart_format", request.getSmartFormat().get(), false); + } + if (request.getSummarize().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "summarize", request.getSummarize().get(), false); + } + if (request.getTag().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "tag", request.getTag().get(), false); + } + if (request.getTopics().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "topics", request.getTopics().get(), false); + } + if (request.getUttSplit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "utt_split", request.getUttSplit().get(), false); + } + if (request.getUtterances().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "utterances", request.getUtterances().get(), false); + } + if (request.getVersion().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "version", request.getVersion().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UsageV1Response.class), response); + } + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new DeepgramApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/usage/UsageClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/usage/UsageClient.java new file mode 100644 index 0000000..ce615e3 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/usage/UsageClient.java @@ -0,0 +1,73 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.usage; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.RequestOptions; +import com.deepgram.core.Suppliers; +import com.deepgram.resources.manage.v1.projects.usage.breakdown.BreakdownClient; +import com.deepgram.resources.manage.v1.projects.usage.fields.FieldsClient; +import com.deepgram.resources.manage.v1.projects.usage.requests.UsageGetRequest; +import com.deepgram.types.UsageV1Response; +import java.util.function.Supplier; + +public class UsageClient { + protected final ClientOptions clientOptions; + + private final RawUsageClient rawClient; + + protected final Supplier breakdownClient; + + protected final Supplier fieldsClient; + + public UsageClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawUsageClient(clientOptions); + this.breakdownClient = Suppliers.memoize(() -> new BreakdownClient(clientOptions)); + this.fieldsClient = Suppliers.memoize(() -> new FieldsClient(clientOptions)); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawUsageClient withRawResponse() { + return this.rawClient; + } + + /** + * Retrieves the usage for a specific project. Use Get Project Usage Breakdown for a more comprehensive usage summary. + */ + public UsageV1Response get(String projectId) { + return this.rawClient.get(projectId).body(); + } + + /** + * Retrieves the usage for a specific project. Use Get Project Usage Breakdown for a more comprehensive usage summary. + */ + public UsageV1Response get(String projectId, RequestOptions requestOptions) { + return this.rawClient.get(projectId, requestOptions).body(); + } + + /** + * Retrieves the usage for a specific project. Use Get Project Usage Breakdown for a more comprehensive usage summary. + */ + public UsageV1Response get(String projectId, UsageGetRequest request) { + return this.rawClient.get(projectId, request).body(); + } + + /** + * Retrieves the usage for a specific project. Use Get Project Usage Breakdown for a more comprehensive usage summary. + */ + public UsageV1Response get(String projectId, UsageGetRequest request, RequestOptions requestOptions) { + return this.rawClient.get(projectId, request, requestOptions).body(); + } + + public BreakdownClient breakdown() { + return this.breakdownClient.get(); + } + + public FieldsClient fields() { + return this.fieldsClient.get(); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/usage/breakdown/AsyncBreakdownClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/usage/breakdown/AsyncBreakdownClient.java new file mode 100644 index 0000000..41f8778 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/usage/breakdown/AsyncBreakdownClient.java @@ -0,0 +1,57 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.usage.breakdown; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.RequestOptions; +import com.deepgram.resources.manage.v1.projects.usage.breakdown.requests.BreakdownGetRequest; +import com.deepgram.types.UsageBreakdownV1Response; +import java.util.concurrent.CompletableFuture; + +public class AsyncBreakdownClient { + protected final ClientOptions clientOptions; + + private final AsyncRawBreakdownClient rawClient; + + public AsyncBreakdownClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawBreakdownClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawBreakdownClient withRawResponse() { + return this.rawClient; + } + + /** + * Retrieves the usage breakdown for a specific project, with various filter options by API feature or by groupings. Setting a feature (e.g. diarize) to true includes requests that used that feature, while false excludes requests that used it. Multiple true filters are combined with OR logic, while false filters use AND logic. + */ + public CompletableFuture get(String projectId) { + return this.rawClient.get(projectId).thenApply(response -> response.body()); + } + + /** + * Retrieves the usage breakdown for a specific project, with various filter options by API feature or by groupings. Setting a feature (e.g. diarize) to true includes requests that used that feature, while false excludes requests that used it. Multiple true filters are combined with OR logic, while false filters use AND logic. + */ + public CompletableFuture get(String projectId, RequestOptions requestOptions) { + return this.rawClient.get(projectId, requestOptions).thenApply(response -> response.body()); + } + + /** + * Retrieves the usage breakdown for a specific project, with various filter options by API feature or by groupings. Setting a feature (e.g. diarize) to true includes requests that used that feature, while false excludes requests that used it. Multiple true filters are combined with OR logic, while false filters use AND logic. + */ + public CompletableFuture get(String projectId, BreakdownGetRequest request) { + return this.rawClient.get(projectId, request).thenApply(response -> response.body()); + } + + /** + * Retrieves the usage breakdown for a specific project, with various filter options by API feature or by groupings. Setting a feature (e.g. diarize) to true includes requests that used that feature, while false excludes requests that used it. Multiple true filters are combined with OR logic, while false filters use AND logic. + */ + public CompletableFuture get( + String projectId, BreakdownGetRequest request, RequestOptions requestOptions) { + return this.rawClient.get(projectId, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/usage/breakdown/AsyncRawBreakdownClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/usage/breakdown/AsyncRawBreakdownClient.java new file mode 100644 index 0000000..47ce240 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/usage/breakdown/AsyncRawBreakdownClient.java @@ -0,0 +1,300 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.usage.breakdown; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.DeepgramApiApiException; +import com.deepgram.core.DeepgramApiException; +import com.deepgram.core.DeepgramApiHttpResponse; +import com.deepgram.core.ObjectMappers; +import com.deepgram.core.QueryStringMapper; +import com.deepgram.core.RequestOptions; +import com.deepgram.errors.BadRequestError; +import com.deepgram.resources.manage.v1.projects.usage.breakdown.requests.BreakdownGetRequest; +import com.deepgram.types.UsageBreakdownV1Response; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawBreakdownClient { + protected final ClientOptions clientOptions; + + public AsyncRawBreakdownClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Retrieves the usage breakdown for a specific project, with various filter options by API feature or by groupings. Setting a feature (e.g. diarize) to true includes requests that used that feature, while false excludes requests that used it. Multiple true filters are combined with OR logic, while false filters use AND logic. + */ + public CompletableFuture> get(String projectId) { + return get(projectId, BreakdownGetRequest.builder().build()); + } + + /** + * Retrieves the usage breakdown for a specific project, with various filter options by API feature or by groupings. Setting a feature (e.g. diarize) to true includes requests that used that feature, while false excludes requests that used it. Multiple true filters are combined with OR logic, while false filters use AND logic. + */ + public CompletableFuture> get( + String projectId, RequestOptions requestOptions) { + return get(projectId, BreakdownGetRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the usage breakdown for a specific project, with various filter options by API feature or by groupings. Setting a feature (e.g. diarize) to true includes requests that used that feature, while false excludes requests that used it. Multiple true filters are combined with OR logic, while false filters use AND logic. + */ + public CompletableFuture> get( + String projectId, BreakdownGetRequest request) { + return get(projectId, request, null); + } + + /** + * Retrieves the usage breakdown for a specific project, with various filter options by API feature or by groupings. Setting a feature (e.g. diarize) to true includes requests that used that feature, while false excludes requests that used it. Multiple true filters are combined with OR logic, while false filters use AND logic. + */ + public CompletableFuture> get( + String projectId, BreakdownGetRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("usage") + .addPathSegments("breakdown"); + if (request.getStart().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "start", request.getStart().get(), false); + } + if (request.getEnd().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "end", request.getEnd().get(), false); + } + if (request.getGrouping().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "grouping", request.getGrouping().get(), false); + } + if (request.getAccessor().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "accessor", request.getAccessor().get(), false); + } + if (request.getAlternatives().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "alternatives", request.getAlternatives().get(), false); + } + if (request.getCallbackMethod().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "callback_method", request.getCallbackMethod().get(), false); + } + if (request.getCallback().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "callback", request.getCallback().get(), false); + } + if (request.getChannels().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "channels", request.getChannels().get(), false); + } + if (request.getCustomIntentMode().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "custom_intent_mode", request.getCustomIntentMode().get(), false); + } + if (request.getCustomIntent().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "custom_intent", request.getCustomIntent().get(), false); + } + if (request.getCustomTopicMode().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "custom_topic_mode", request.getCustomTopicMode().get(), false); + } + if (request.getCustomTopic().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "custom_topic", request.getCustomTopic().get(), false); + } + if (request.getDeployment().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "deployment", request.getDeployment().get(), false); + } + if (request.getDetectEntities().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "detect_entities", request.getDetectEntities().get(), false); + } + if (request.getDetectLanguage().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "detect_language", request.getDetectLanguage().get(), false); + } + if (request.getDiarize().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "diarize", request.getDiarize().get(), false); + } + if (request.getDictation().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "dictation", request.getDictation().get(), false); + } + if (request.getEncoding().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "encoding", request.getEncoding().get(), false); + } + if (request.getEndpoint().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "endpoint", request.getEndpoint().get(), false); + } + if (request.getExtra().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "extra", request.getExtra().get(), false); + } + if (request.getFillerWords().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "filler_words", request.getFillerWords().get(), false); + } + if (request.getIntents().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "intents", request.getIntents().get(), false); + } + if (request.getKeyterm().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "keyterm", request.getKeyterm().get(), false); + } + if (request.getKeywords().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "keywords", request.getKeywords().get(), false); + } + if (request.getLanguage().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "language", request.getLanguage().get(), false); + } + if (request.getMeasurements().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "measurements", request.getMeasurements().get(), false); + } + if (request.getMethod().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "method", request.getMethod().get(), false); + } + if (request.getModel().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "model", request.getModel().get(), false); + } + if (request.getMultichannel().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "multichannel", request.getMultichannel().get(), false); + } + if (request.getNumerals().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "numerals", request.getNumerals().get(), false); + } + if (request.getParagraphs().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "paragraphs", request.getParagraphs().get(), false); + } + if (request.getProfanityFilter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "profanity_filter", request.getProfanityFilter().get(), false); + } + if (request.getPunctuate().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "punctuate", request.getPunctuate().get(), false); + } + if (request.getRedact().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "redact", request.getRedact().get(), false); + } + if (request.getReplace().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "replace", request.getReplace().get(), false); + } + if (request.getSampleRate().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "sample_rate", request.getSampleRate().get(), false); + } + if (request.getSearch().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "search", request.getSearch().get(), false); + } + if (request.getSentiment().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "sentiment", request.getSentiment().get(), false); + } + if (request.getSmartFormat().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "smart_format", request.getSmartFormat().get(), false); + } + if (request.getSummarize().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "summarize", request.getSummarize().get(), false); + } + if (request.getTag().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "tag", request.getTag().get(), false); + } + if (request.getTopics().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "topics", request.getTopics().get(), false); + } + if (request.getUttSplit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "utt_split", request.getUttSplit().get(), false); + } + if (request.getUtterances().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "utterances", request.getUtterances().get(), false); + } + if (request.getVersion().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "version", request.getVersion().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UsageBreakdownV1Response.class), + response)); + return; + } + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/usage/breakdown/BreakdownClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/usage/breakdown/BreakdownClient.java new file mode 100644 index 0000000..f05f9a9 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/usage/breakdown/BreakdownClient.java @@ -0,0 +1,55 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.usage.breakdown; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.RequestOptions; +import com.deepgram.resources.manage.v1.projects.usage.breakdown.requests.BreakdownGetRequest; +import com.deepgram.types.UsageBreakdownV1Response; + +public class BreakdownClient { + protected final ClientOptions clientOptions; + + private final RawBreakdownClient rawClient; + + public BreakdownClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawBreakdownClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawBreakdownClient withRawResponse() { + return this.rawClient; + } + + /** + * Retrieves the usage breakdown for a specific project, with various filter options by API feature or by groupings. Setting a feature (e.g. diarize) to true includes requests that used that feature, while false excludes requests that used it. Multiple true filters are combined with OR logic, while false filters use AND logic. + */ + public UsageBreakdownV1Response get(String projectId) { + return this.rawClient.get(projectId).body(); + } + + /** + * Retrieves the usage breakdown for a specific project, with various filter options by API feature or by groupings. Setting a feature (e.g. diarize) to true includes requests that used that feature, while false excludes requests that used it. Multiple true filters are combined with OR logic, while false filters use AND logic. + */ + public UsageBreakdownV1Response get(String projectId, RequestOptions requestOptions) { + return this.rawClient.get(projectId, requestOptions).body(); + } + + /** + * Retrieves the usage breakdown for a specific project, with various filter options by API feature or by groupings. Setting a feature (e.g. diarize) to true includes requests that used that feature, while false excludes requests that used it. Multiple true filters are combined with OR logic, while false filters use AND logic. + */ + public UsageBreakdownV1Response get(String projectId, BreakdownGetRequest request) { + return this.rawClient.get(projectId, request).body(); + } + + /** + * Retrieves the usage breakdown for a specific project, with various filter options by API feature or by groupings. Setting a feature (e.g. diarize) to true includes requests that used that feature, while false excludes requests that used it. Multiple true filters are combined with OR logic, while false filters use AND logic. + */ + public UsageBreakdownV1Response get(String projectId, BreakdownGetRequest request, RequestOptions requestOptions) { + return this.rawClient.get(projectId, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/usage/breakdown/RawBreakdownClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/usage/breakdown/RawBreakdownClient.java new file mode 100644 index 0000000..8c7a6d1 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/usage/breakdown/RawBreakdownClient.java @@ -0,0 +1,280 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.usage.breakdown; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.DeepgramApiApiException; +import com.deepgram.core.DeepgramApiException; +import com.deepgram.core.DeepgramApiHttpResponse; +import com.deepgram.core.ObjectMappers; +import com.deepgram.core.QueryStringMapper; +import com.deepgram.core.RequestOptions; +import com.deepgram.errors.BadRequestError; +import com.deepgram.resources.manage.v1.projects.usage.breakdown.requests.BreakdownGetRequest; +import com.deepgram.types.UsageBreakdownV1Response; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawBreakdownClient { + protected final ClientOptions clientOptions; + + public RawBreakdownClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Retrieves the usage breakdown for a specific project, with various filter options by API feature or by groupings. Setting a feature (e.g. diarize) to true includes requests that used that feature, while false excludes requests that used it. Multiple true filters are combined with OR logic, while false filters use AND logic. + */ + public DeepgramApiHttpResponse get(String projectId) { + return get(projectId, BreakdownGetRequest.builder().build()); + } + + /** + * Retrieves the usage breakdown for a specific project, with various filter options by API feature or by groupings. Setting a feature (e.g. diarize) to true includes requests that used that feature, while false excludes requests that used it. Multiple true filters are combined with OR logic, while false filters use AND logic. + */ + public DeepgramApiHttpResponse get(String projectId, RequestOptions requestOptions) { + return get(projectId, BreakdownGetRequest.builder().build(), requestOptions); + } + + /** + * Retrieves the usage breakdown for a specific project, with various filter options by API feature or by groupings. Setting a feature (e.g. diarize) to true includes requests that used that feature, while false excludes requests that used it. Multiple true filters are combined with OR logic, while false filters use AND logic. + */ + public DeepgramApiHttpResponse get(String projectId, BreakdownGetRequest request) { + return get(projectId, request, null); + } + + /** + * Retrieves the usage breakdown for a specific project, with various filter options by API feature or by groupings. Setting a feature (e.g. diarize) to true includes requests that used that feature, while false excludes requests that used it. Multiple true filters are combined with OR logic, while false filters use AND logic. + */ + public DeepgramApiHttpResponse get( + String projectId, BreakdownGetRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("usage") + .addPathSegments("breakdown"); + if (request.getStart().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "start", request.getStart().get(), false); + } + if (request.getEnd().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "end", request.getEnd().get(), false); + } + if (request.getGrouping().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "grouping", request.getGrouping().get(), false); + } + if (request.getAccessor().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "accessor", request.getAccessor().get(), false); + } + if (request.getAlternatives().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "alternatives", request.getAlternatives().get(), false); + } + if (request.getCallbackMethod().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "callback_method", request.getCallbackMethod().get(), false); + } + if (request.getCallback().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "callback", request.getCallback().get(), false); + } + if (request.getChannels().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "channels", request.getChannels().get(), false); + } + if (request.getCustomIntentMode().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "custom_intent_mode", request.getCustomIntentMode().get(), false); + } + if (request.getCustomIntent().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "custom_intent", request.getCustomIntent().get(), false); + } + if (request.getCustomTopicMode().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "custom_topic_mode", request.getCustomTopicMode().get(), false); + } + if (request.getCustomTopic().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "custom_topic", request.getCustomTopic().get(), false); + } + if (request.getDeployment().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "deployment", request.getDeployment().get(), false); + } + if (request.getDetectEntities().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "detect_entities", request.getDetectEntities().get(), false); + } + if (request.getDetectLanguage().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "detect_language", request.getDetectLanguage().get(), false); + } + if (request.getDiarize().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "diarize", request.getDiarize().get(), false); + } + if (request.getDictation().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "dictation", request.getDictation().get(), false); + } + if (request.getEncoding().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "encoding", request.getEncoding().get(), false); + } + if (request.getEndpoint().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "endpoint", request.getEndpoint().get(), false); + } + if (request.getExtra().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "extra", request.getExtra().get(), false); + } + if (request.getFillerWords().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "filler_words", request.getFillerWords().get(), false); + } + if (request.getIntents().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "intents", request.getIntents().get(), false); + } + if (request.getKeyterm().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "keyterm", request.getKeyterm().get(), false); + } + if (request.getKeywords().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "keywords", request.getKeywords().get(), false); + } + if (request.getLanguage().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "language", request.getLanguage().get(), false); + } + if (request.getMeasurements().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "measurements", request.getMeasurements().get(), false); + } + if (request.getMethod().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "method", request.getMethod().get(), false); + } + if (request.getModel().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "model", request.getModel().get(), false); + } + if (request.getMultichannel().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "multichannel", request.getMultichannel().get(), false); + } + if (request.getNumerals().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "numerals", request.getNumerals().get(), false); + } + if (request.getParagraphs().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "paragraphs", request.getParagraphs().get(), false); + } + if (request.getProfanityFilter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "profanity_filter", request.getProfanityFilter().get(), false); + } + if (request.getPunctuate().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "punctuate", request.getPunctuate().get(), false); + } + if (request.getRedact().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "redact", request.getRedact().get(), false); + } + if (request.getReplace().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "replace", request.getReplace().get(), false); + } + if (request.getSampleRate().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "sample_rate", request.getSampleRate().get(), false); + } + if (request.getSearch().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "search", request.getSearch().get(), false); + } + if (request.getSentiment().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "sentiment", request.getSentiment().get(), false); + } + if (request.getSmartFormat().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "smart_format", request.getSmartFormat().get(), false); + } + if (request.getSummarize().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "summarize", request.getSummarize().get(), false); + } + if (request.getTag().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "tag", request.getTag().get(), false); + } + if (request.getTopics().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "topics", request.getTopics().get(), false); + } + if (request.getUttSplit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "utt_split", request.getUttSplit().get(), false); + } + if (request.getUtterances().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "utterances", request.getUtterances().get(), false); + } + if (request.getVersion().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "version", request.getVersion().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UsageBreakdownV1Response.class), + response); + } + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new DeepgramApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/usage/breakdown/requests/BreakdownGetRequest.java b/src/main/java/com/deepgram/resources/manage/v1/projects/usage/breakdown/requests/BreakdownGetRequest.java new file mode 100644 index 0000000..912cb6a --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/usage/breakdown/requests/BreakdownGetRequest.java @@ -0,0 +1,1528 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.usage.breakdown.requests; + +import com.deepgram.core.ObjectMappers; +import com.deepgram.resources.manage.v1.projects.usage.breakdown.types.BreakdownGetRequestDeployment; +import com.deepgram.resources.manage.v1.projects.usage.breakdown.types.BreakdownGetRequestEndpoint; +import com.deepgram.resources.manage.v1.projects.usage.breakdown.types.BreakdownGetRequestGrouping; +import com.deepgram.resources.manage.v1.projects.usage.breakdown.types.BreakdownGetRequestMethod; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = BreakdownGetRequest.Builder.class) +public final class BreakdownGetRequest { + private final Optional start; + + private final Optional end; + + private final Optional grouping; + + private final Optional accessor; + + private final Optional alternatives; + + private final Optional callbackMethod; + + private final Optional callback; + + private final Optional channels; + + private final Optional customIntentMode; + + private final Optional customIntent; + + private final Optional customTopicMode; + + private final Optional customTopic; + + private final Optional deployment; + + private final Optional detectEntities; + + private final Optional detectLanguage; + + private final Optional diarize; + + private final Optional dictation; + + private final Optional encoding; + + private final Optional endpoint; + + private final Optional extra; + + private final Optional fillerWords; + + private final Optional intents; + + private final Optional keyterm; + + private final Optional keywords; + + private final Optional language; + + private final Optional measurements; + + private final Optional method; + + private final Optional model; + + private final Optional multichannel; + + private final Optional numerals; + + private final Optional paragraphs; + + private final Optional profanityFilter; + + private final Optional punctuate; + + private final Optional redact; + + private final Optional replace; + + private final Optional sampleRate; + + private final Optional search; + + private final Optional sentiment; + + private final Optional smartFormat; + + private final Optional summarize; + + private final Optional tag; + + private final Optional topics; + + private final Optional uttSplit; + + private final Optional utterances; + + private final Optional version; + + private final Map additionalProperties; + + private BreakdownGetRequest( + Optional start, + Optional end, + Optional grouping, + Optional accessor, + Optional alternatives, + Optional callbackMethod, + Optional callback, + Optional channels, + Optional customIntentMode, + Optional customIntent, + Optional customTopicMode, + Optional customTopic, + Optional deployment, + Optional detectEntities, + Optional detectLanguage, + Optional diarize, + Optional dictation, + Optional encoding, + Optional endpoint, + Optional extra, + Optional fillerWords, + Optional intents, + Optional keyterm, + Optional keywords, + Optional language, + Optional measurements, + Optional method, + Optional model, + Optional multichannel, + Optional numerals, + Optional paragraphs, + Optional profanityFilter, + Optional punctuate, + Optional redact, + Optional replace, + Optional sampleRate, + Optional search, + Optional sentiment, + Optional smartFormat, + Optional summarize, + Optional tag, + Optional topics, + Optional uttSplit, + Optional utterances, + Optional version, + Map additionalProperties) { + this.start = start; + this.end = end; + this.grouping = grouping; + this.accessor = accessor; + this.alternatives = alternatives; + this.callbackMethod = callbackMethod; + this.callback = callback; + this.channels = channels; + this.customIntentMode = customIntentMode; + this.customIntent = customIntent; + this.customTopicMode = customTopicMode; + this.customTopic = customTopic; + this.deployment = deployment; + this.detectEntities = detectEntities; + this.detectLanguage = detectLanguage; + this.diarize = diarize; + this.dictation = dictation; + this.encoding = encoding; + this.endpoint = endpoint; + this.extra = extra; + this.fillerWords = fillerWords; + this.intents = intents; + this.keyterm = keyterm; + this.keywords = keywords; + this.language = language; + this.measurements = measurements; + this.method = method; + this.model = model; + this.multichannel = multichannel; + this.numerals = numerals; + this.paragraphs = paragraphs; + this.profanityFilter = profanityFilter; + this.punctuate = punctuate; + this.redact = redact; + this.replace = replace; + this.sampleRate = sampleRate; + this.search = search; + this.sentiment = sentiment; + this.smartFormat = smartFormat; + this.summarize = summarize; + this.tag = tag; + this.topics = topics; + this.uttSplit = uttSplit; + this.utterances = utterances; + this.version = version; + this.additionalProperties = additionalProperties; + } + + /** + * @return Start date of the requested date range. Format accepted is YYYY-MM-DD + */ + @JsonIgnore + public Optional getStart() { + return start; + } + + /** + * @return End date of the requested date range. Format accepted is YYYY-MM-DD + */ + @JsonIgnore + public Optional getEnd() { + return end; + } + + /** + * @return Common usage grouping parameters + */ + @JsonIgnore + public Optional getGrouping() { + return grouping; + } + + /** + * @return Filter for requests where a specific accessor was used + */ + @JsonIgnore + public Optional getAccessor() { + return accessor; + } + + /** + * @return Filter for requests where alternatives were used + */ + @JsonIgnore + public Optional getAlternatives() { + return alternatives; + } + + /** + * @return Filter for requests where callback method was used + */ + @JsonIgnore + public Optional getCallbackMethod() { + return callbackMethod; + } + + /** + * @return Filter for requests where callback was used + */ + @JsonIgnore + public Optional getCallback() { + return callback; + } + + /** + * @return Filter for requests where channels were used + */ + @JsonIgnore + public Optional getChannels() { + return channels; + } + + /** + * @return Filter for requests where custom intent mode was used + */ + @JsonIgnore + public Optional getCustomIntentMode() { + return customIntentMode; + } + + /** + * @return Filter for requests where custom intent was used + */ + @JsonIgnore + public Optional getCustomIntent() { + return customIntent; + } + + /** + * @return Filter for requests where custom topic mode was used + */ + @JsonIgnore + public Optional getCustomTopicMode() { + return customTopicMode; + } + + /** + * @return Filter for requests where custom topic was used + */ + @JsonIgnore + public Optional getCustomTopic() { + return customTopic; + } + + /** + * @return Filter for requests where a specific deployment was used + */ + @JsonIgnore + public Optional getDeployment() { + return deployment; + } + + /** + * @return Filter for requests where detect entities was used + */ + @JsonIgnore + public Optional getDetectEntities() { + return detectEntities; + } + + /** + * @return Filter for requests where detect language was used + */ + @JsonIgnore + public Optional getDetectLanguage() { + return detectLanguage; + } + + /** + * @return Filter for requests where diarize was used + */ + @JsonIgnore + public Optional getDiarize() { + return diarize; + } + + /** + * @return Filter for requests where dictation was used + */ + @JsonIgnore + public Optional getDictation() { + return dictation; + } + + /** + * @return Filter for requests where encoding was used + */ + @JsonIgnore + public Optional getEncoding() { + return encoding; + } + + /** + * @return Filter for requests where a specific endpoint was used + */ + @JsonIgnore + public Optional getEndpoint() { + return endpoint; + } + + /** + * @return Filter for requests where extra was used + */ + @JsonIgnore + public Optional getExtra() { + return extra; + } + + /** + * @return Filter for requests where filler words was used + */ + @JsonIgnore + public Optional getFillerWords() { + return fillerWords; + } + + /** + * @return Filter for requests where intents was used + */ + @JsonIgnore + public Optional getIntents() { + return intents; + } + + /** + * @return Filter for requests where keyterm was used + */ + @JsonIgnore + public Optional getKeyterm() { + return keyterm; + } + + /** + * @return Filter for requests where keywords was used + */ + @JsonIgnore + public Optional getKeywords() { + return keywords; + } + + /** + * @return Filter for requests where language was used + */ + @JsonIgnore + public Optional getLanguage() { + return language; + } + + /** + * @return Filter for requests where measurements were used + */ + @JsonIgnore + public Optional getMeasurements() { + return measurements; + } + + /** + * @return Filter for requests where a specific method was used + */ + @JsonIgnore + public Optional getMethod() { + return method; + } + + /** + * @return Filter for requests where a specific model uuid was used + */ + @JsonIgnore + public Optional getModel() { + return model; + } + + /** + * @return Filter for requests where multichannel was used + */ + @JsonIgnore + public Optional getMultichannel() { + return multichannel; + } + + /** + * @return Filter for requests where numerals were used + */ + @JsonIgnore + public Optional getNumerals() { + return numerals; + } + + /** + * @return Filter for requests where paragraphs were used + */ + @JsonIgnore + public Optional getParagraphs() { + return paragraphs; + } + + /** + * @return Filter for requests where profanity filter was used + */ + @JsonIgnore + public Optional getProfanityFilter() { + return profanityFilter; + } + + /** + * @return Filter for requests where punctuate was used + */ + @JsonIgnore + public Optional getPunctuate() { + return punctuate; + } + + /** + * @return Filter for requests where redact was used + */ + @JsonIgnore + public Optional getRedact() { + return redact; + } + + /** + * @return Filter for requests where replace was used + */ + @JsonIgnore + public Optional getReplace() { + return replace; + } + + /** + * @return Filter for requests where sample rate was used + */ + @JsonIgnore + public Optional getSampleRate() { + return sampleRate; + } + + /** + * @return Filter for requests where search was used + */ + @JsonIgnore + public Optional getSearch() { + return search; + } + + /** + * @return Filter for requests where sentiment was used + */ + @JsonIgnore + public Optional getSentiment() { + return sentiment; + } + + /** + * @return Filter for requests where smart format was used + */ + @JsonIgnore + public Optional getSmartFormat() { + return smartFormat; + } + + /** + * @return Filter for requests where summarize was used + */ + @JsonIgnore + public Optional getSummarize() { + return summarize; + } + + /** + * @return Filter for requests where a specific tag was used + */ + @JsonIgnore + public Optional getTag() { + return tag; + } + + /** + * @return Filter for requests where topics was used + */ + @JsonIgnore + public Optional getTopics() { + return topics; + } + + /** + * @return Filter for requests where utt split was used + */ + @JsonIgnore + public Optional getUttSplit() { + return uttSplit; + } + + /** + * @return Filter for requests where utterances was used + */ + @JsonIgnore + public Optional getUtterances() { + return utterances; + } + + /** + * @return Filter for requests where version was used + */ + @JsonIgnore + public Optional getVersion() { + return version; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BreakdownGetRequest && equalTo((BreakdownGetRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(BreakdownGetRequest other) { + return start.equals(other.start) + && end.equals(other.end) + && grouping.equals(other.grouping) + && accessor.equals(other.accessor) + && alternatives.equals(other.alternatives) + && callbackMethod.equals(other.callbackMethod) + && callback.equals(other.callback) + && channels.equals(other.channels) + && customIntentMode.equals(other.customIntentMode) + && customIntent.equals(other.customIntent) + && customTopicMode.equals(other.customTopicMode) + && customTopic.equals(other.customTopic) + && deployment.equals(other.deployment) + && detectEntities.equals(other.detectEntities) + && detectLanguage.equals(other.detectLanguage) + && diarize.equals(other.diarize) + && dictation.equals(other.dictation) + && encoding.equals(other.encoding) + && endpoint.equals(other.endpoint) + && extra.equals(other.extra) + && fillerWords.equals(other.fillerWords) + && intents.equals(other.intents) + && keyterm.equals(other.keyterm) + && keywords.equals(other.keywords) + && language.equals(other.language) + && measurements.equals(other.measurements) + && method.equals(other.method) + && model.equals(other.model) + && multichannel.equals(other.multichannel) + && numerals.equals(other.numerals) + && paragraphs.equals(other.paragraphs) + && profanityFilter.equals(other.profanityFilter) + && punctuate.equals(other.punctuate) + && redact.equals(other.redact) + && replace.equals(other.replace) + && sampleRate.equals(other.sampleRate) + && search.equals(other.search) + && sentiment.equals(other.sentiment) + && smartFormat.equals(other.smartFormat) + && summarize.equals(other.summarize) + && tag.equals(other.tag) + && topics.equals(other.topics) + && uttSplit.equals(other.uttSplit) + && utterances.equals(other.utterances) + && version.equals(other.version); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.start, + this.end, + this.grouping, + this.accessor, + this.alternatives, + this.callbackMethod, + this.callback, + this.channels, + this.customIntentMode, + this.customIntent, + this.customTopicMode, + this.customTopic, + this.deployment, + this.detectEntities, + this.detectLanguage, + this.diarize, + this.dictation, + this.encoding, + this.endpoint, + this.extra, + this.fillerWords, + this.intents, + this.keyterm, + this.keywords, + this.language, + this.measurements, + this.method, + this.model, + this.multichannel, + this.numerals, + this.paragraphs, + this.profanityFilter, + this.punctuate, + this.redact, + this.replace, + this.sampleRate, + this.search, + this.sentiment, + this.smartFormat, + this.summarize, + this.tag, + this.topics, + this.uttSplit, + this.utterances, + this.version); + } + + @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 start = Optional.empty(); + + private Optional end = Optional.empty(); + + private Optional grouping = Optional.empty(); + + private Optional accessor = Optional.empty(); + + private Optional alternatives = Optional.empty(); + + private Optional callbackMethod = Optional.empty(); + + private Optional callback = Optional.empty(); + + private Optional channels = Optional.empty(); + + private Optional customIntentMode = Optional.empty(); + + private Optional customIntent = Optional.empty(); + + private Optional customTopicMode = Optional.empty(); + + private Optional customTopic = Optional.empty(); + + private Optional deployment = Optional.empty(); + + private Optional detectEntities = Optional.empty(); + + private Optional detectLanguage = Optional.empty(); + + private Optional diarize = Optional.empty(); + + private Optional dictation = Optional.empty(); + + private Optional encoding = Optional.empty(); + + private Optional endpoint = Optional.empty(); + + private Optional extra = Optional.empty(); + + private Optional fillerWords = Optional.empty(); + + private Optional intents = Optional.empty(); + + private Optional keyterm = Optional.empty(); + + private Optional keywords = Optional.empty(); + + private Optional language = Optional.empty(); + + private Optional measurements = Optional.empty(); + + private Optional method = Optional.empty(); + + private Optional model = Optional.empty(); + + private Optional multichannel = Optional.empty(); + + private Optional numerals = Optional.empty(); + + private Optional paragraphs = Optional.empty(); + + private Optional profanityFilter = Optional.empty(); + + private Optional punctuate = Optional.empty(); + + private Optional redact = Optional.empty(); + + private Optional replace = Optional.empty(); + + private Optional sampleRate = Optional.empty(); + + private Optional search = Optional.empty(); + + private Optional sentiment = Optional.empty(); + + private Optional smartFormat = Optional.empty(); + + private Optional summarize = Optional.empty(); + + private Optional tag = Optional.empty(); + + private Optional topics = Optional.empty(); + + private Optional uttSplit = Optional.empty(); + + private Optional utterances = Optional.empty(); + + private Optional version = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(BreakdownGetRequest other) { + start(other.getStart()); + end(other.getEnd()); + grouping(other.getGrouping()); + accessor(other.getAccessor()); + alternatives(other.getAlternatives()); + callbackMethod(other.getCallbackMethod()); + callback(other.getCallback()); + channels(other.getChannels()); + customIntentMode(other.getCustomIntentMode()); + customIntent(other.getCustomIntent()); + customTopicMode(other.getCustomTopicMode()); + customTopic(other.getCustomTopic()); + deployment(other.getDeployment()); + detectEntities(other.getDetectEntities()); + detectLanguage(other.getDetectLanguage()); + diarize(other.getDiarize()); + dictation(other.getDictation()); + encoding(other.getEncoding()); + endpoint(other.getEndpoint()); + extra(other.getExtra()); + fillerWords(other.getFillerWords()); + intents(other.getIntents()); + keyterm(other.getKeyterm()); + keywords(other.getKeywords()); + language(other.getLanguage()); + measurements(other.getMeasurements()); + method(other.getMethod()); + model(other.getModel()); + multichannel(other.getMultichannel()); + numerals(other.getNumerals()); + paragraphs(other.getParagraphs()); + profanityFilter(other.getProfanityFilter()); + punctuate(other.getPunctuate()); + redact(other.getRedact()); + replace(other.getReplace()); + sampleRate(other.getSampleRate()); + search(other.getSearch()); + sentiment(other.getSentiment()); + smartFormat(other.getSmartFormat()); + summarize(other.getSummarize()); + tag(other.getTag()); + topics(other.getTopics()); + uttSplit(other.getUttSplit()); + utterances(other.getUtterances()); + version(other.getVersion()); + return this; + } + + /** + *

Start date of the requested date range. Format accepted is YYYY-MM-DD

+ */ + @JsonSetter(value = "start", nulls = Nulls.SKIP) + public Builder start(Optional start) { + this.start = start; + return this; + } + + public Builder start(String start) { + this.start = Optional.ofNullable(start); + return this; + } + + /** + *

End date of the requested date range. Format accepted is YYYY-MM-DD

+ */ + @JsonSetter(value = "end", nulls = Nulls.SKIP) + public Builder end(Optional end) { + this.end = end; + return this; + } + + public Builder end(String end) { + this.end = Optional.ofNullable(end); + return this; + } + + /** + *

Common usage grouping parameters

+ */ + @JsonSetter(value = "grouping", nulls = Nulls.SKIP) + public Builder grouping(Optional grouping) { + this.grouping = grouping; + return this; + } + + public Builder grouping(BreakdownGetRequestGrouping grouping) { + this.grouping = Optional.ofNullable(grouping); + return this; + } + + /** + *

Filter for requests where a specific accessor was used

+ */ + @JsonSetter(value = "accessor", nulls = Nulls.SKIP) + public Builder accessor(Optional accessor) { + this.accessor = accessor; + return this; + } + + public Builder accessor(String accessor) { + this.accessor = Optional.ofNullable(accessor); + return this; + } + + /** + *

Filter for requests where alternatives were used

+ */ + @JsonSetter(value = "alternatives", nulls = Nulls.SKIP) + public Builder alternatives(Optional alternatives) { + this.alternatives = alternatives; + return this; + } + + public Builder alternatives(Boolean alternatives) { + this.alternatives = Optional.ofNullable(alternatives); + return this; + } + + /** + *

Filter for requests where callback method was used

+ */ + @JsonSetter(value = "callback_method", nulls = Nulls.SKIP) + public Builder callbackMethod(Optional callbackMethod) { + this.callbackMethod = callbackMethod; + return this; + } + + public Builder callbackMethod(Boolean callbackMethod) { + this.callbackMethod = Optional.ofNullable(callbackMethod); + return this; + } + + /** + *

Filter for requests where callback was used

+ */ + @JsonSetter(value = "callback", nulls = Nulls.SKIP) + public Builder callback(Optional callback) { + this.callback = callback; + return this; + } + + public Builder callback(Boolean callback) { + this.callback = Optional.ofNullable(callback); + return this; + } + + /** + *

Filter for requests where channels were used

+ */ + @JsonSetter(value = "channels", nulls = Nulls.SKIP) + public Builder channels(Optional channels) { + this.channels = channels; + return this; + } + + public Builder channels(Boolean channels) { + this.channels = Optional.ofNullable(channels); + return this; + } + + /** + *

Filter for requests where custom intent mode was used

+ */ + @JsonSetter(value = "custom_intent_mode", nulls = Nulls.SKIP) + public Builder customIntentMode(Optional customIntentMode) { + this.customIntentMode = customIntentMode; + return this; + } + + public Builder customIntentMode(Boolean customIntentMode) { + this.customIntentMode = Optional.ofNullable(customIntentMode); + return this; + } + + /** + *

Filter for requests where custom intent was used

+ */ + @JsonSetter(value = "custom_intent", nulls = Nulls.SKIP) + public Builder customIntent(Optional customIntent) { + this.customIntent = customIntent; + return this; + } + + public Builder customIntent(Boolean customIntent) { + this.customIntent = Optional.ofNullable(customIntent); + return this; + } + + /** + *

Filter for requests where custom topic mode was used

+ */ + @JsonSetter(value = "custom_topic_mode", nulls = Nulls.SKIP) + public Builder customTopicMode(Optional customTopicMode) { + this.customTopicMode = customTopicMode; + return this; + } + + public Builder customTopicMode(Boolean customTopicMode) { + this.customTopicMode = Optional.ofNullable(customTopicMode); + return this; + } + + /** + *

Filter for requests where custom topic was used

+ */ + @JsonSetter(value = "custom_topic", nulls = Nulls.SKIP) + public Builder customTopic(Optional customTopic) { + this.customTopic = customTopic; + return this; + } + + public Builder customTopic(Boolean customTopic) { + this.customTopic = Optional.ofNullable(customTopic); + return this; + } + + /** + *

Filter for requests where a specific deployment was used

+ */ + @JsonSetter(value = "deployment", nulls = Nulls.SKIP) + public Builder deployment(Optional deployment) { + this.deployment = deployment; + return this; + } + + public Builder deployment(BreakdownGetRequestDeployment deployment) { + this.deployment = Optional.ofNullable(deployment); + return this; + } + + /** + *

Filter for requests where detect entities was used

+ */ + @JsonSetter(value = "detect_entities", nulls = Nulls.SKIP) + public Builder detectEntities(Optional detectEntities) { + this.detectEntities = detectEntities; + return this; + } + + public Builder detectEntities(Boolean detectEntities) { + this.detectEntities = Optional.ofNullable(detectEntities); + return this; + } + + /** + *

Filter for requests where detect language was used

+ */ + @JsonSetter(value = "detect_language", nulls = Nulls.SKIP) + public Builder detectLanguage(Optional detectLanguage) { + this.detectLanguage = detectLanguage; + return this; + } + + public Builder detectLanguage(Boolean detectLanguage) { + this.detectLanguage = Optional.ofNullable(detectLanguage); + return this; + } + + /** + *

Filter for requests where diarize was used

+ */ + @JsonSetter(value = "diarize", nulls = Nulls.SKIP) + public Builder diarize(Optional diarize) { + this.diarize = diarize; + return this; + } + + public Builder diarize(Boolean diarize) { + this.diarize = Optional.ofNullable(diarize); + return this; + } + + /** + *

Filter for requests where dictation was used

+ */ + @JsonSetter(value = "dictation", nulls = Nulls.SKIP) + public Builder dictation(Optional dictation) { + this.dictation = dictation; + return this; + } + + public Builder dictation(Boolean dictation) { + this.dictation = Optional.ofNullable(dictation); + return this; + } + + /** + *

Filter for requests where encoding was used

+ */ + @JsonSetter(value = "encoding", nulls = Nulls.SKIP) + public Builder encoding(Optional encoding) { + this.encoding = encoding; + return this; + } + + public Builder encoding(Boolean encoding) { + this.encoding = Optional.ofNullable(encoding); + return this; + } + + /** + *

Filter for requests where a specific endpoint was used

+ */ + @JsonSetter(value = "endpoint", nulls = Nulls.SKIP) + public Builder endpoint(Optional endpoint) { + this.endpoint = endpoint; + return this; + } + + public Builder endpoint(BreakdownGetRequestEndpoint endpoint) { + this.endpoint = Optional.ofNullable(endpoint); + return this; + } + + /** + *

Filter for requests where extra was used

+ */ + @JsonSetter(value = "extra", nulls = Nulls.SKIP) + public Builder extra(Optional extra) { + this.extra = extra; + return this; + } + + public Builder extra(Boolean extra) { + this.extra = Optional.ofNullable(extra); + return this; + } + + /** + *

Filter for requests where filler words was used

+ */ + @JsonSetter(value = "filler_words", nulls = Nulls.SKIP) + public Builder fillerWords(Optional fillerWords) { + this.fillerWords = fillerWords; + return this; + } + + public Builder fillerWords(Boolean fillerWords) { + this.fillerWords = Optional.ofNullable(fillerWords); + return this; + } + + /** + *

Filter for requests where intents was used

+ */ + @JsonSetter(value = "intents", nulls = Nulls.SKIP) + public Builder intents(Optional intents) { + this.intents = intents; + return this; + } + + public Builder intents(Boolean intents) { + this.intents = Optional.ofNullable(intents); + return this; + } + + /** + *

Filter for requests where keyterm was used

+ */ + @JsonSetter(value = "keyterm", nulls = Nulls.SKIP) + public Builder keyterm(Optional keyterm) { + this.keyterm = keyterm; + return this; + } + + public Builder keyterm(Boolean keyterm) { + this.keyterm = Optional.ofNullable(keyterm); + return this; + } + + /** + *

Filter for requests where keywords was used

+ */ + @JsonSetter(value = "keywords", nulls = Nulls.SKIP) + public Builder keywords(Optional keywords) { + this.keywords = keywords; + return this; + } + + public Builder keywords(Boolean keywords) { + this.keywords = Optional.ofNullable(keywords); + return this; + } + + /** + *

Filter for requests where language was used

+ */ + @JsonSetter(value = "language", nulls = Nulls.SKIP) + public Builder language(Optional language) { + this.language = language; + return this; + } + + public Builder language(Boolean language) { + this.language = Optional.ofNullable(language); + return this; + } + + /** + *

Filter for requests where measurements were used

+ */ + @JsonSetter(value = "measurements", nulls = Nulls.SKIP) + public Builder measurements(Optional measurements) { + this.measurements = measurements; + return this; + } + + public Builder measurements(Boolean measurements) { + this.measurements = Optional.ofNullable(measurements); + return this; + } + + /** + *

Filter for requests where a specific method was used

+ */ + @JsonSetter(value = "method", nulls = Nulls.SKIP) + public Builder method(Optional method) { + this.method = method; + return this; + } + + public Builder method(BreakdownGetRequestMethod method) { + this.method = Optional.ofNullable(method); + return this; + } + + /** + *

Filter for requests where a specific model uuid was used

+ */ + @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; + } + + /** + *

Filter for requests where multichannel was used

+ */ + @JsonSetter(value = "multichannel", nulls = Nulls.SKIP) + public Builder multichannel(Optional multichannel) { + this.multichannel = multichannel; + return this; + } + + public Builder multichannel(Boolean multichannel) { + this.multichannel = Optional.ofNullable(multichannel); + return this; + } + + /** + *

Filter for requests where numerals were used

+ */ + @JsonSetter(value = "numerals", nulls = Nulls.SKIP) + public Builder numerals(Optional numerals) { + this.numerals = numerals; + return this; + } + + public Builder numerals(Boolean numerals) { + this.numerals = Optional.ofNullable(numerals); + return this; + } + + /** + *

Filter for requests where paragraphs were used

+ */ + @JsonSetter(value = "paragraphs", nulls = Nulls.SKIP) + public Builder paragraphs(Optional paragraphs) { + this.paragraphs = paragraphs; + return this; + } + + public Builder paragraphs(Boolean paragraphs) { + this.paragraphs = Optional.ofNullable(paragraphs); + return this; + } + + /** + *

Filter for requests where profanity filter was used

+ */ + @JsonSetter(value = "profanity_filter", nulls = Nulls.SKIP) + public Builder profanityFilter(Optional profanityFilter) { + this.profanityFilter = profanityFilter; + return this; + } + + public Builder profanityFilter(Boolean profanityFilter) { + this.profanityFilter = Optional.ofNullable(profanityFilter); + return this; + } + + /** + *

Filter for requests where punctuate was used

+ */ + @JsonSetter(value = "punctuate", nulls = Nulls.SKIP) + public Builder punctuate(Optional punctuate) { + this.punctuate = punctuate; + return this; + } + + public Builder punctuate(Boolean punctuate) { + this.punctuate = Optional.ofNullable(punctuate); + return this; + } + + /** + *

Filter for requests where redact was used

+ */ + @JsonSetter(value = "redact", nulls = Nulls.SKIP) + public Builder redact(Optional redact) { + this.redact = redact; + return this; + } + + public Builder redact(Boolean redact) { + this.redact = Optional.ofNullable(redact); + return this; + } + + /** + *

Filter for requests where replace was used

+ */ + @JsonSetter(value = "replace", nulls = Nulls.SKIP) + public Builder replace(Optional replace) { + this.replace = replace; + return this; + } + + public Builder replace(Boolean replace) { + this.replace = Optional.ofNullable(replace); + return this; + } + + /** + *

Filter for requests where sample rate was used

+ */ + @JsonSetter(value = "sample_rate", nulls = Nulls.SKIP) + public Builder sampleRate(Optional sampleRate) { + this.sampleRate = sampleRate; + return this; + } + + public Builder sampleRate(Boolean sampleRate) { + this.sampleRate = Optional.ofNullable(sampleRate); + return this; + } + + /** + *

Filter for requests where search was used

+ */ + @JsonSetter(value = "search", nulls = Nulls.SKIP) + public Builder search(Optional search) { + this.search = search; + return this; + } + + public Builder search(Boolean search) { + this.search = Optional.ofNullable(search); + return this; + } + + /** + *

Filter for requests where sentiment was used

+ */ + @JsonSetter(value = "sentiment", nulls = Nulls.SKIP) + public Builder sentiment(Optional sentiment) { + this.sentiment = sentiment; + return this; + } + + public Builder sentiment(Boolean sentiment) { + this.sentiment = Optional.ofNullable(sentiment); + return this; + } + + /** + *

Filter for requests where smart format was used

+ */ + @JsonSetter(value = "smart_format", 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; + } + + /** + *

Filter for requests where summarize was used

+ */ + @JsonSetter(value = "summarize", nulls = Nulls.SKIP) + public Builder summarize(Optional summarize) { + this.summarize = summarize; + return this; + } + + public Builder summarize(Boolean summarize) { + this.summarize = Optional.ofNullable(summarize); + return this; + } + + /** + *

Filter for requests where a specific tag was used

+ */ + @JsonSetter(value = "tag", nulls = Nulls.SKIP) + public Builder tag(Optional tag) { + this.tag = tag; + return this; + } + + public Builder tag(String tag) { + this.tag = Optional.ofNullable(tag); + return this; + } + + /** + *

Filter for requests where topics was used

+ */ + @JsonSetter(value = "topics", nulls = Nulls.SKIP) + public Builder topics(Optional topics) { + this.topics = topics; + return this; + } + + public Builder topics(Boolean topics) { + this.topics = Optional.ofNullable(topics); + return this; + } + + /** + *

Filter for requests where utt split was used

+ */ + @JsonSetter(value = "utt_split", nulls = Nulls.SKIP) + public Builder uttSplit(Optional uttSplit) { + this.uttSplit = uttSplit; + return this; + } + + public Builder uttSplit(Boolean uttSplit) { + this.uttSplit = Optional.ofNullable(uttSplit); + return this; + } + + /** + *

Filter for requests where utterances was used

+ */ + @JsonSetter(value = "utterances", nulls = Nulls.SKIP) + public Builder utterances(Optional utterances) { + this.utterances = utterances; + return this; + } + + public Builder utterances(Boolean utterances) { + this.utterances = Optional.ofNullable(utterances); + return this; + } + + /** + *

Filter for requests where version was used

+ */ + @JsonSetter(value = "version", nulls = Nulls.SKIP) + public Builder version(Optional version) { + this.version = version; + return this; + } + + public Builder version(Boolean version) { + this.version = Optional.ofNullable(version); + return this; + } + + public BreakdownGetRequest build() { + return new BreakdownGetRequest( + start, + end, + grouping, + accessor, + alternatives, + callbackMethod, + callback, + channels, + customIntentMode, + customIntent, + customTopicMode, + customTopic, + deployment, + detectEntities, + detectLanguage, + diarize, + dictation, + encoding, + endpoint, + extra, + fillerWords, + intents, + keyterm, + keywords, + language, + measurements, + method, + model, + multichannel, + numerals, + paragraphs, + profanityFilter, + punctuate, + redact, + replace, + sampleRate, + search, + sentiment, + smartFormat, + summarize, + tag, + topics, + uttSplit, + utterances, + version, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/usage/breakdown/types/BreakdownGetRequestDeployment.java b/src/main/java/com/deepgram/resources/manage/v1/projects/usage/breakdown/types/BreakdownGetRequestDeployment.java new file mode 100644 index 0000000..7920650 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/usage/breakdown/types/BreakdownGetRequestDeployment.java @@ -0,0 +1,96 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.usage.breakdown.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class BreakdownGetRequestDeployment { + public static final BreakdownGetRequestDeployment SELF_HOSTED = + new BreakdownGetRequestDeployment(Value.SELF_HOSTED, "self-hosted"); + + public static final BreakdownGetRequestDeployment BETA = new BreakdownGetRequestDeployment(Value.BETA, "beta"); + + public static final BreakdownGetRequestDeployment HOSTED = + new BreakdownGetRequestDeployment(Value.HOSTED, "hosted"); + + private final Value value; + + private final String string; + + BreakdownGetRequestDeployment(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof BreakdownGetRequestDeployment + && this.string.equals(((BreakdownGetRequestDeployment) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SELF_HOSTED: + return visitor.visitSelfHosted(); + case BETA: + return visitor.visitBeta(); + case HOSTED: + return visitor.visitHosted(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static BreakdownGetRequestDeployment valueOf(String value) { + switch (value) { + case "self-hosted": + return SELF_HOSTED; + case "beta": + return BETA; + case "hosted": + return HOSTED; + default: + return new BreakdownGetRequestDeployment(Value.UNKNOWN, value); + } + } + + public enum Value { + HOSTED, + + BETA, + + SELF_HOSTED, + + UNKNOWN + } + + public interface Visitor { + T visitHosted(); + + T visitBeta(); + + T visitSelfHosted(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/usage/breakdown/types/BreakdownGetRequestEndpoint.java b/src/main/java/com/deepgram/resources/manage/v1/projects/usage/breakdown/types/BreakdownGetRequestEndpoint.java new file mode 100644 index 0000000..4381cfb --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/usage/breakdown/types/BreakdownGetRequestEndpoint.java @@ -0,0 +1,104 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.usage.breakdown.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class BreakdownGetRequestEndpoint { + public static final BreakdownGetRequestEndpoint AGENT = new BreakdownGetRequestEndpoint(Value.AGENT, "agent"); + + public static final BreakdownGetRequestEndpoint READ = new BreakdownGetRequestEndpoint(Value.READ, "read"); + + public static final BreakdownGetRequestEndpoint LISTEN = new BreakdownGetRequestEndpoint(Value.LISTEN, "listen"); + + public static final BreakdownGetRequestEndpoint SPEAK = new BreakdownGetRequestEndpoint(Value.SPEAK, "speak"); + + private final Value value; + + private final String string; + + BreakdownGetRequestEndpoint(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof BreakdownGetRequestEndpoint + && this.string.equals(((BreakdownGetRequestEndpoint) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case AGENT: + return visitor.visitAgent(); + case READ: + return visitor.visitRead(); + case LISTEN: + return visitor.visitListen(); + case SPEAK: + return visitor.visitSpeak(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static BreakdownGetRequestEndpoint valueOf(String value) { + switch (value) { + case "agent": + return AGENT; + case "read": + return READ; + case "listen": + return LISTEN; + case "speak": + return SPEAK; + default: + return new BreakdownGetRequestEndpoint(Value.UNKNOWN, value); + } + } + + public enum Value { + LISTEN, + + READ, + + SPEAK, + + AGENT, + + UNKNOWN + } + + public interface Visitor { + T visitListen(); + + T visitRead(); + + T visitSpeak(); + + T visitAgent(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/usage/breakdown/types/BreakdownGetRequestGrouping.java b/src/main/java/com/deepgram/resources/manage/v1/projects/usage/breakdown/types/BreakdownGetRequestGrouping.java new file mode 100644 index 0000000..e144a26 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/usage/breakdown/types/BreakdownGetRequestGrouping.java @@ -0,0 +1,138 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.usage.breakdown.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class BreakdownGetRequestGrouping { + public static final BreakdownGetRequestGrouping METHOD = new BreakdownGetRequestGrouping(Value.METHOD, "method"); + + public static final BreakdownGetRequestGrouping MODELS = new BreakdownGetRequestGrouping(Value.MODELS, "models"); + + public static final BreakdownGetRequestGrouping ENDPOINT = + new BreakdownGetRequestGrouping(Value.ENDPOINT, "endpoint"); + + public static final BreakdownGetRequestGrouping TAGS = new BreakdownGetRequestGrouping(Value.TAGS, "tags"); + + public static final BreakdownGetRequestGrouping ACCESSOR = + new BreakdownGetRequestGrouping(Value.ACCESSOR, "accessor"); + + public static final BreakdownGetRequestGrouping FEATURE_SET = + new BreakdownGetRequestGrouping(Value.FEATURE_SET, "feature_set"); + + public static final BreakdownGetRequestGrouping DEPLOYMENT = + new BreakdownGetRequestGrouping(Value.DEPLOYMENT, "deployment"); + + private final Value value; + + private final String string; + + BreakdownGetRequestGrouping(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof BreakdownGetRequestGrouping + && this.string.equals(((BreakdownGetRequestGrouping) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case METHOD: + return visitor.visitMethod(); + case MODELS: + return visitor.visitModels(); + case ENDPOINT: + return visitor.visitEndpoint(); + case TAGS: + return visitor.visitTags(); + case ACCESSOR: + return visitor.visitAccessor(); + case FEATURE_SET: + return visitor.visitFeatureSet(); + case DEPLOYMENT: + return visitor.visitDeployment(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static BreakdownGetRequestGrouping valueOf(String value) { + switch (value) { + case "method": + return METHOD; + case "models": + return MODELS; + case "endpoint": + return ENDPOINT; + case "tags": + return TAGS; + case "accessor": + return ACCESSOR; + case "feature_set": + return FEATURE_SET; + case "deployment": + return DEPLOYMENT; + default: + return new BreakdownGetRequestGrouping(Value.UNKNOWN, value); + } + } + + public enum Value { + ACCESSOR, + + ENDPOINT, + + FEATURE_SET, + + MODELS, + + METHOD, + + TAGS, + + DEPLOYMENT, + + UNKNOWN + } + + public interface Visitor { + T visitAccessor(); + + T visitEndpoint(); + + T visitFeatureSet(); + + T visitModels(); + + T visitMethod(); + + T visitTags(); + + T visitDeployment(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/usage/breakdown/types/BreakdownGetRequestMethod.java b/src/main/java/com/deepgram/resources/manage/v1/projects/usage/breakdown/types/BreakdownGetRequestMethod.java new file mode 100644 index 0000000..5815698 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/usage/breakdown/types/BreakdownGetRequestMethod.java @@ -0,0 +1,95 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.usage.breakdown.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class BreakdownGetRequestMethod { + public static final BreakdownGetRequestMethod SYNC = new BreakdownGetRequestMethod(Value.SYNC, "sync"); + + public static final BreakdownGetRequestMethod STREAMING = + new BreakdownGetRequestMethod(Value.STREAMING, "streaming"); + + public static final BreakdownGetRequestMethod ASYNC = new BreakdownGetRequestMethod(Value.ASYNC, "async"); + + private final Value value; + + private final String string; + + BreakdownGetRequestMethod(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof BreakdownGetRequestMethod + && this.string.equals(((BreakdownGetRequestMethod) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SYNC: + return visitor.visitSync(); + case STREAMING: + return visitor.visitStreaming(); + case ASYNC: + return visitor.visitAsync(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static BreakdownGetRequestMethod valueOf(String value) { + switch (value) { + case "sync": + return SYNC; + case "streaming": + return STREAMING; + case "async": + return ASYNC; + default: + return new BreakdownGetRequestMethod(Value.UNKNOWN, value); + } + } + + public enum Value { + SYNC, + + ASYNC, + + STREAMING, + + UNKNOWN + } + + public interface Visitor { + T visitSync(); + + T visitAsync(); + + T visitStreaming(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/usage/fields/AsyncFieldsClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/usage/fields/AsyncFieldsClient.java new file mode 100644 index 0000000..c7d08bf --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/usage/fields/AsyncFieldsClient.java @@ -0,0 +1,57 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.usage.fields; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.RequestOptions; +import com.deepgram.resources.manage.v1.projects.usage.fields.requests.FieldsListRequest; +import com.deepgram.types.UsageFieldsV1Response; +import java.util.concurrent.CompletableFuture; + +public class AsyncFieldsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawFieldsClient rawClient; + + public AsyncFieldsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawFieldsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawFieldsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists the features, models, tags, languages, and processing method used for requests in the specified project + */ + public CompletableFuture list(String projectId) { + return this.rawClient.list(projectId).thenApply(response -> response.body()); + } + + /** + * Lists the features, models, tags, languages, and processing method used for requests in the specified project + */ + public CompletableFuture list(String projectId, RequestOptions requestOptions) { + return this.rawClient.list(projectId, requestOptions).thenApply(response -> response.body()); + } + + /** + * Lists the features, models, tags, languages, and processing method used for requests in the specified project + */ + public CompletableFuture list(String projectId, FieldsListRequest request) { + return this.rawClient.list(projectId, request).thenApply(response -> response.body()); + } + + /** + * Lists the features, models, tags, languages, and processing method used for requests in the specified project + */ + public CompletableFuture list( + String projectId, FieldsListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(projectId, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/usage/fields/AsyncRawFieldsClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/usage/fields/AsyncRawFieldsClient.java new file mode 100644 index 0000000..f8fecd9 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/usage/fields/AsyncRawFieldsClient.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.usage.fields; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.DeepgramApiApiException; +import com.deepgram.core.DeepgramApiException; +import com.deepgram.core.DeepgramApiHttpResponse; +import com.deepgram.core.ObjectMappers; +import com.deepgram.core.QueryStringMapper; +import com.deepgram.core.RequestOptions; +import com.deepgram.errors.BadRequestError; +import com.deepgram.resources.manage.v1.projects.usage.fields.requests.FieldsListRequest; +import com.deepgram.types.UsageFieldsV1Response; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawFieldsClient { + protected final ClientOptions clientOptions; + + public AsyncRawFieldsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists the features, models, tags, languages, and processing method used for requests in the specified project + */ + public CompletableFuture> list(String projectId) { + return list(projectId, FieldsListRequest.builder().build()); + } + + /** + * Lists the features, models, tags, languages, and processing method used for requests in the specified project + */ + public CompletableFuture> list( + String projectId, RequestOptions requestOptions) { + return list(projectId, FieldsListRequest.builder().build(), requestOptions); + } + + /** + * Lists the features, models, tags, languages, and processing method used for requests in the specified project + */ + public CompletableFuture> list( + String projectId, FieldsListRequest request) { + return list(projectId, request, null); + } + + /** + * Lists the features, models, tags, languages, and processing method used for requests in the specified project + */ + public CompletableFuture> list( + String projectId, FieldsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("usage") + .addPathSegments("fields"); + if (request.getStart().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "start", request.getStart().get(), false); + } + if (request.getEnd().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "end", request.getEnd().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UsageFieldsV1Response.class), + response)); + return; + } + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/usage/fields/FieldsClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/usage/fields/FieldsClient.java new file mode 100644 index 0000000..b8983b7 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/usage/fields/FieldsClient.java @@ -0,0 +1,55 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.usage.fields; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.RequestOptions; +import com.deepgram.resources.manage.v1.projects.usage.fields.requests.FieldsListRequest; +import com.deepgram.types.UsageFieldsV1Response; + +public class FieldsClient { + protected final ClientOptions clientOptions; + + private final RawFieldsClient rawClient; + + public FieldsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawFieldsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawFieldsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists the features, models, tags, languages, and processing method used for requests in the specified project + */ + public UsageFieldsV1Response list(String projectId) { + return this.rawClient.list(projectId).body(); + } + + /** + * Lists the features, models, tags, languages, and processing method used for requests in the specified project + */ + public UsageFieldsV1Response list(String projectId, RequestOptions requestOptions) { + return this.rawClient.list(projectId, requestOptions).body(); + } + + /** + * Lists the features, models, tags, languages, and processing method used for requests in the specified project + */ + public UsageFieldsV1Response list(String projectId, FieldsListRequest request) { + return this.rawClient.list(projectId, request).body(); + } + + /** + * Lists the features, models, tags, languages, and processing method used for requests in the specified project + */ + public UsageFieldsV1Response list(String projectId, FieldsListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(projectId, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/usage/fields/RawFieldsClient.java b/src/main/java/com/deepgram/resources/manage/v1/projects/usage/fields/RawFieldsClient.java new file mode 100644 index 0000000..0159759 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/usage/fields/RawFieldsClient.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.usage.fields; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.DeepgramApiApiException; +import com.deepgram.core.DeepgramApiException; +import com.deepgram.core.DeepgramApiHttpResponse; +import com.deepgram.core.ObjectMappers; +import com.deepgram.core.QueryStringMapper; +import com.deepgram.core.RequestOptions; +import com.deepgram.errors.BadRequestError; +import com.deepgram.resources.manage.v1.projects.usage.fields.requests.FieldsListRequest; +import com.deepgram.types.UsageFieldsV1Response; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawFieldsClient { + protected final ClientOptions clientOptions; + + public RawFieldsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists the features, models, tags, languages, and processing method used for requests in the specified project + */ + public DeepgramApiHttpResponse list(String projectId) { + return list(projectId, FieldsListRequest.builder().build()); + } + + /** + * Lists the features, models, tags, languages, and processing method used for requests in the specified project + */ + public DeepgramApiHttpResponse list(String projectId, RequestOptions requestOptions) { + return list(projectId, FieldsListRequest.builder().build(), requestOptions); + } + + /** + * Lists the features, models, tags, languages, and processing method used for requests in the specified project + */ + public DeepgramApiHttpResponse list(String projectId, FieldsListRequest request) { + return list(projectId, request, null); + } + + /** + * Lists the features, models, tags, languages, and processing method used for requests in the specified project + */ + public DeepgramApiHttpResponse list( + String projectId, FieldsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("usage") + .addPathSegments("fields"); + if (request.getStart().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "start", request.getStart().get(), false); + } + if (request.getEnd().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "end", request.getEnd().get(), false); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UsageFieldsV1Response.class), response); + } + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new DeepgramApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/usage/fields/requests/FieldsListRequest.java b/src/main/java/com/deepgram/resources/manage/v1/projects/usage/fields/requests/FieldsListRequest.java new file mode 100644 index 0000000..01b4d32 --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/usage/fields/requests/FieldsListRequest.java @@ -0,0 +1,139 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.usage.fields.requests; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = FieldsListRequest.Builder.class) +public final class FieldsListRequest { + private final Optional start; + + private final Optional end; + + private final Map additionalProperties; + + private FieldsListRequest(Optional start, Optional end, Map additionalProperties) { + this.start = start; + this.end = end; + this.additionalProperties = additionalProperties; + } + + /** + * @return Start date of the requested date range. Format accepted is YYYY-MM-DD + */ + @JsonIgnore + public Optional getStart() { + return start; + } + + /** + * @return End date of the requested date range. Format accepted is YYYY-MM-DD + */ + @JsonIgnore + public Optional getEnd() { + return end; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FieldsListRequest && equalTo((FieldsListRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(FieldsListRequest other) { + return start.equals(other.start) && end.equals(other.end); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.start, this.end); + } + + @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 start = Optional.empty(); + + private Optional end = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(FieldsListRequest other) { + start(other.getStart()); + end(other.getEnd()); + return this; + } + + /** + *

Start date of the requested date range. Format accepted is YYYY-MM-DD

+ */ + @JsonSetter(value = "start", nulls = Nulls.SKIP) + public Builder start(Optional start) { + this.start = start; + return this; + } + + public Builder start(String start) { + this.start = Optional.ofNullable(start); + return this; + } + + /** + *

End date of the requested date range. Format accepted is YYYY-MM-DD

+ */ + @JsonSetter(value = "end", nulls = Nulls.SKIP) + public Builder end(Optional end) { + this.end = end; + return this; + } + + public Builder end(String end) { + this.end = Optional.ofNullable(end); + return this; + } + + public FieldsListRequest build() { + return new FieldsListRequest(start, end, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/usage/requests/UsageGetRequest.java b/src/main/java/com/deepgram/resources/manage/v1/projects/usage/requests/UsageGetRequest.java new file mode 100644 index 0000000..b4c6d0a --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/usage/requests/UsageGetRequest.java @@ -0,0 +1,1495 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.usage.requests; + +import com.deepgram.core.ObjectMappers; +import com.deepgram.resources.manage.v1.projects.usage.types.UsageGetRequestDeployment; +import com.deepgram.resources.manage.v1.projects.usage.types.UsageGetRequestEndpoint; +import com.deepgram.resources.manage.v1.projects.usage.types.UsageGetRequestMethod; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UsageGetRequest.Builder.class) +public final class UsageGetRequest { + private final Optional start; + + private final Optional end; + + private final Optional accessor; + + private final Optional alternatives; + + private final Optional callbackMethod; + + private final Optional callback; + + private final Optional channels; + + private final Optional customIntentMode; + + private final Optional customIntent; + + private final Optional customTopicMode; + + private final Optional customTopic; + + private final Optional deployment; + + private final Optional detectEntities; + + private final Optional detectLanguage; + + private final Optional diarize; + + private final Optional dictation; + + private final Optional encoding; + + private final Optional endpoint; + + private final Optional extra; + + private final Optional fillerWords; + + private final Optional intents; + + private final Optional keyterm; + + private final Optional keywords; + + private final Optional language; + + private final Optional measurements; + + private final Optional method; + + private final Optional model; + + private final Optional multichannel; + + private final Optional numerals; + + private final Optional paragraphs; + + private final Optional profanityFilter; + + private final Optional punctuate; + + private final Optional redact; + + private final Optional replace; + + private final Optional sampleRate; + + private final Optional search; + + private final Optional sentiment; + + private final Optional smartFormat; + + private final Optional summarize; + + private final Optional tag; + + private final Optional topics; + + private final Optional uttSplit; + + private final Optional utterances; + + private final Optional version; + + private final Map additionalProperties; + + private UsageGetRequest( + Optional start, + Optional end, + Optional accessor, + Optional alternatives, + Optional callbackMethod, + Optional callback, + Optional channels, + Optional customIntentMode, + Optional customIntent, + Optional customTopicMode, + Optional customTopic, + Optional deployment, + Optional detectEntities, + Optional detectLanguage, + Optional diarize, + Optional dictation, + Optional encoding, + Optional endpoint, + Optional extra, + Optional fillerWords, + Optional intents, + Optional keyterm, + Optional keywords, + Optional language, + Optional measurements, + Optional method, + Optional model, + Optional multichannel, + Optional numerals, + Optional paragraphs, + Optional profanityFilter, + Optional punctuate, + Optional redact, + Optional replace, + Optional sampleRate, + Optional search, + Optional sentiment, + Optional smartFormat, + Optional summarize, + Optional tag, + Optional topics, + Optional uttSplit, + Optional utterances, + Optional version, + Map additionalProperties) { + this.start = start; + this.end = end; + this.accessor = accessor; + this.alternatives = alternatives; + this.callbackMethod = callbackMethod; + this.callback = callback; + this.channels = channels; + this.customIntentMode = customIntentMode; + this.customIntent = customIntent; + this.customTopicMode = customTopicMode; + this.customTopic = customTopic; + this.deployment = deployment; + this.detectEntities = detectEntities; + this.detectLanguage = detectLanguage; + this.diarize = diarize; + this.dictation = dictation; + this.encoding = encoding; + this.endpoint = endpoint; + this.extra = extra; + this.fillerWords = fillerWords; + this.intents = intents; + this.keyterm = keyterm; + this.keywords = keywords; + this.language = language; + this.measurements = measurements; + this.method = method; + this.model = model; + this.multichannel = multichannel; + this.numerals = numerals; + this.paragraphs = paragraphs; + this.profanityFilter = profanityFilter; + this.punctuate = punctuate; + this.redact = redact; + this.replace = replace; + this.sampleRate = sampleRate; + this.search = search; + this.sentiment = sentiment; + this.smartFormat = smartFormat; + this.summarize = summarize; + this.tag = tag; + this.topics = topics; + this.uttSplit = uttSplit; + this.utterances = utterances; + this.version = version; + this.additionalProperties = additionalProperties; + } + + /** + * @return Start date of the requested date range. Format accepted is YYYY-MM-DD + */ + @JsonIgnore + public Optional getStart() { + return start; + } + + /** + * @return End date of the requested date range. Format accepted is YYYY-MM-DD + */ + @JsonIgnore + public Optional getEnd() { + return end; + } + + /** + * @return Filter for requests where a specific accessor was used + */ + @JsonIgnore + public Optional getAccessor() { + return accessor; + } + + /** + * @return Filter for requests where alternatives were used + */ + @JsonIgnore + public Optional getAlternatives() { + return alternatives; + } + + /** + * @return Filter for requests where callback method was used + */ + @JsonIgnore + public Optional getCallbackMethod() { + return callbackMethod; + } + + /** + * @return Filter for requests where callback was used + */ + @JsonIgnore + public Optional getCallback() { + return callback; + } + + /** + * @return Filter for requests where channels were used + */ + @JsonIgnore + public Optional getChannels() { + return channels; + } + + /** + * @return Filter for requests where custom intent mode was used + */ + @JsonIgnore + public Optional getCustomIntentMode() { + return customIntentMode; + } + + /** + * @return Filter for requests where custom intent was used + */ + @JsonIgnore + public Optional getCustomIntent() { + return customIntent; + } + + /** + * @return Filter for requests where custom topic mode was used + */ + @JsonIgnore + public Optional getCustomTopicMode() { + return customTopicMode; + } + + /** + * @return Filter for requests where custom topic was used + */ + @JsonIgnore + public Optional getCustomTopic() { + return customTopic; + } + + /** + * @return Filter for requests where a specific deployment was used + */ + @JsonIgnore + public Optional getDeployment() { + return deployment; + } + + /** + * @return Filter for requests where detect entities was used + */ + @JsonIgnore + public Optional getDetectEntities() { + return detectEntities; + } + + /** + * @return Filter for requests where detect language was used + */ + @JsonIgnore + public Optional getDetectLanguage() { + return detectLanguage; + } + + /** + * @return Filter for requests where diarize was used + */ + @JsonIgnore + public Optional getDiarize() { + return diarize; + } + + /** + * @return Filter for requests where dictation was used + */ + @JsonIgnore + public Optional getDictation() { + return dictation; + } + + /** + * @return Filter for requests where encoding was used + */ + @JsonIgnore + public Optional getEncoding() { + return encoding; + } + + /** + * @return Filter for requests where a specific endpoint was used + */ + @JsonIgnore + public Optional getEndpoint() { + return endpoint; + } + + /** + * @return Filter for requests where extra was used + */ + @JsonIgnore + public Optional getExtra() { + return extra; + } + + /** + * @return Filter for requests where filler words was used + */ + @JsonIgnore + public Optional getFillerWords() { + return fillerWords; + } + + /** + * @return Filter for requests where intents was used + */ + @JsonIgnore + public Optional getIntents() { + return intents; + } + + /** + * @return Filter for requests where keyterm was used + */ + @JsonIgnore + public Optional getKeyterm() { + return keyterm; + } + + /** + * @return Filter for requests where keywords was used + */ + @JsonIgnore + public Optional getKeywords() { + return keywords; + } + + /** + * @return Filter for requests where language was used + */ + @JsonIgnore + public Optional getLanguage() { + return language; + } + + /** + * @return Filter for requests where measurements were used + */ + @JsonIgnore + public Optional getMeasurements() { + return measurements; + } + + /** + * @return Filter for requests where a specific method was used + */ + @JsonIgnore + public Optional getMethod() { + return method; + } + + /** + * @return Filter for requests where a specific model uuid was used + */ + @JsonIgnore + public Optional getModel() { + return model; + } + + /** + * @return Filter for requests where multichannel was used + */ + @JsonIgnore + public Optional getMultichannel() { + return multichannel; + } + + /** + * @return Filter for requests where numerals were used + */ + @JsonIgnore + public Optional getNumerals() { + return numerals; + } + + /** + * @return Filter for requests where paragraphs were used + */ + @JsonIgnore + public Optional getParagraphs() { + return paragraphs; + } + + /** + * @return Filter for requests where profanity filter was used + */ + @JsonIgnore + public Optional getProfanityFilter() { + return profanityFilter; + } + + /** + * @return Filter for requests where punctuate was used + */ + @JsonIgnore + public Optional getPunctuate() { + return punctuate; + } + + /** + * @return Filter for requests where redact was used + */ + @JsonIgnore + public Optional getRedact() { + return redact; + } + + /** + * @return Filter for requests where replace was used + */ + @JsonIgnore + public Optional getReplace() { + return replace; + } + + /** + * @return Filter for requests where sample rate was used + */ + @JsonIgnore + public Optional getSampleRate() { + return sampleRate; + } + + /** + * @return Filter for requests where search was used + */ + @JsonIgnore + public Optional getSearch() { + return search; + } + + /** + * @return Filter for requests where sentiment was used + */ + @JsonIgnore + public Optional getSentiment() { + return sentiment; + } + + /** + * @return Filter for requests where smart format was used + */ + @JsonIgnore + public Optional getSmartFormat() { + return smartFormat; + } + + /** + * @return Filter for requests where summarize was used + */ + @JsonIgnore + public Optional getSummarize() { + return summarize; + } + + /** + * @return Filter for requests where a specific tag was used + */ + @JsonIgnore + public Optional getTag() { + return tag; + } + + /** + * @return Filter for requests where topics was used + */ + @JsonIgnore + public Optional getTopics() { + return topics; + } + + /** + * @return Filter for requests where utt split was used + */ + @JsonIgnore + public Optional getUttSplit() { + return uttSplit; + } + + /** + * @return Filter for requests where utterances was used + */ + @JsonIgnore + public Optional getUtterances() { + return utterances; + } + + /** + * @return Filter for requests where version was used + */ + @JsonIgnore + public Optional getVersion() { + return version; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UsageGetRequest && equalTo((UsageGetRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UsageGetRequest other) { + return start.equals(other.start) + && end.equals(other.end) + && accessor.equals(other.accessor) + && alternatives.equals(other.alternatives) + && callbackMethod.equals(other.callbackMethod) + && callback.equals(other.callback) + && channels.equals(other.channels) + && customIntentMode.equals(other.customIntentMode) + && customIntent.equals(other.customIntent) + && customTopicMode.equals(other.customTopicMode) + && customTopic.equals(other.customTopic) + && deployment.equals(other.deployment) + && detectEntities.equals(other.detectEntities) + && detectLanguage.equals(other.detectLanguage) + && diarize.equals(other.diarize) + && dictation.equals(other.dictation) + && encoding.equals(other.encoding) + && endpoint.equals(other.endpoint) + && extra.equals(other.extra) + && fillerWords.equals(other.fillerWords) + && intents.equals(other.intents) + && keyterm.equals(other.keyterm) + && keywords.equals(other.keywords) + && language.equals(other.language) + && measurements.equals(other.measurements) + && method.equals(other.method) + && model.equals(other.model) + && multichannel.equals(other.multichannel) + && numerals.equals(other.numerals) + && paragraphs.equals(other.paragraphs) + && profanityFilter.equals(other.profanityFilter) + && punctuate.equals(other.punctuate) + && redact.equals(other.redact) + && replace.equals(other.replace) + && sampleRate.equals(other.sampleRate) + && search.equals(other.search) + && sentiment.equals(other.sentiment) + && smartFormat.equals(other.smartFormat) + && summarize.equals(other.summarize) + && tag.equals(other.tag) + && topics.equals(other.topics) + && uttSplit.equals(other.uttSplit) + && utterances.equals(other.utterances) + && version.equals(other.version); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.start, + this.end, + this.accessor, + this.alternatives, + this.callbackMethod, + this.callback, + this.channels, + this.customIntentMode, + this.customIntent, + this.customTopicMode, + this.customTopic, + this.deployment, + this.detectEntities, + this.detectLanguage, + this.diarize, + this.dictation, + this.encoding, + this.endpoint, + this.extra, + this.fillerWords, + this.intents, + this.keyterm, + this.keywords, + this.language, + this.measurements, + this.method, + this.model, + this.multichannel, + this.numerals, + this.paragraphs, + this.profanityFilter, + this.punctuate, + this.redact, + this.replace, + this.sampleRate, + this.search, + this.sentiment, + this.smartFormat, + this.summarize, + this.tag, + this.topics, + this.uttSplit, + this.utterances, + this.version); + } + + @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 start = Optional.empty(); + + private Optional end = Optional.empty(); + + private Optional accessor = Optional.empty(); + + private Optional alternatives = Optional.empty(); + + private Optional callbackMethod = Optional.empty(); + + private Optional callback = Optional.empty(); + + private Optional channels = Optional.empty(); + + private Optional customIntentMode = Optional.empty(); + + private Optional customIntent = Optional.empty(); + + private Optional customTopicMode = Optional.empty(); + + private Optional customTopic = Optional.empty(); + + private Optional deployment = Optional.empty(); + + private Optional detectEntities = Optional.empty(); + + private Optional detectLanguage = Optional.empty(); + + private Optional diarize = Optional.empty(); + + private Optional dictation = Optional.empty(); + + private Optional encoding = Optional.empty(); + + private Optional endpoint = Optional.empty(); + + private Optional extra = Optional.empty(); + + private Optional fillerWords = Optional.empty(); + + private Optional intents = Optional.empty(); + + private Optional keyterm = Optional.empty(); + + private Optional keywords = Optional.empty(); + + private Optional language = Optional.empty(); + + private Optional measurements = Optional.empty(); + + private Optional method = Optional.empty(); + + private Optional model = Optional.empty(); + + private Optional multichannel = Optional.empty(); + + private Optional numerals = Optional.empty(); + + private Optional paragraphs = Optional.empty(); + + private Optional profanityFilter = Optional.empty(); + + private Optional punctuate = Optional.empty(); + + private Optional redact = Optional.empty(); + + private Optional replace = Optional.empty(); + + private Optional sampleRate = Optional.empty(); + + private Optional search = Optional.empty(); + + private Optional sentiment = Optional.empty(); + + private Optional smartFormat = Optional.empty(); + + private Optional summarize = Optional.empty(); + + private Optional tag = Optional.empty(); + + private Optional topics = Optional.empty(); + + private Optional uttSplit = Optional.empty(); + + private Optional utterances = Optional.empty(); + + private Optional version = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UsageGetRequest other) { + start(other.getStart()); + end(other.getEnd()); + accessor(other.getAccessor()); + alternatives(other.getAlternatives()); + callbackMethod(other.getCallbackMethod()); + callback(other.getCallback()); + channels(other.getChannels()); + customIntentMode(other.getCustomIntentMode()); + customIntent(other.getCustomIntent()); + customTopicMode(other.getCustomTopicMode()); + customTopic(other.getCustomTopic()); + deployment(other.getDeployment()); + detectEntities(other.getDetectEntities()); + detectLanguage(other.getDetectLanguage()); + diarize(other.getDiarize()); + dictation(other.getDictation()); + encoding(other.getEncoding()); + endpoint(other.getEndpoint()); + extra(other.getExtra()); + fillerWords(other.getFillerWords()); + intents(other.getIntents()); + keyterm(other.getKeyterm()); + keywords(other.getKeywords()); + language(other.getLanguage()); + measurements(other.getMeasurements()); + method(other.getMethod()); + model(other.getModel()); + multichannel(other.getMultichannel()); + numerals(other.getNumerals()); + paragraphs(other.getParagraphs()); + profanityFilter(other.getProfanityFilter()); + punctuate(other.getPunctuate()); + redact(other.getRedact()); + replace(other.getReplace()); + sampleRate(other.getSampleRate()); + search(other.getSearch()); + sentiment(other.getSentiment()); + smartFormat(other.getSmartFormat()); + summarize(other.getSummarize()); + tag(other.getTag()); + topics(other.getTopics()); + uttSplit(other.getUttSplit()); + utterances(other.getUtterances()); + version(other.getVersion()); + return this; + } + + /** + *

Start date of the requested date range. Format accepted is YYYY-MM-DD

+ */ + @JsonSetter(value = "start", nulls = Nulls.SKIP) + public Builder start(Optional start) { + this.start = start; + return this; + } + + public Builder start(String start) { + this.start = Optional.ofNullable(start); + return this; + } + + /** + *

End date of the requested date range. Format accepted is YYYY-MM-DD

+ */ + @JsonSetter(value = "end", nulls = Nulls.SKIP) + public Builder end(Optional end) { + this.end = end; + return this; + } + + public Builder end(String end) { + this.end = Optional.ofNullable(end); + return this; + } + + /** + *

Filter for requests where a specific accessor was used

+ */ + @JsonSetter(value = "accessor", nulls = Nulls.SKIP) + public Builder accessor(Optional accessor) { + this.accessor = accessor; + return this; + } + + public Builder accessor(String accessor) { + this.accessor = Optional.ofNullable(accessor); + return this; + } + + /** + *

Filter for requests where alternatives were used

+ */ + @JsonSetter(value = "alternatives", nulls = Nulls.SKIP) + public Builder alternatives(Optional alternatives) { + this.alternatives = alternatives; + return this; + } + + public Builder alternatives(Boolean alternatives) { + this.alternatives = Optional.ofNullable(alternatives); + return this; + } + + /** + *

Filter for requests where callback method was used

+ */ + @JsonSetter(value = "callback_method", nulls = Nulls.SKIP) + public Builder callbackMethod(Optional callbackMethod) { + this.callbackMethod = callbackMethod; + return this; + } + + public Builder callbackMethod(Boolean callbackMethod) { + this.callbackMethod = Optional.ofNullable(callbackMethod); + return this; + } + + /** + *

Filter for requests where callback was used

+ */ + @JsonSetter(value = "callback", nulls = Nulls.SKIP) + public Builder callback(Optional callback) { + this.callback = callback; + return this; + } + + public Builder callback(Boolean callback) { + this.callback = Optional.ofNullable(callback); + return this; + } + + /** + *

Filter for requests where channels were used

+ */ + @JsonSetter(value = "channels", nulls = Nulls.SKIP) + public Builder channels(Optional channels) { + this.channels = channels; + return this; + } + + public Builder channels(Boolean channels) { + this.channels = Optional.ofNullable(channels); + return this; + } + + /** + *

Filter for requests where custom intent mode was used

+ */ + @JsonSetter(value = "custom_intent_mode", nulls = Nulls.SKIP) + public Builder customIntentMode(Optional customIntentMode) { + this.customIntentMode = customIntentMode; + return this; + } + + public Builder customIntentMode(Boolean customIntentMode) { + this.customIntentMode = Optional.ofNullable(customIntentMode); + return this; + } + + /** + *

Filter for requests where custom intent was used

+ */ + @JsonSetter(value = "custom_intent", nulls = Nulls.SKIP) + public Builder customIntent(Optional customIntent) { + this.customIntent = customIntent; + return this; + } + + public Builder customIntent(Boolean customIntent) { + this.customIntent = Optional.ofNullable(customIntent); + return this; + } + + /** + *

Filter for requests where custom topic mode was used

+ */ + @JsonSetter(value = "custom_topic_mode", nulls = Nulls.SKIP) + public Builder customTopicMode(Optional customTopicMode) { + this.customTopicMode = customTopicMode; + return this; + } + + public Builder customTopicMode(Boolean customTopicMode) { + this.customTopicMode = Optional.ofNullable(customTopicMode); + return this; + } + + /** + *

Filter for requests where custom topic was used

+ */ + @JsonSetter(value = "custom_topic", nulls = Nulls.SKIP) + public Builder customTopic(Optional customTopic) { + this.customTopic = customTopic; + return this; + } + + public Builder customTopic(Boolean customTopic) { + this.customTopic = Optional.ofNullable(customTopic); + return this; + } + + /** + *

Filter for requests where a specific deployment was used

+ */ + @JsonSetter(value = "deployment", nulls = Nulls.SKIP) + public Builder deployment(Optional deployment) { + this.deployment = deployment; + return this; + } + + public Builder deployment(UsageGetRequestDeployment deployment) { + this.deployment = Optional.ofNullable(deployment); + return this; + } + + /** + *

Filter for requests where detect entities was used

+ */ + @JsonSetter(value = "detect_entities", nulls = Nulls.SKIP) + public Builder detectEntities(Optional detectEntities) { + this.detectEntities = detectEntities; + return this; + } + + public Builder detectEntities(Boolean detectEntities) { + this.detectEntities = Optional.ofNullable(detectEntities); + return this; + } + + /** + *

Filter for requests where detect language was used

+ */ + @JsonSetter(value = "detect_language", nulls = Nulls.SKIP) + public Builder detectLanguage(Optional detectLanguage) { + this.detectLanguage = detectLanguage; + return this; + } + + public Builder detectLanguage(Boolean detectLanguage) { + this.detectLanguage = Optional.ofNullable(detectLanguage); + return this; + } + + /** + *

Filter for requests where diarize was used

+ */ + @JsonSetter(value = "diarize", nulls = Nulls.SKIP) + public Builder diarize(Optional diarize) { + this.diarize = diarize; + return this; + } + + public Builder diarize(Boolean diarize) { + this.diarize = Optional.ofNullable(diarize); + return this; + } + + /** + *

Filter for requests where dictation was used

+ */ + @JsonSetter(value = "dictation", nulls = Nulls.SKIP) + public Builder dictation(Optional dictation) { + this.dictation = dictation; + return this; + } + + public Builder dictation(Boolean dictation) { + this.dictation = Optional.ofNullable(dictation); + return this; + } + + /** + *

Filter for requests where encoding was used

+ */ + @JsonSetter(value = "encoding", nulls = Nulls.SKIP) + public Builder encoding(Optional encoding) { + this.encoding = encoding; + return this; + } + + public Builder encoding(Boolean encoding) { + this.encoding = Optional.ofNullable(encoding); + return this; + } + + /** + *

Filter for requests where a specific endpoint was used

+ */ + @JsonSetter(value = "endpoint", nulls = Nulls.SKIP) + public Builder endpoint(Optional endpoint) { + this.endpoint = endpoint; + return this; + } + + public Builder endpoint(UsageGetRequestEndpoint endpoint) { + this.endpoint = Optional.ofNullable(endpoint); + return this; + } + + /** + *

Filter for requests where extra was used

+ */ + @JsonSetter(value = "extra", nulls = Nulls.SKIP) + public Builder extra(Optional extra) { + this.extra = extra; + return this; + } + + public Builder extra(Boolean extra) { + this.extra = Optional.ofNullable(extra); + return this; + } + + /** + *

Filter for requests where filler words was used

+ */ + @JsonSetter(value = "filler_words", nulls = Nulls.SKIP) + public Builder fillerWords(Optional fillerWords) { + this.fillerWords = fillerWords; + return this; + } + + public Builder fillerWords(Boolean fillerWords) { + this.fillerWords = Optional.ofNullable(fillerWords); + return this; + } + + /** + *

Filter for requests where intents was used

+ */ + @JsonSetter(value = "intents", nulls = Nulls.SKIP) + public Builder intents(Optional intents) { + this.intents = intents; + return this; + } + + public Builder intents(Boolean intents) { + this.intents = Optional.ofNullable(intents); + return this; + } + + /** + *

Filter for requests where keyterm was used

+ */ + @JsonSetter(value = "keyterm", nulls = Nulls.SKIP) + public Builder keyterm(Optional keyterm) { + this.keyterm = keyterm; + return this; + } + + public Builder keyterm(Boolean keyterm) { + this.keyterm = Optional.ofNullable(keyterm); + return this; + } + + /** + *

Filter for requests where keywords was used

+ */ + @JsonSetter(value = "keywords", nulls = Nulls.SKIP) + public Builder keywords(Optional keywords) { + this.keywords = keywords; + return this; + } + + public Builder keywords(Boolean keywords) { + this.keywords = Optional.ofNullable(keywords); + return this; + } + + /** + *

Filter for requests where language was used

+ */ + @JsonSetter(value = "language", nulls = Nulls.SKIP) + public Builder language(Optional language) { + this.language = language; + return this; + } + + public Builder language(Boolean language) { + this.language = Optional.ofNullable(language); + return this; + } + + /** + *

Filter for requests where measurements were used

+ */ + @JsonSetter(value = "measurements", nulls = Nulls.SKIP) + public Builder measurements(Optional measurements) { + this.measurements = measurements; + return this; + } + + public Builder measurements(Boolean measurements) { + this.measurements = Optional.ofNullable(measurements); + return this; + } + + /** + *

Filter for requests where a specific method was used

+ */ + @JsonSetter(value = "method", nulls = Nulls.SKIP) + public Builder method(Optional method) { + this.method = method; + return this; + } + + public Builder method(UsageGetRequestMethod method) { + this.method = Optional.ofNullable(method); + return this; + } + + /** + *

Filter for requests where a specific model uuid was used

+ */ + @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; + } + + /** + *

Filter for requests where multichannel was used

+ */ + @JsonSetter(value = "multichannel", nulls = Nulls.SKIP) + public Builder multichannel(Optional multichannel) { + this.multichannel = multichannel; + return this; + } + + public Builder multichannel(Boolean multichannel) { + this.multichannel = Optional.ofNullable(multichannel); + return this; + } + + /** + *

Filter for requests where numerals were used

+ */ + @JsonSetter(value = "numerals", nulls = Nulls.SKIP) + public Builder numerals(Optional numerals) { + this.numerals = numerals; + return this; + } + + public Builder numerals(Boolean numerals) { + this.numerals = Optional.ofNullable(numerals); + return this; + } + + /** + *

Filter for requests where paragraphs were used

+ */ + @JsonSetter(value = "paragraphs", nulls = Nulls.SKIP) + public Builder paragraphs(Optional paragraphs) { + this.paragraphs = paragraphs; + return this; + } + + public Builder paragraphs(Boolean paragraphs) { + this.paragraphs = Optional.ofNullable(paragraphs); + return this; + } + + /** + *

Filter for requests where profanity filter was used

+ */ + @JsonSetter(value = "profanity_filter", nulls = Nulls.SKIP) + public Builder profanityFilter(Optional profanityFilter) { + this.profanityFilter = profanityFilter; + return this; + } + + public Builder profanityFilter(Boolean profanityFilter) { + this.profanityFilter = Optional.ofNullable(profanityFilter); + return this; + } + + /** + *

Filter for requests where punctuate was used

+ */ + @JsonSetter(value = "punctuate", nulls = Nulls.SKIP) + public Builder punctuate(Optional punctuate) { + this.punctuate = punctuate; + return this; + } + + public Builder punctuate(Boolean punctuate) { + this.punctuate = Optional.ofNullable(punctuate); + return this; + } + + /** + *

Filter for requests where redact was used

+ */ + @JsonSetter(value = "redact", nulls = Nulls.SKIP) + public Builder redact(Optional redact) { + this.redact = redact; + return this; + } + + public Builder redact(Boolean redact) { + this.redact = Optional.ofNullable(redact); + return this; + } + + /** + *

Filter for requests where replace was used

+ */ + @JsonSetter(value = "replace", nulls = Nulls.SKIP) + public Builder replace(Optional replace) { + this.replace = replace; + return this; + } + + public Builder replace(Boolean replace) { + this.replace = Optional.ofNullable(replace); + return this; + } + + /** + *

Filter for requests where sample rate was used

+ */ + @JsonSetter(value = "sample_rate", nulls = Nulls.SKIP) + public Builder sampleRate(Optional sampleRate) { + this.sampleRate = sampleRate; + return this; + } + + public Builder sampleRate(Boolean sampleRate) { + this.sampleRate = Optional.ofNullable(sampleRate); + return this; + } + + /** + *

Filter for requests where search was used

+ */ + @JsonSetter(value = "search", nulls = Nulls.SKIP) + public Builder search(Optional search) { + this.search = search; + return this; + } + + public Builder search(Boolean search) { + this.search = Optional.ofNullable(search); + return this; + } + + /** + *

Filter for requests where sentiment was used

+ */ + @JsonSetter(value = "sentiment", nulls = Nulls.SKIP) + public Builder sentiment(Optional sentiment) { + this.sentiment = sentiment; + return this; + } + + public Builder sentiment(Boolean sentiment) { + this.sentiment = Optional.ofNullable(sentiment); + return this; + } + + /** + *

Filter for requests where smart format was used

+ */ + @JsonSetter(value = "smart_format", 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; + } + + /** + *

Filter for requests where summarize was used

+ */ + @JsonSetter(value = "summarize", nulls = Nulls.SKIP) + public Builder summarize(Optional summarize) { + this.summarize = summarize; + return this; + } + + public Builder summarize(Boolean summarize) { + this.summarize = Optional.ofNullable(summarize); + return this; + } + + /** + *

Filter for requests where a specific tag was used

+ */ + @JsonSetter(value = "tag", nulls = Nulls.SKIP) + public Builder tag(Optional tag) { + this.tag = tag; + return this; + } + + public Builder tag(String tag) { + this.tag = Optional.ofNullable(tag); + return this; + } + + /** + *

Filter for requests where topics was used

+ */ + @JsonSetter(value = "topics", nulls = Nulls.SKIP) + public Builder topics(Optional topics) { + this.topics = topics; + return this; + } + + public Builder topics(Boolean topics) { + this.topics = Optional.ofNullable(topics); + return this; + } + + /** + *

Filter for requests where utt split was used

+ */ + @JsonSetter(value = "utt_split", nulls = Nulls.SKIP) + public Builder uttSplit(Optional uttSplit) { + this.uttSplit = uttSplit; + return this; + } + + public Builder uttSplit(Boolean uttSplit) { + this.uttSplit = Optional.ofNullable(uttSplit); + return this; + } + + /** + *

Filter for requests where utterances was used

+ */ + @JsonSetter(value = "utterances", nulls = Nulls.SKIP) + public Builder utterances(Optional utterances) { + this.utterances = utterances; + return this; + } + + public Builder utterances(Boolean utterances) { + this.utterances = Optional.ofNullable(utterances); + return this; + } + + /** + *

Filter for requests where version was used

+ */ + @JsonSetter(value = "version", nulls = Nulls.SKIP) + public Builder version(Optional version) { + this.version = version; + return this; + } + + public Builder version(Boolean version) { + this.version = Optional.ofNullable(version); + return this; + } + + public UsageGetRequest build() { + return new UsageGetRequest( + start, + end, + accessor, + alternatives, + callbackMethod, + callback, + channels, + customIntentMode, + customIntent, + customTopicMode, + customTopic, + deployment, + detectEntities, + detectLanguage, + diarize, + dictation, + encoding, + endpoint, + extra, + fillerWords, + intents, + keyterm, + keywords, + language, + measurements, + method, + model, + multichannel, + numerals, + paragraphs, + profanityFilter, + punctuate, + redact, + replace, + sampleRate, + search, + sentiment, + smartFormat, + summarize, + tag, + topics, + uttSplit, + utterances, + version, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/usage/types/UsageGetRequestDeployment.java b/src/main/java/com/deepgram/resources/manage/v1/projects/usage/types/UsageGetRequestDeployment.java new file mode 100644 index 0000000..2f1231a --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/usage/types/UsageGetRequestDeployment.java @@ -0,0 +1,95 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.usage.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UsageGetRequestDeployment { + public static final UsageGetRequestDeployment SELF_HOSTED = + new UsageGetRequestDeployment(Value.SELF_HOSTED, "self-hosted"); + + public static final UsageGetRequestDeployment BETA = new UsageGetRequestDeployment(Value.BETA, "beta"); + + public static final UsageGetRequestDeployment HOSTED = new UsageGetRequestDeployment(Value.HOSTED, "hosted"); + + private final Value value; + + private final String string; + + UsageGetRequestDeployment(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UsageGetRequestDeployment + && this.string.equals(((UsageGetRequestDeployment) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SELF_HOSTED: + return visitor.visitSelfHosted(); + case BETA: + return visitor.visitBeta(); + case HOSTED: + return visitor.visitHosted(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UsageGetRequestDeployment valueOf(String value) { + switch (value) { + case "self-hosted": + return SELF_HOSTED; + case "beta": + return BETA; + case "hosted": + return HOSTED; + default: + return new UsageGetRequestDeployment(Value.UNKNOWN, value); + } + } + + public enum Value { + HOSTED, + + BETA, + + SELF_HOSTED, + + UNKNOWN + } + + public interface Visitor { + T visitHosted(); + + T visitBeta(); + + T visitSelfHosted(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/usage/types/UsageGetRequestEndpoint.java b/src/main/java/com/deepgram/resources/manage/v1/projects/usage/types/UsageGetRequestEndpoint.java new file mode 100644 index 0000000..41f335b --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/usage/types/UsageGetRequestEndpoint.java @@ -0,0 +1,104 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.usage.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UsageGetRequestEndpoint { + public static final UsageGetRequestEndpoint AGENT = new UsageGetRequestEndpoint(Value.AGENT, "agent"); + + public static final UsageGetRequestEndpoint READ = new UsageGetRequestEndpoint(Value.READ, "read"); + + public static final UsageGetRequestEndpoint LISTEN = new UsageGetRequestEndpoint(Value.LISTEN, "listen"); + + public static final UsageGetRequestEndpoint SPEAK = new UsageGetRequestEndpoint(Value.SPEAK, "speak"); + + private final Value value; + + private final String string; + + UsageGetRequestEndpoint(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UsageGetRequestEndpoint + && this.string.equals(((UsageGetRequestEndpoint) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case AGENT: + return visitor.visitAgent(); + case READ: + return visitor.visitRead(); + case LISTEN: + return visitor.visitListen(); + case SPEAK: + return visitor.visitSpeak(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UsageGetRequestEndpoint valueOf(String value) { + switch (value) { + case "agent": + return AGENT; + case "read": + return READ; + case "listen": + return LISTEN; + case "speak": + return SPEAK; + default: + return new UsageGetRequestEndpoint(Value.UNKNOWN, value); + } + } + + public enum Value { + LISTEN, + + READ, + + SPEAK, + + AGENT, + + UNKNOWN + } + + public interface Visitor { + T visitListen(); + + T visitRead(); + + T visitSpeak(); + + T visitAgent(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/manage/v1/projects/usage/types/UsageGetRequestMethod.java b/src/main/java/com/deepgram/resources/manage/v1/projects/usage/types/UsageGetRequestMethod.java new file mode 100644 index 0000000..1cea01f --- /dev/null +++ b/src/main/java/com/deepgram/resources/manage/v1/projects/usage/types/UsageGetRequestMethod.java @@ -0,0 +1,94 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.manage.v1.projects.usage.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class UsageGetRequestMethod { + public static final UsageGetRequestMethod SYNC = new UsageGetRequestMethod(Value.SYNC, "sync"); + + public static final UsageGetRequestMethod STREAMING = new UsageGetRequestMethod(Value.STREAMING, "streaming"); + + public static final UsageGetRequestMethod ASYNC = new UsageGetRequestMethod(Value.ASYNC, "async"); + + private final Value value; + + private final String string; + + UsageGetRequestMethod(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof UsageGetRequestMethod + && this.string.equals(((UsageGetRequestMethod) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SYNC: + return visitor.visitSync(); + case STREAMING: + return visitor.visitStreaming(); + case ASYNC: + return visitor.visitAsync(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static UsageGetRequestMethod valueOf(String value) { + switch (value) { + case "sync": + return SYNC; + case "streaming": + return STREAMING; + case "async": + return ASYNC; + default: + return new UsageGetRequestMethod(Value.UNKNOWN, value); + } + } + + public enum Value { + SYNC, + + ASYNC, + + STREAMING, + + UNKNOWN + } + + public interface Visitor { + T visitSync(); + + T visitAsync(); + + T visitStreaming(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/read/AsyncReadClient.java b/src/main/java/com/deepgram/resources/read/AsyncReadClient.java new file mode 100644 index 0000000..877b59f --- /dev/null +++ b/src/main/java/com/deepgram/resources/read/AsyncReadClient.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.read; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.Suppliers; +import com.deepgram.resources.read.v1.AsyncV1Client; +import java.util.function.Supplier; + +public class AsyncReadClient { + protected final ClientOptions clientOptions; + + protected final Supplier v1Client; + + public AsyncReadClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.v1Client = Suppliers.memoize(() -> new AsyncV1Client(clientOptions)); + } + + public AsyncV1Client v1() { + return this.v1Client.get(); + } +} diff --git a/src/main/java/com/deepgram/resources/read/ReadClient.java b/src/main/java/com/deepgram/resources/read/ReadClient.java new file mode 100644 index 0000000..84412b3 --- /dev/null +++ b/src/main/java/com/deepgram/resources/read/ReadClient.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.read; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.Suppliers; +import com.deepgram.resources.read.v1.V1Client; +import java.util.function.Supplier; + +public class ReadClient { + protected final ClientOptions clientOptions; + + protected final Supplier v1Client; + + public ReadClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.v1Client = Suppliers.memoize(() -> new V1Client(clientOptions)); + } + + public V1Client v1() { + return this.v1Client.get(); + } +} diff --git a/src/main/java/com/deepgram/resources/read/v1/AsyncV1Client.java b/src/main/java/com/deepgram/resources/read/v1/AsyncV1Client.java new file mode 100644 index 0000000..cd7a143 --- /dev/null +++ b/src/main/java/com/deepgram/resources/read/v1/AsyncV1Client.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.read.v1; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.Suppliers; +import com.deepgram.resources.read.v1.text.AsyncTextClient; +import java.util.function.Supplier; + +public class AsyncV1Client { + protected final ClientOptions clientOptions; + + protected final Supplier textClient; + + public AsyncV1Client(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.textClient = Suppliers.memoize(() -> new AsyncTextClient(clientOptions)); + } + + public AsyncTextClient text() { + return this.textClient.get(); + } +} diff --git a/src/main/java/com/deepgram/resources/read/v1/V1Client.java b/src/main/java/com/deepgram/resources/read/v1/V1Client.java new file mode 100644 index 0000000..d8f6752 --- /dev/null +++ b/src/main/java/com/deepgram/resources/read/v1/V1Client.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.read.v1; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.Suppliers; +import com.deepgram.resources.read.v1.text.TextClient; +import java.util.function.Supplier; + +public class V1Client { + protected final ClientOptions clientOptions; + + protected final Supplier textClient; + + public V1Client(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.textClient = Suppliers.memoize(() -> new TextClient(clientOptions)); + } + + public TextClient text() { + return this.textClient.get(); + } +} diff --git a/src/main/java/com/deepgram/resources/read/v1/text/AsyncRawTextClient.java b/src/main/java/com/deepgram/resources/read/v1/text/AsyncRawTextClient.java new file mode 100644 index 0000000..0e0159a --- /dev/null +++ b/src/main/java/com/deepgram/resources/read/v1/text/AsyncRawTextClient.java @@ -0,0 +1,176 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.read.v1.text; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.DeepgramApiApiException; +import com.deepgram.core.DeepgramApiException; +import com.deepgram.core.DeepgramApiHttpResponse; +import com.deepgram.core.MediaTypes; +import com.deepgram.core.ObjectMappers; +import com.deepgram.core.QueryStringMapper; +import com.deepgram.core.RequestOptions; +import com.deepgram.errors.BadRequestError; +import com.deepgram.resources.read.v1.text.requests.TextAnalyzeRequest; +import com.deepgram.types.ReadV1Request; +import com.deepgram.types.ReadV1Response; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawTextClient { + protected final ClientOptions clientOptions; + + public AsyncRawTextClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Analyze text content using Deepgrams text analysis API + */ + public CompletableFuture> analyze(ReadV1Request body) { + return analyze(TextAnalyzeRequest.builder().body(body).build()); + } + + /** + * Analyze text content using Deepgrams text analysis API + */ + public CompletableFuture> analyze( + ReadV1Request body, RequestOptions requestOptions) { + return analyze(TextAnalyzeRequest.builder().body(body).build(), requestOptions); + } + + /** + * Analyze text content using Deepgrams text analysis API + */ + public CompletableFuture> analyze(TextAnalyzeRequest request) { + return analyze(request, null); + } + + /** + * Analyze text content using Deepgrams text analysis API + */ + public CompletableFuture> analyze( + TextAnalyzeRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/read"); + if (request.getCallback().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "callback", request.getCallback().get(), false); + } + if (request.getCallbackMethod().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "callback_method", request.getCallbackMethod().get(), false); + } + if (request.getSentiment().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "sentiment", request.getSentiment().get(), false); + } + if (request.getSummarize().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "summarize", request.getSummarize().get(), false); + } + if (request.getTopics().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "topics", request.getTopics().get(), false); + } + if (request.getCustomTopicMode().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "custom_topic_mode", request.getCustomTopicMode().get(), false); + } + if (request.getIntents().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "intents", request.getIntents().get(), false); + } + if (request.getCustomIntentMode().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "custom_intent_mode", request.getCustomIntentMode().get(), false); + } + if (request.getLanguage().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "language", request.getLanguage().get(), false); + } + if (request.getTag().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "tag", request.getTag().get(), true); + } + if (request.getCustomTopic().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "custom_topic", request.getCustomTopic().get(), true); + } + if (request.getCustomIntent().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "custom_intent", request.getCustomIntent().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ReadV1Response.class), + response)); + return; + } + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/deepgram/resources/read/v1/text/AsyncTextClient.java b/src/main/java/com/deepgram/resources/read/v1/text/AsyncTextClient.java new file mode 100644 index 0000000..29f6075 --- /dev/null +++ b/src/main/java/com/deepgram/resources/read/v1/text/AsyncTextClient.java @@ -0,0 +1,57 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.read.v1.text; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.RequestOptions; +import com.deepgram.resources.read.v1.text.requests.TextAnalyzeRequest; +import com.deepgram.types.ReadV1Request; +import com.deepgram.types.ReadV1Response; +import java.util.concurrent.CompletableFuture; + +public class AsyncTextClient { + protected final ClientOptions clientOptions; + + private final AsyncRawTextClient rawClient; + + public AsyncTextClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawTextClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawTextClient withRawResponse() { + return this.rawClient; + } + + /** + * Analyze text content using Deepgrams text analysis API + */ + public CompletableFuture analyze(ReadV1Request body) { + return this.rawClient.analyze(body).thenApply(response -> response.body()); + } + + /** + * Analyze text content using Deepgrams text analysis API + */ + public CompletableFuture analyze(ReadV1Request body, RequestOptions requestOptions) { + return this.rawClient.analyze(body, requestOptions).thenApply(response -> response.body()); + } + + /** + * Analyze text content using Deepgrams text analysis API + */ + public CompletableFuture analyze(TextAnalyzeRequest request) { + return this.rawClient.analyze(request).thenApply(response -> response.body()); + } + + /** + * Analyze text content using Deepgrams text analysis API + */ + public CompletableFuture analyze(TextAnalyzeRequest request, RequestOptions requestOptions) { + return this.rawClient.analyze(request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/deepgram/resources/read/v1/text/RawTextClient.java b/src/main/java/com/deepgram/resources/read/v1/text/RawTextClient.java new file mode 100644 index 0000000..1aad17d --- /dev/null +++ b/src/main/java/com/deepgram/resources/read/v1/text/RawTextClient.java @@ -0,0 +1,155 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.read.v1.text; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.DeepgramApiApiException; +import com.deepgram.core.DeepgramApiException; +import com.deepgram.core.DeepgramApiHttpResponse; +import com.deepgram.core.MediaTypes; +import com.deepgram.core.ObjectMappers; +import com.deepgram.core.QueryStringMapper; +import com.deepgram.core.RequestOptions; +import com.deepgram.errors.BadRequestError; +import com.deepgram.resources.read.v1.text.requests.TextAnalyzeRequest; +import com.deepgram.types.ReadV1Request; +import com.deepgram.types.ReadV1Response; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawTextClient { + protected final ClientOptions clientOptions; + + public RawTextClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Analyze text content using Deepgrams text analysis API + */ + public DeepgramApiHttpResponse analyze(ReadV1Request body) { + return analyze(TextAnalyzeRequest.builder().body(body).build()); + } + + /** + * Analyze text content using Deepgrams text analysis API + */ + public DeepgramApiHttpResponse analyze(ReadV1Request body, RequestOptions requestOptions) { + return analyze(TextAnalyzeRequest.builder().body(body).build(), requestOptions); + } + + /** + * Analyze text content using Deepgrams text analysis API + */ + public DeepgramApiHttpResponse analyze(TextAnalyzeRequest request) { + return analyze(request, null); + } + + /** + * Analyze text content using Deepgrams text analysis API + */ + public DeepgramApiHttpResponse analyze(TextAnalyzeRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/read"); + if (request.getCallback().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "callback", request.getCallback().get(), false); + } + if (request.getCallbackMethod().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "callback_method", request.getCallbackMethod().get(), false); + } + if (request.getSentiment().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "sentiment", request.getSentiment().get(), false); + } + if (request.getSummarize().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "summarize", request.getSummarize().get(), false); + } + if (request.getTopics().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "topics", request.getTopics().get(), false); + } + if (request.getCustomTopicMode().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "custom_topic_mode", request.getCustomTopicMode().get(), false); + } + if (request.getIntents().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "intents", request.getIntents().get(), false); + } + if (request.getCustomIntentMode().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "custom_intent_mode", request.getCustomIntentMode().get(), false); + } + if (request.getLanguage().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "language", request.getLanguage().get(), false); + } + if (request.getTag().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "tag", request.getTag().get(), true); + } + if (request.getCustomTopic().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "custom_topic", request.getCustomTopic().get(), true); + } + if (request.getCustomIntent().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "custom_intent", request.getCustomIntent().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ReadV1Response.class), response); + } + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new DeepgramApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/deepgram/resources/read/v1/text/TextClient.java b/src/main/java/com/deepgram/resources/read/v1/text/TextClient.java new file mode 100644 index 0000000..72db135 --- /dev/null +++ b/src/main/java/com/deepgram/resources/read/v1/text/TextClient.java @@ -0,0 +1,56 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.read.v1.text; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.RequestOptions; +import com.deepgram.resources.read.v1.text.requests.TextAnalyzeRequest; +import com.deepgram.types.ReadV1Request; +import com.deepgram.types.ReadV1Response; + +public class TextClient { + protected final ClientOptions clientOptions; + + private final RawTextClient rawClient; + + public TextClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawTextClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawTextClient withRawResponse() { + return this.rawClient; + } + + /** + * Analyze text content using Deepgrams text analysis API + */ + public ReadV1Response analyze(ReadV1Request body) { + return this.rawClient.analyze(body).body(); + } + + /** + * Analyze text content using Deepgrams text analysis API + */ + public ReadV1Response analyze(ReadV1Request body, RequestOptions requestOptions) { + return this.rawClient.analyze(body, requestOptions).body(); + } + + /** + * Analyze text content using Deepgrams text analysis API + */ + public ReadV1Response analyze(TextAnalyzeRequest request) { + return this.rawClient.analyze(request).body(); + } + + /** + * Analyze text content using Deepgrams text analysis API + */ + public ReadV1Response analyze(TextAnalyzeRequest request, RequestOptions requestOptions) { + return this.rawClient.analyze(request, requestOptions).body(); + } +} diff --git a/src/main/java/com/deepgram/resources/read/v1/text/requests/TextAnalyzeRequest.java b/src/main/java/com/deepgram/resources/read/v1/text/requests/TextAnalyzeRequest.java new file mode 100644 index 0000000..29502db --- /dev/null +++ b/src/main/java/com/deepgram/resources/read/v1/text/requests/TextAnalyzeRequest.java @@ -0,0 +1,697 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.read.v1.text.requests; + +import com.deepgram.core.ObjectMappers; +import com.deepgram.resources.read.v1.text.types.TextAnalyzeRequestCallbackMethod; +import com.deepgram.resources.read.v1.text.types.TextAnalyzeRequestCustomIntentMode; +import com.deepgram.resources.read.v1.text.types.TextAnalyzeRequestCustomTopicMode; +import com.deepgram.resources.read.v1.text.types.TextAnalyzeRequestSummarize; +import com.deepgram.types.ReadV1Request; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.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 java.util.Collections; +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 = TextAnalyzeRequest.Builder.class) +public final class TextAnalyzeRequest { + private final Optional> tag; + + private final Optional> customTopic; + + private final Optional> customIntent; + + private final Optional callback; + + private final Optional callbackMethod; + + private final Optional sentiment; + + private final Optional summarize; + + private final Optional topics; + + private final Optional customTopicMode; + + private final Optional intents; + + private final Optional customIntentMode; + + private final Optional language; + + private final ReadV1Request body; + + private final Map additionalProperties; + + private TextAnalyzeRequest( + Optional> tag, + Optional> customTopic, + Optional> customIntent, + Optional callback, + Optional callbackMethod, + Optional sentiment, + Optional summarize, + Optional topics, + Optional customTopicMode, + Optional intents, + Optional customIntentMode, + Optional language, + ReadV1Request body, + Map additionalProperties) { + this.tag = tag; + this.customTopic = customTopic; + this.customIntent = customIntent; + this.callback = callback; + this.callbackMethod = callbackMethod; + this.sentiment = sentiment; + this.summarize = summarize; + this.topics = topics; + this.customTopicMode = customTopicMode; + this.intents = intents; + this.customIntentMode = customIntentMode; + this.language = language; + this.body = body; + this.additionalProperties = additionalProperties; + } + + /** + * @return Label your requests for the purpose of identification during usage reporting + */ + @JsonIgnore + public Optional> getTag() { + return tag; + } + + /** + * @return Custom topics you want the model to detect within your input audio or text if present Submit up to 100. + */ + @JsonIgnore + public Optional> getCustomTopic() { + return customTopic; + } + + /** + * @return Custom intents you want the model to detect within your input audio if present + */ + @JsonIgnore + public Optional> getCustomIntent() { + return customIntent; + } + + /** + * @return URL to which we'll make the callback request + */ + @JsonIgnore + public Optional getCallback() { + return callback; + } + + /** + * @return HTTP method by which the callback request will be made + */ + @JsonIgnore + public Optional getCallbackMethod() { + return callbackMethod; + } + + /** + * @return Recognizes the sentiment throughout a transcript or text + */ + @JsonIgnore + public Optional getSentiment() { + return sentiment; + } + + /** + * @return Summarize content. For Listen API, supports string version option. For Read API, accepts boolean only. + */ + @JsonIgnore + public Optional getSummarize() { + return summarize; + } + + /** + * @return Detect topics throughout a transcript or text + */ + @JsonIgnore + public Optional getTopics() { + return topics; + } + + /** + * @return Sets how the model will interpret strings submitted to the custom_topic param. When strict, the model will only return topics submitted using the custom_topic param. When extended, the model will return its own detected topics in addition to those submitted using the custom_topic param + */ + @JsonIgnore + public Optional getCustomTopicMode() { + return customTopicMode; + } + + /** + * @return Recognizes speaker intent throughout a transcript or text + */ + @JsonIgnore + public Optional getIntents() { + return intents; + } + + /** + * @return Sets how the model will interpret intents submitted to the custom_intent param. When strict, the model will only return intents submitted using the custom_intent param. When extended, the model will return its own detected intents in the custom_intent param. + */ + @JsonIgnore + public Optional getCustomIntentMode() { + return customIntentMode; + } + + /** + * @return The BCP-47 language tag that hints at the primary spoken language. Depending on the Model and API endpoint you choose only certain languages are available + */ + @JsonIgnore + public Optional getLanguage() { + return language; + } + + @JsonProperty("body") + public ReadV1Request getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TextAnalyzeRequest && equalTo((TextAnalyzeRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TextAnalyzeRequest other) { + return tag.equals(other.tag) + && customTopic.equals(other.customTopic) + && customIntent.equals(other.customIntent) + && callback.equals(other.callback) + && callbackMethod.equals(other.callbackMethod) + && sentiment.equals(other.sentiment) + && summarize.equals(other.summarize) + && topics.equals(other.topics) + && customTopicMode.equals(other.customTopicMode) + && intents.equals(other.intents) + && customIntentMode.equals(other.customIntentMode) + && language.equals(other.language) + && body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.tag, + this.customTopic, + this.customIntent, + this.callback, + this.callbackMethod, + this.sentiment, + this.summarize, + this.topics, + this.customTopicMode, + this.intents, + this.customIntentMode, + this.language, + this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BodyStage builder() { + return new Builder(); + } + + public interface BodyStage { + _FinalStage body(@NotNull ReadV1Request body); + + Builder from(TextAnalyzeRequest other); + } + + public interface _FinalStage { + TextAnalyzeRequest build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Label your requests for the purpose of identification during usage reporting

+ */ + _FinalStage tag(Optional> tag); + + _FinalStage tag(List tag); + + _FinalStage tag(String tag); + + /** + *

Custom topics you want the model to detect within your input audio or text if present Submit up to 100.

+ */ + _FinalStage customTopic(Optional> customTopic); + + _FinalStage customTopic(List customTopic); + + _FinalStage customTopic(String customTopic); + + /** + *

Custom intents you want the model to detect within your input audio if present

+ */ + _FinalStage customIntent(Optional> customIntent); + + _FinalStage customIntent(List customIntent); + + _FinalStage customIntent(String customIntent); + + /** + *

URL to which we'll make the callback request

+ */ + _FinalStage callback(Optional callback); + + _FinalStage callback(String callback); + + /** + *

HTTP method by which the callback request will be made

+ */ + _FinalStage callbackMethod(Optional callbackMethod); + + _FinalStage callbackMethod(TextAnalyzeRequestCallbackMethod callbackMethod); + + /** + *

Recognizes the sentiment throughout a transcript or text

+ */ + _FinalStage sentiment(Optional sentiment); + + _FinalStage sentiment(Boolean sentiment); + + /** + *

Summarize content. For Listen API, supports string version option. For Read API, accepts boolean only.

+ */ + _FinalStage summarize(Optional summarize); + + _FinalStage summarize(TextAnalyzeRequestSummarize summarize); + + /** + *

Detect topics throughout a transcript or text

+ */ + _FinalStage topics(Optional topics); + + _FinalStage topics(Boolean topics); + + /** + *

Sets how the model will interpret strings submitted to the custom_topic param. When strict, the model will only return topics submitted using the custom_topic param. When extended, the model will return its own detected topics in addition to those submitted using the custom_topic param

+ */ + _FinalStage customTopicMode(Optional customTopicMode); + + _FinalStage customTopicMode(TextAnalyzeRequestCustomTopicMode customTopicMode); + + /** + *

Recognizes speaker intent throughout a transcript or text

+ */ + _FinalStage intents(Optional intents); + + _FinalStage intents(Boolean intents); + + /** + *

Sets how the model will interpret intents submitted to the custom_intent param. When strict, the model will only return intents submitted using the custom_intent param. When extended, the model will return its own detected intents in the custom_intent param.

+ */ + _FinalStage customIntentMode(Optional customIntentMode); + + _FinalStage customIntentMode(TextAnalyzeRequestCustomIntentMode customIntentMode); + + /** + *

The BCP-47 language tag that hints at the primary spoken language. Depending on the Model and API endpoint you choose only certain languages are available

+ */ + _FinalStage language(Optional language); + + _FinalStage language(String language); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements BodyStage, _FinalStage { + private ReadV1Request body; + + private Optional language = Optional.empty(); + + private Optional customIntentMode = Optional.empty(); + + private Optional intents = Optional.empty(); + + private Optional customTopicMode = Optional.empty(); + + private Optional topics = Optional.empty(); + + private Optional summarize = Optional.empty(); + + private Optional sentiment = Optional.empty(); + + private Optional callbackMethod = Optional.empty(); + + private Optional callback = Optional.empty(); + + private Optional> customIntent = Optional.empty(); + + private Optional> customTopic = Optional.empty(); + + private Optional> tag = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(TextAnalyzeRequest other) { + tag(other.getTag()); + customTopic(other.getCustomTopic()); + customIntent(other.getCustomIntent()); + callback(other.getCallback()); + callbackMethod(other.getCallbackMethod()); + sentiment(other.getSentiment()); + summarize(other.getSummarize()); + topics(other.getTopics()); + customTopicMode(other.getCustomTopicMode()); + intents(other.getIntents()); + customIntentMode(other.getCustomIntentMode()); + language(other.getLanguage()); + body(other.getBody()); + return this; + } + + @java.lang.Override + @JsonSetter("body") + public _FinalStage body(@NotNull ReadV1Request body) { + this.body = Objects.requireNonNull(body, "body must not be null"); + return this; + } + + /** + *

The BCP-47 language tag that hints at the primary spoken language. Depending on the Model and API endpoint you choose only certain languages are available

+ * @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; + } + + /** + *

The BCP-47 language tag that hints at the primary spoken language. Depending on the Model and API endpoint you choose only certain languages are available

+ */ + @java.lang.Override + @JsonSetter(value = "language", nulls = Nulls.SKIP) + public _FinalStage language(Optional language) { + this.language = language; + return this; + } + + /** + *

Sets how the model will interpret intents submitted to the custom_intent param. When strict, the model will only return intents submitted using the custom_intent param. When extended, the model will return its own detected intents in the custom_intent param.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customIntentMode(TextAnalyzeRequestCustomIntentMode customIntentMode) { + this.customIntentMode = Optional.ofNullable(customIntentMode); + return this; + } + + /** + *

Sets how the model will interpret intents submitted to the custom_intent param. When strict, the model will only return intents submitted using the custom_intent param. When extended, the model will return its own detected intents in the custom_intent param.

+ */ + @java.lang.Override + @JsonSetter(value = "custom_intent_mode", nulls = Nulls.SKIP) + public _FinalStage customIntentMode(Optional customIntentMode) { + this.customIntentMode = customIntentMode; + return this; + } + + /** + *

Recognizes speaker intent throughout a transcript or text

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage intents(Boolean intents) { + this.intents = Optional.ofNullable(intents); + return this; + } + + /** + *

Recognizes speaker intent throughout a transcript or text

+ */ + @java.lang.Override + @JsonSetter(value = "intents", nulls = Nulls.SKIP) + public _FinalStage intents(Optional intents) { + this.intents = intents; + return this; + } + + /** + *

Sets how the model will interpret strings submitted to the custom_topic param. When strict, the model will only return topics submitted using the custom_topic param. When extended, the model will return its own detected topics in addition to those submitted using the custom_topic param

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customTopicMode(TextAnalyzeRequestCustomTopicMode customTopicMode) { + this.customTopicMode = Optional.ofNullable(customTopicMode); + return this; + } + + /** + *

Sets how the model will interpret strings submitted to the custom_topic param. When strict, the model will only return topics submitted using the custom_topic param. When extended, the model will return its own detected topics in addition to those submitted using the custom_topic param

+ */ + @java.lang.Override + @JsonSetter(value = "custom_topic_mode", nulls = Nulls.SKIP) + public _FinalStage customTopicMode(Optional customTopicMode) { + this.customTopicMode = customTopicMode; + return this; + } + + /** + *

Detect topics throughout a transcript or text

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage topics(Boolean topics) { + this.topics = Optional.ofNullable(topics); + return this; + } + + /** + *

Detect topics throughout a transcript or text

+ */ + @java.lang.Override + @JsonSetter(value = "topics", nulls = Nulls.SKIP) + public _FinalStage topics(Optional topics) { + this.topics = topics; + return this; + } + + /** + *

Summarize content. For Listen API, supports string version option. For Read API, accepts boolean only.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage summarize(TextAnalyzeRequestSummarize summarize) { + this.summarize = Optional.ofNullable(summarize); + return this; + } + + /** + *

Summarize content. For Listen API, supports string version option. For Read API, accepts boolean only.

+ */ + @java.lang.Override + @JsonSetter(value = "summarize", nulls = Nulls.SKIP) + public _FinalStage summarize(Optional summarize) { + this.summarize = summarize; + return this; + } + + /** + *

Recognizes the sentiment throughout a transcript or text

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sentiment(Boolean sentiment) { + this.sentiment = Optional.ofNullable(sentiment); + return this; + } + + /** + *

Recognizes the sentiment throughout a transcript or text

+ */ + @java.lang.Override + @JsonSetter(value = "sentiment", nulls = Nulls.SKIP) + public _FinalStage sentiment(Optional sentiment) { + this.sentiment = sentiment; + return this; + } + + /** + *

HTTP method by which the callback request will be made

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage callbackMethod(TextAnalyzeRequestCallbackMethod callbackMethod) { + this.callbackMethod = Optional.ofNullable(callbackMethod); + return this; + } + + /** + *

HTTP method by which the callback request will be made

+ */ + @java.lang.Override + @JsonSetter(value = "callback_method", nulls = Nulls.SKIP) + public _FinalStage callbackMethod(Optional callbackMethod) { + this.callbackMethod = callbackMethod; + return this; + } + + /** + *

URL to which we'll make the callback request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage callback(String callback) { + this.callback = Optional.ofNullable(callback); + return this; + } + + /** + *

URL to which we'll make the callback request

+ */ + @java.lang.Override + @JsonSetter(value = "callback", nulls = Nulls.SKIP) + public _FinalStage callback(Optional callback) { + this.callback = callback; + return this; + } + + @java.lang.Override + public _FinalStage customIntent(String customIntent) { + this.customIntent = Optional.of(Collections.singletonList(customIntent)); + return this; + } + + /** + *

Custom intents you want the model to detect within your input audio if present

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

Custom intents you want the model to detect within your input audio if present

+ */ + @java.lang.Override + @JsonSetter(value = "custom_intent", nulls = Nulls.SKIP) + public _FinalStage customIntent(Optional> customIntent) { + this.customIntent = customIntent; + return this; + } + + @java.lang.Override + public _FinalStage customTopic(String customTopic) { + this.customTopic = Optional.of(Collections.singletonList(customTopic)); + return this; + } + + /** + *

Custom topics you want the model to detect within your input audio or text if present Submit up to 100.

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

Custom topics you want the model to detect within your input audio or text if present Submit up to 100.

+ */ + @java.lang.Override + @JsonSetter(value = "custom_topic", nulls = Nulls.SKIP) + public _FinalStage customTopic(Optional> customTopic) { + this.customTopic = customTopic; + return this; + } + + @java.lang.Override + public _FinalStage tag(String tag) { + this.tag = Optional.of(Collections.singletonList(tag)); + return this; + } + + /** + *

Label your requests for the purpose of identification during usage reporting

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

Label your requests for the purpose of identification during usage reporting

+ */ + @java.lang.Override + @JsonSetter(value = "tag", nulls = Nulls.SKIP) + public _FinalStage tag(Optional> tag) { + this.tag = tag; + return this; + } + + @java.lang.Override + public TextAnalyzeRequest build() { + return new TextAnalyzeRequest( + tag, + customTopic, + customIntent, + callback, + callbackMethod, + sentiment, + summarize, + topics, + customTopicMode, + intents, + customIntentMode, + language, + body, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/read/v1/text/types/TextAnalyzeRequestCallbackMethod.java b/src/main/java/com/deepgram/resources/read/v1/text/types/TextAnalyzeRequestCallbackMethod.java new file mode 100644 index 0000000..a71dd69 --- /dev/null +++ b/src/main/java/com/deepgram/resources/read/v1/text/types/TextAnalyzeRequestCallbackMethod.java @@ -0,0 +1,85 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.read.v1.text.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class TextAnalyzeRequestCallbackMethod { + public static final TextAnalyzeRequestCallbackMethod PUT = new TextAnalyzeRequestCallbackMethod(Value.PUT, "PUT"); + + public static final TextAnalyzeRequestCallbackMethod POST = + new TextAnalyzeRequestCallbackMethod(Value.POST, "POST"); + + private final Value value; + + private final String string; + + TextAnalyzeRequestCallbackMethod(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof TextAnalyzeRequestCallbackMethod + && this.string.equals(((TextAnalyzeRequestCallbackMethod) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PUT: + return visitor.visitPut(); + case POST: + return visitor.visitPost(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static TextAnalyzeRequestCallbackMethod valueOf(String value) { + switch (value) { + case "PUT": + return PUT; + case "POST": + return POST; + default: + return new TextAnalyzeRequestCallbackMethod(Value.UNKNOWN, value); + } + } + + public enum Value { + POST, + + PUT, + + UNKNOWN + } + + public interface Visitor { + T visitPost(); + + T visitPut(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/read/v1/text/types/TextAnalyzeRequestCustomIntentMode.java b/src/main/java/com/deepgram/resources/read/v1/text/types/TextAnalyzeRequestCustomIntentMode.java new file mode 100644 index 0000000..ac379ca --- /dev/null +++ b/src/main/java/com/deepgram/resources/read/v1/text/types/TextAnalyzeRequestCustomIntentMode.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.read.v1.text.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class TextAnalyzeRequestCustomIntentMode { + public static final TextAnalyzeRequestCustomIntentMode STRICT = + new TextAnalyzeRequestCustomIntentMode(Value.STRICT, "strict"); + + public static final TextAnalyzeRequestCustomIntentMode EXTENDED = + new TextAnalyzeRequestCustomIntentMode(Value.EXTENDED, "extended"); + + private final Value value; + + private final String string; + + TextAnalyzeRequestCustomIntentMode(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof TextAnalyzeRequestCustomIntentMode + && this.string.equals(((TextAnalyzeRequestCustomIntentMode) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case STRICT: + return visitor.visitStrict(); + case EXTENDED: + return visitor.visitExtended(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static TextAnalyzeRequestCustomIntentMode valueOf(String value) { + switch (value) { + case "strict": + return STRICT; + case "extended": + return EXTENDED; + default: + return new TextAnalyzeRequestCustomIntentMode(Value.UNKNOWN, value); + } + } + + public enum Value { + EXTENDED, + + STRICT, + + UNKNOWN + } + + public interface Visitor { + T visitExtended(); + + T visitStrict(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/read/v1/text/types/TextAnalyzeRequestCustomTopicMode.java b/src/main/java/com/deepgram/resources/read/v1/text/types/TextAnalyzeRequestCustomTopicMode.java new file mode 100644 index 0000000..5077a0c --- /dev/null +++ b/src/main/java/com/deepgram/resources/read/v1/text/types/TextAnalyzeRequestCustomTopicMode.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.read.v1.text.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class TextAnalyzeRequestCustomTopicMode { + public static final TextAnalyzeRequestCustomTopicMode STRICT = + new TextAnalyzeRequestCustomTopicMode(Value.STRICT, "strict"); + + public static final TextAnalyzeRequestCustomTopicMode EXTENDED = + new TextAnalyzeRequestCustomTopicMode(Value.EXTENDED, "extended"); + + private final Value value; + + private final String string; + + TextAnalyzeRequestCustomTopicMode(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof TextAnalyzeRequestCustomTopicMode + && this.string.equals(((TextAnalyzeRequestCustomTopicMode) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case STRICT: + return visitor.visitStrict(); + case EXTENDED: + return visitor.visitExtended(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static TextAnalyzeRequestCustomTopicMode valueOf(String value) { + switch (value) { + case "strict": + return STRICT; + case "extended": + return EXTENDED; + default: + return new TextAnalyzeRequestCustomTopicMode(Value.UNKNOWN, value); + } + } + + public enum Value { + EXTENDED, + + STRICT, + + UNKNOWN + } + + public interface Visitor { + T visitExtended(); + + T visitStrict(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/read/v1/text/types/TextAnalyzeRequestSummarize.java b/src/main/java/com/deepgram/resources/read/v1/text/types/TextAnalyzeRequestSummarize.java new file mode 100644 index 0000000..1a351e4 --- /dev/null +++ b/src/main/java/com/deepgram/resources/read/v1/text/types/TextAnalyzeRequestSummarize.java @@ -0,0 +1,74 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.read.v1.text.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class TextAnalyzeRequestSummarize { + public static final TextAnalyzeRequestSummarize V2 = new TextAnalyzeRequestSummarize(Value.V2, "v2"); + + private final Value value; + + private final String string; + + TextAnalyzeRequestSummarize(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof TextAnalyzeRequestSummarize + && this.string.equals(((TextAnalyzeRequestSummarize) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case V2: + return visitor.visitV2(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static TextAnalyzeRequestSummarize valueOf(String value) { + switch (value) { + case "v2": + return V2; + default: + return new TextAnalyzeRequestSummarize(Value.UNKNOWN, value); + } + } + + public enum Value { + V2, + + UNKNOWN + } + + public interface Visitor { + T visitV2(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/selfhosted/AsyncSelfHostedClient.java b/src/main/java/com/deepgram/resources/selfhosted/AsyncSelfHostedClient.java new file mode 100644 index 0000000..6828ce8 --- /dev/null +++ b/src/main/java/com/deepgram/resources/selfhosted/AsyncSelfHostedClient.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.selfhosted; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.Suppliers; +import com.deepgram.resources.selfhosted.v1.AsyncV1Client; +import java.util.function.Supplier; + +public class AsyncSelfHostedClient { + protected final ClientOptions clientOptions; + + protected final Supplier v1Client; + + public AsyncSelfHostedClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.v1Client = Suppliers.memoize(() -> new AsyncV1Client(clientOptions)); + } + + public AsyncV1Client v1() { + return this.v1Client.get(); + } +} diff --git a/src/main/java/com/deepgram/resources/selfhosted/SelfHostedClient.java b/src/main/java/com/deepgram/resources/selfhosted/SelfHostedClient.java new file mode 100644 index 0000000..f84595c --- /dev/null +++ b/src/main/java/com/deepgram/resources/selfhosted/SelfHostedClient.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.selfhosted; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.Suppliers; +import com.deepgram.resources.selfhosted.v1.V1Client; +import java.util.function.Supplier; + +public class SelfHostedClient { + protected final ClientOptions clientOptions; + + protected final Supplier v1Client; + + public SelfHostedClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.v1Client = Suppliers.memoize(() -> new V1Client(clientOptions)); + } + + public V1Client v1() { + return this.v1Client.get(); + } +} diff --git a/src/main/java/com/deepgram/resources/selfhosted/v1/AsyncV1Client.java b/src/main/java/com/deepgram/resources/selfhosted/v1/AsyncV1Client.java new file mode 100644 index 0000000..3362aa0 --- /dev/null +++ b/src/main/java/com/deepgram/resources/selfhosted/v1/AsyncV1Client.java @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.selfhosted.v1; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.Suppliers; +import com.deepgram.resources.selfhosted.v1.distributioncredentials.AsyncDistributionCredentialsClient; +import java.util.function.Supplier; + +public class AsyncV1Client { + protected final ClientOptions clientOptions; + + protected final Supplier distributionCredentialsClient; + + public AsyncV1Client(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.distributionCredentialsClient = + Suppliers.memoize(() -> new AsyncDistributionCredentialsClient(clientOptions)); + } + + public AsyncDistributionCredentialsClient distributionCredentials() { + return this.distributionCredentialsClient.get(); + } +} diff --git a/src/main/java/com/deepgram/resources/selfhosted/v1/V1Client.java b/src/main/java/com/deepgram/resources/selfhosted/v1/V1Client.java new file mode 100644 index 0000000..f638aee --- /dev/null +++ b/src/main/java/com/deepgram/resources/selfhosted/v1/V1Client.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.selfhosted.v1; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.Suppliers; +import com.deepgram.resources.selfhosted.v1.distributioncredentials.DistributionCredentialsClient; +import java.util.function.Supplier; + +public class V1Client { + protected final ClientOptions clientOptions; + + protected final Supplier distributionCredentialsClient; + + public V1Client(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.distributionCredentialsClient = Suppliers.memoize(() -> new DistributionCredentialsClient(clientOptions)); + } + + public DistributionCredentialsClient distributionCredentials() { + return this.distributionCredentialsClient.get(); + } +} diff --git a/src/main/java/com/deepgram/resources/selfhosted/v1/distributioncredentials/AsyncDistributionCredentialsClient.java b/src/main/java/com/deepgram/resources/selfhosted/v1/distributioncredentials/AsyncDistributionCredentialsClient.java new file mode 100644 index 0000000..4f05f05 --- /dev/null +++ b/src/main/java/com/deepgram/resources/selfhosted/v1/distributioncredentials/AsyncDistributionCredentialsClient.java @@ -0,0 +1,112 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.selfhosted.v1.distributioncredentials; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.RequestOptions; +import com.deepgram.resources.selfhosted.v1.distributioncredentials.requests.CreateProjectDistributionCredentialsV1Request; +import com.deepgram.types.CreateProjectDistributionCredentialsV1Response; +import com.deepgram.types.GetProjectDistributionCredentialsV1Response; +import com.deepgram.types.ListProjectDistributionCredentialsV1Response; +import java.util.concurrent.CompletableFuture; + +public class AsyncDistributionCredentialsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawDistributionCredentialsClient rawClient; + + public AsyncDistributionCredentialsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawDistributionCredentialsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawDistributionCredentialsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists sets of distribution credentials for the specified project + */ + public CompletableFuture list(String projectId) { + return this.rawClient.list(projectId).thenApply(response -> response.body()); + } + + /** + * Lists sets of distribution credentials for the specified project + */ + public CompletableFuture list( + String projectId, RequestOptions requestOptions) { + return this.rawClient.list(projectId, requestOptions).thenApply(response -> response.body()); + } + + /** + * Creates a set of distribution credentials for the specified project + */ + public CompletableFuture create(String projectId) { + return this.rawClient.create(projectId).thenApply(response -> response.body()); + } + + /** + * Creates a set of distribution credentials for the specified project + */ + public CompletableFuture create( + String projectId, RequestOptions requestOptions) { + return this.rawClient.create(projectId, requestOptions).thenApply(response -> response.body()); + } + + /** + * Creates a set of distribution credentials for the specified project + */ + public CompletableFuture create( + String projectId, CreateProjectDistributionCredentialsV1Request request) { + return this.rawClient.create(projectId, request).thenApply(response -> response.body()); + } + + /** + * Creates a set of distribution credentials for the specified project + */ + public CompletableFuture create( + String projectId, CreateProjectDistributionCredentialsV1Request request, RequestOptions requestOptions) { + return this.rawClient.create(projectId, request, requestOptions).thenApply(response -> response.body()); + } + + /** + * Returns a set of distribution credentials for the specified project + */ + public CompletableFuture get( + String projectId, String distributionCredentialsId) { + return this.rawClient.get(projectId, distributionCredentialsId).thenApply(response -> response.body()); + } + + /** + * Returns a set of distribution credentials for the specified project + */ + public CompletableFuture get( + String projectId, String distributionCredentialsId, RequestOptions requestOptions) { + return this.rawClient + .get(projectId, distributionCredentialsId, requestOptions) + .thenApply(response -> response.body()); + } + + /** + * Deletes a set of distribution credentials for the specified project + */ + public CompletableFuture delete( + String projectId, String distributionCredentialsId) { + return this.rawClient.delete(projectId, distributionCredentialsId).thenApply(response -> response.body()); + } + + /** + * Deletes a set of distribution credentials for the specified project + */ + public CompletableFuture delete( + String projectId, String distributionCredentialsId, RequestOptions requestOptions) { + return this.rawClient + .delete(projectId, distributionCredentialsId, requestOptions) + .thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/deepgram/resources/selfhosted/v1/distributioncredentials/AsyncRawDistributionCredentialsClient.java b/src/main/java/com/deepgram/resources/selfhosted/v1/distributioncredentials/AsyncRawDistributionCredentialsClient.java new file mode 100644 index 0000000..73dc6f1 --- /dev/null +++ b/src/main/java/com/deepgram/resources/selfhosted/v1/distributioncredentials/AsyncRawDistributionCredentialsClient.java @@ -0,0 +1,372 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.selfhosted.v1.distributioncredentials; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.DeepgramApiApiException; +import com.deepgram.core.DeepgramApiException; +import com.deepgram.core.DeepgramApiHttpResponse; +import com.deepgram.core.MediaTypes; +import com.deepgram.core.ObjectMappers; +import com.deepgram.core.QueryStringMapper; +import com.deepgram.core.RequestOptions; +import com.deepgram.errors.BadRequestError; +import com.deepgram.resources.selfhosted.v1.distributioncredentials.requests.CreateProjectDistributionCredentialsV1Request; +import com.deepgram.types.CreateProjectDistributionCredentialsV1Response; +import com.deepgram.types.GetProjectDistributionCredentialsV1Response; +import com.deepgram.types.ListProjectDistributionCredentialsV1Response; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawDistributionCredentialsClient { + protected final ClientOptions clientOptions; + + public AsyncRawDistributionCredentialsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists sets of distribution credentials for the specified project + */ + public CompletableFuture> list( + String projectId) { + return list(projectId, null); + } + + /** + * Lists sets of distribution credentials for the specified project + */ + public CompletableFuture> list( + String projectId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("self-hosted/distribution") + .addPathSegments("credentials"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListProjectDistributionCredentialsV1Response.class), + response)); + return; + } + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Creates a set of distribution credentials for the specified project + */ + public CompletableFuture> create( + String projectId) { + return create( + projectId, + CreateProjectDistributionCredentialsV1Request.builder().build()); + } + + /** + * Creates a set of distribution credentials for the specified project + */ + public CompletableFuture> create( + String projectId, RequestOptions requestOptions) { + return create( + projectId, + CreateProjectDistributionCredentialsV1Request.builder().build(), + requestOptions); + } + + /** + * Creates a set of distribution credentials for the specified project + */ + public CompletableFuture> create( + String projectId, CreateProjectDistributionCredentialsV1Request request) { + return create(projectId, request, null); + } + + /** + * Creates a set of distribution credentials for the specified project + */ + public CompletableFuture> create( + String projectId, CreateProjectDistributionCredentialsV1Request request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("self-hosted/distribution") + .addPathSegments("credentials"); + if (request.getProvider().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "provider", request.getProvider().get(), false); + } + if (request.getScopes().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "scopes", request.getScopes().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, CreateProjectDistributionCredentialsV1Response.class), + response)); + return; + } + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Returns a set of distribution credentials for the specified project + */ + public CompletableFuture> get( + String projectId, String distributionCredentialsId) { + return get(projectId, distributionCredentialsId, null); + } + + /** + * Returns a set of distribution credentials for the specified project + */ + public CompletableFuture> get( + String projectId, String distributionCredentialsId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("self-hosted/distribution/credentials") + .addPathSegment(distributionCredentialsId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, GetProjectDistributionCredentialsV1Response.class), + response)); + return; + } + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + /** + * Deletes a set of distribution credentials for the specified project + */ + public CompletableFuture> delete( + String projectId, String distributionCredentialsId) { + return delete(projectId, distributionCredentialsId, null); + } + + /** + * Deletes a set of distribution credentials for the specified project + */ + public CompletableFuture> delete( + String projectId, String distributionCredentialsId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("self-hosted/distribution/credentials") + .addPathSegment(distributionCredentialsId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + future.complete(new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, GetProjectDistributionCredentialsV1Response.class), + response)); + return; + } + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/deepgram/resources/selfhosted/v1/distributioncredentials/DistributionCredentialsClient.java b/src/main/java/com/deepgram/resources/selfhosted/v1/distributioncredentials/DistributionCredentialsClient.java new file mode 100644 index 0000000..ecf7ab9 --- /dev/null +++ b/src/main/java/com/deepgram/resources/selfhosted/v1/distributioncredentials/DistributionCredentialsClient.java @@ -0,0 +1,107 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.selfhosted.v1.distributioncredentials; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.RequestOptions; +import com.deepgram.resources.selfhosted.v1.distributioncredentials.requests.CreateProjectDistributionCredentialsV1Request; +import com.deepgram.types.CreateProjectDistributionCredentialsV1Response; +import com.deepgram.types.GetProjectDistributionCredentialsV1Response; +import com.deepgram.types.ListProjectDistributionCredentialsV1Response; + +public class DistributionCredentialsClient { + protected final ClientOptions clientOptions; + + private final RawDistributionCredentialsClient rawClient; + + public DistributionCredentialsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawDistributionCredentialsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawDistributionCredentialsClient withRawResponse() { + return this.rawClient; + } + + /** + * Lists sets of distribution credentials for the specified project + */ + public ListProjectDistributionCredentialsV1Response list(String projectId) { + return this.rawClient.list(projectId).body(); + } + + /** + * Lists sets of distribution credentials for the specified project + */ + public ListProjectDistributionCredentialsV1Response list(String projectId, RequestOptions requestOptions) { + return this.rawClient.list(projectId, requestOptions).body(); + } + + /** + * Creates a set of distribution credentials for the specified project + */ + public CreateProjectDistributionCredentialsV1Response create(String projectId) { + return this.rawClient.create(projectId).body(); + } + + /** + * Creates a set of distribution credentials for the specified project + */ + public CreateProjectDistributionCredentialsV1Response create(String projectId, RequestOptions requestOptions) { + return this.rawClient.create(projectId, requestOptions).body(); + } + + /** + * Creates a set of distribution credentials for the specified project + */ + public CreateProjectDistributionCredentialsV1Response create( + String projectId, CreateProjectDistributionCredentialsV1Request request) { + return this.rawClient.create(projectId, request).body(); + } + + /** + * Creates a set of distribution credentials for the specified project + */ + public CreateProjectDistributionCredentialsV1Response create( + String projectId, CreateProjectDistributionCredentialsV1Request request, RequestOptions requestOptions) { + return this.rawClient.create(projectId, request, requestOptions).body(); + } + + /** + * Returns a set of distribution credentials for the specified project + */ + public GetProjectDistributionCredentialsV1Response get(String projectId, String distributionCredentialsId) { + return this.rawClient.get(projectId, distributionCredentialsId).body(); + } + + /** + * Returns a set of distribution credentials for the specified project + */ + public GetProjectDistributionCredentialsV1Response get( + String projectId, String distributionCredentialsId, RequestOptions requestOptions) { + return this.rawClient + .get(projectId, distributionCredentialsId, requestOptions) + .body(); + } + + /** + * Deletes a set of distribution credentials for the specified project + */ + public GetProjectDistributionCredentialsV1Response delete(String projectId, String distributionCredentialsId) { + return this.rawClient.delete(projectId, distributionCredentialsId).body(); + } + + /** + * Deletes a set of distribution credentials for the specified project + */ + public GetProjectDistributionCredentialsV1Response delete( + String projectId, String distributionCredentialsId, RequestOptions requestOptions) { + return this.rawClient + .delete(projectId, distributionCredentialsId, requestOptions) + .body(); + } +} diff --git a/src/main/java/com/deepgram/resources/selfhosted/v1/distributioncredentials/RawDistributionCredentialsClient.java b/src/main/java/com/deepgram/resources/selfhosted/v1/distributioncredentials/RawDistributionCredentialsClient.java new file mode 100644 index 0000000..ec616f0 --- /dev/null +++ b/src/main/java/com/deepgram/resources/selfhosted/v1/distributioncredentials/RawDistributionCredentialsClient.java @@ -0,0 +1,306 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.selfhosted.v1.distributioncredentials; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.DeepgramApiApiException; +import com.deepgram.core.DeepgramApiException; +import com.deepgram.core.DeepgramApiHttpResponse; +import com.deepgram.core.MediaTypes; +import com.deepgram.core.ObjectMappers; +import com.deepgram.core.QueryStringMapper; +import com.deepgram.core.RequestOptions; +import com.deepgram.errors.BadRequestError; +import com.deepgram.resources.selfhosted.v1.distributioncredentials.requests.CreateProjectDistributionCredentialsV1Request; +import com.deepgram.types.CreateProjectDistributionCredentialsV1Response; +import com.deepgram.types.GetProjectDistributionCredentialsV1Response; +import com.deepgram.types.ListProjectDistributionCredentialsV1Response; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawDistributionCredentialsClient { + protected final ClientOptions clientOptions; + + public RawDistributionCredentialsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Lists sets of distribution credentials for the specified project + */ + public DeepgramApiHttpResponse list(String projectId) { + return list(projectId, null); + } + + /** + * Lists sets of distribution credentials for the specified project + */ + public DeepgramApiHttpResponse list( + String projectId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("self-hosted/distribution") + .addPathSegments("credentials"); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, ListProjectDistributionCredentialsV1Response.class), + response); + } + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new DeepgramApiException("Network error executing HTTP request", e); + } + } + + /** + * Creates a set of distribution credentials for the specified project + */ + public DeepgramApiHttpResponse create(String projectId) { + return create( + projectId, + CreateProjectDistributionCredentialsV1Request.builder().build()); + } + + /** + * Creates a set of distribution credentials for the specified project + */ + public DeepgramApiHttpResponse create( + String projectId, RequestOptions requestOptions) { + return create( + projectId, + CreateProjectDistributionCredentialsV1Request.builder().build(), + requestOptions); + } + + /** + * Creates a set of distribution credentials for the specified project + */ + public DeepgramApiHttpResponse create( + String projectId, CreateProjectDistributionCredentialsV1Request request) { + return create(projectId, request, null); + } + + /** + * Creates a set of distribution credentials for the specified project + */ + public DeepgramApiHttpResponse create( + String projectId, CreateProjectDistributionCredentialsV1Request request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("self-hosted/distribution") + .addPathSegments("credentials"); + if (request.getProvider().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "provider", request.getProvider().get(), false); + } + if (request.getScopes().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "scopes", request.getScopes().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, CreateProjectDistributionCredentialsV1Response.class), + response); + } + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new DeepgramApiException("Network error executing HTTP request", e); + } + } + + /** + * Returns a set of distribution credentials for the specified project + */ + public DeepgramApiHttpResponse get( + String projectId, String distributionCredentialsId) { + return get(projectId, distributionCredentialsId, null); + } + + /** + * Returns a set of distribution credentials for the specified project + */ + public DeepgramApiHttpResponse get( + String projectId, String distributionCredentialsId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("self-hosted/distribution/credentials") + .addPathSegment(distributionCredentialsId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, GetProjectDistributionCredentialsV1Response.class), + response); + } + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new DeepgramApiException("Network error executing HTTP request", e); + } + } + + /** + * Deletes a set of distribution credentials for the specified project + */ + public DeepgramApiHttpResponse delete( + String projectId, String distributionCredentialsId) { + return delete(projectId, distributionCredentialsId, null); + } + + /** + * Deletes a set of distribution credentials for the specified project + */ + public DeepgramApiHttpResponse delete( + String projectId, String distributionCredentialsId, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/projects") + .addPathSegment(projectId) + .addPathSegments("self-hosted/distribution/credentials") + .addPathSegment(distributionCredentialsId); + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "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(); + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + if (response.isSuccessful()) { + return new DeepgramApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBodyString, GetProjectDistributionCredentialsV1Response.class), + response); + } + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new DeepgramApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/deepgram/resources/selfhosted/v1/distributioncredentials/requests/CreateProjectDistributionCredentialsV1Request.java b/src/main/java/com/deepgram/resources/selfhosted/v1/distributioncredentials/requests/CreateProjectDistributionCredentialsV1Request.java new file mode 100644 index 0000000..4651ab9 --- /dev/null +++ b/src/main/java/com/deepgram/resources/selfhosted/v1/distributioncredentials/requests/CreateProjectDistributionCredentialsV1Request.java @@ -0,0 +1,181 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.selfhosted.v1.distributioncredentials.requests; + +import com.deepgram.core.ObjectMappers; +import com.deepgram.resources.selfhosted.v1.distributioncredentials.types.DistributionCredentialsCreateRequestScopesItem; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.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 java.util.Collections; +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 = CreateProjectDistributionCredentialsV1Request.Builder.class) +public final class CreateProjectDistributionCredentialsV1Request { + private final Optional> scopes; + + private final Optional provider; + + private final Optional comment; + + private final Map additionalProperties; + + private CreateProjectDistributionCredentialsV1Request( + Optional> scopes, + Optional provider, + Optional comment, + Map additionalProperties) { + this.scopes = scopes; + this.provider = provider; + this.comment = comment; + this.additionalProperties = additionalProperties; + } + + /** + * @return List of permission scopes for the credentials + */ + @JsonIgnore + public Optional> getScopes() { + return scopes; + } + + /** + * @return The provider of the distribution service + */ + @JsonIgnore + public Optional getProvider() { + return provider; + } + + /** + * @return Optional comment about the credentials + */ + @JsonProperty("comment") + public Optional getComment() { + return comment; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateProjectDistributionCredentialsV1Request + && equalTo((CreateProjectDistributionCredentialsV1Request) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateProjectDistributionCredentialsV1Request other) { + return scopes.equals(other.scopes) && provider.equals(other.provider) && comment.equals(other.comment); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.scopes, this.provider, this.comment); + } + + @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> scopes = Optional.empty(); + + private Optional provider = Optional.empty(); + + private Optional comment = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateProjectDistributionCredentialsV1Request other) { + scopes(other.getScopes()); + provider(other.getProvider()); + comment(other.getComment()); + return this; + } + + /** + *

List of permission scopes for the credentials

+ */ + @JsonSetter(value = "scopes", nulls = Nulls.SKIP) + public Builder scopes(Optional> scopes) { + this.scopes = scopes; + return this; + } + + public Builder scopes(List scopes) { + this.scopes = Optional.ofNullable(scopes); + return this; + } + + public Builder scopes(DistributionCredentialsCreateRequestScopesItem scopes) { + this.scopes = Optional.of(Collections.singletonList(scopes)); + return this; + } + + /** + *

The provider of the distribution service

+ */ + @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; + } + + /** + *

Optional comment about the credentials

+ */ + @JsonSetter(value = "comment", nulls = Nulls.SKIP) + public Builder comment(Optional comment) { + this.comment = comment; + return this; + } + + public Builder comment(String comment) { + this.comment = Optional.ofNullable(comment); + return this; + } + + public CreateProjectDistributionCredentialsV1Request build() { + return new CreateProjectDistributionCredentialsV1Request(scopes, provider, comment, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/selfhosted/v1/distributioncredentials/types/DistributionCredentialsCreateRequestScopesItem.java b/src/main/java/com/deepgram/resources/selfhosted/v1/distributioncredentials/types/DistributionCredentialsCreateRequestScopesItem.java new file mode 100644 index 0000000..5568d6c --- /dev/null +++ b/src/main/java/com/deepgram/resources/selfhosted/v1/distributioncredentials/types/DistributionCredentialsCreateRequestScopesItem.java @@ -0,0 +1,159 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.selfhosted.v1.distributioncredentials.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class DistributionCredentialsCreateRequestScopesItem { + public static final DistributionCredentialsCreateRequestScopesItem SELF_HOSTED_PRODUCTS = + new DistributionCredentialsCreateRequestScopesItem(Value.SELF_HOSTED_PRODUCTS, "self-hosted:products"); + + public static final DistributionCredentialsCreateRequestScopesItem SELF_HOSTED_PRODUCT_DGTOOLS = + new DistributionCredentialsCreateRequestScopesItem( + Value.SELF_HOSTED_PRODUCT_DGTOOLS, "self-hosted:product:dgtools"); + + public static final DistributionCredentialsCreateRequestScopesItem SELF_HOSTED_PRODUCT_HOTPEPPER = + new DistributionCredentialsCreateRequestScopesItem( + Value.SELF_HOSTED_PRODUCT_HOTPEPPER, "self-hosted:product:hotpepper"); + + public static final DistributionCredentialsCreateRequestScopesItem SELF_HOSTED_PRODUCT_API = + new DistributionCredentialsCreateRequestScopesItem( + Value.SELF_HOSTED_PRODUCT_API, "self-hosted:product:api"); + + public static final DistributionCredentialsCreateRequestScopesItem SELF_HOSTED_PRODUCT_ENGINE = + new DistributionCredentialsCreateRequestScopesItem( + Value.SELF_HOSTED_PRODUCT_ENGINE, "self-hosted:product:engine"); + + public static final DistributionCredentialsCreateRequestScopesItem SELF_HOSTED_PRODUCT_LICENSE_PROXY = + new DistributionCredentialsCreateRequestScopesItem( + Value.SELF_HOSTED_PRODUCT_LICENSE_PROXY, "self-hosted:product:license-proxy"); + + public static final DistributionCredentialsCreateRequestScopesItem SELF_HOSTED_PRODUCT_BILLING = + new DistributionCredentialsCreateRequestScopesItem( + Value.SELF_HOSTED_PRODUCT_BILLING, "self-hosted:product:billing"); + + public static final DistributionCredentialsCreateRequestScopesItem SELF_HOSTED_PRODUCT_METRICS_SERVER = + new DistributionCredentialsCreateRequestScopesItem( + Value.SELF_HOSTED_PRODUCT_METRICS_SERVER, "self-hosted:product:metrics-server"); + + private final Value value; + + private final String string; + + DistributionCredentialsCreateRequestScopesItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof DistributionCredentialsCreateRequestScopesItem + && this.string.equals(((DistributionCredentialsCreateRequestScopesItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SELF_HOSTED_PRODUCTS: + return visitor.visitSelfHostedProducts(); + case SELF_HOSTED_PRODUCT_DGTOOLS: + return visitor.visitSelfHostedProductDgtools(); + case SELF_HOSTED_PRODUCT_HOTPEPPER: + return visitor.visitSelfHostedProductHotpepper(); + case SELF_HOSTED_PRODUCT_API: + return visitor.visitSelfHostedProductApi(); + case SELF_HOSTED_PRODUCT_ENGINE: + return visitor.visitSelfHostedProductEngine(); + case SELF_HOSTED_PRODUCT_LICENSE_PROXY: + return visitor.visitSelfHostedProductLicenseProxy(); + case SELF_HOSTED_PRODUCT_BILLING: + return visitor.visitSelfHostedProductBilling(); + case SELF_HOSTED_PRODUCT_METRICS_SERVER: + return visitor.visitSelfHostedProductMetricsServer(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static DistributionCredentialsCreateRequestScopesItem valueOf(String value) { + switch (value) { + case "self-hosted:products": + return SELF_HOSTED_PRODUCTS; + case "self-hosted:product:dgtools": + return SELF_HOSTED_PRODUCT_DGTOOLS; + case "self-hosted:product:hotpepper": + return SELF_HOSTED_PRODUCT_HOTPEPPER; + case "self-hosted:product:api": + return SELF_HOSTED_PRODUCT_API; + case "self-hosted:product:engine": + return SELF_HOSTED_PRODUCT_ENGINE; + case "self-hosted:product:license-proxy": + return SELF_HOSTED_PRODUCT_LICENSE_PROXY; + case "self-hosted:product:billing": + return SELF_HOSTED_PRODUCT_BILLING; + case "self-hosted:product:metrics-server": + return SELF_HOSTED_PRODUCT_METRICS_SERVER; + default: + return new DistributionCredentialsCreateRequestScopesItem(Value.UNKNOWN, value); + } + } + + public enum Value { + SELF_HOSTED_PRODUCTS, + + SELF_HOSTED_PRODUCT_API, + + SELF_HOSTED_PRODUCT_ENGINE, + + SELF_HOSTED_PRODUCT_LICENSE_PROXY, + + SELF_HOSTED_PRODUCT_DGTOOLS, + + SELF_HOSTED_PRODUCT_BILLING, + + SELF_HOSTED_PRODUCT_HOTPEPPER, + + SELF_HOSTED_PRODUCT_METRICS_SERVER, + + UNKNOWN + } + + public interface Visitor { + T visitSelfHostedProducts(); + + T visitSelfHostedProductApi(); + + T visitSelfHostedProductEngine(); + + T visitSelfHostedProductLicenseProxy(); + + T visitSelfHostedProductDgtools(); + + T visitSelfHostedProductBilling(); + + T visitSelfHostedProductHotpepper(); + + T visitSelfHostedProductMetricsServer(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/speak/AsyncSpeakClient.java b/src/main/java/com/deepgram/resources/speak/AsyncSpeakClient.java new file mode 100644 index 0000000..4a9da9e --- /dev/null +++ b/src/main/java/com/deepgram/resources/speak/AsyncSpeakClient.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.speak; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.Suppliers; +import com.deepgram.resources.speak.v1.AsyncV1Client; +import java.util.function.Supplier; + +public class AsyncSpeakClient { + protected final ClientOptions clientOptions; + + protected final Supplier v1Client; + + public AsyncSpeakClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.v1Client = Suppliers.memoize(() -> new AsyncV1Client(clientOptions)); + } + + public AsyncV1Client v1() { + return this.v1Client.get(); + } +} diff --git a/src/main/java/com/deepgram/resources/speak/SpeakClient.java b/src/main/java/com/deepgram/resources/speak/SpeakClient.java new file mode 100644 index 0000000..c341119 --- /dev/null +++ b/src/main/java/com/deepgram/resources/speak/SpeakClient.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.speak; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.Suppliers; +import com.deepgram.resources.speak.v1.V1Client; +import java.util.function.Supplier; + +public class SpeakClient { + protected final ClientOptions clientOptions; + + protected final Supplier v1Client; + + public SpeakClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.v1Client = Suppliers.memoize(() -> new V1Client(clientOptions)); + } + + public V1Client v1() { + return this.v1Client.get(); + } +} diff --git a/src/main/java/com/deepgram/resources/speak/v1/AsyncV1Client.java b/src/main/java/com/deepgram/resources/speak/v1/AsyncV1Client.java new file mode 100644 index 0000000..e8670d2 --- /dev/null +++ b/src/main/java/com/deepgram/resources/speak/v1/AsyncV1Client.java @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.speak.v1; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.Suppliers; +import com.deepgram.resources.speak.v1.audio.AsyncAudioClient; +import com.deepgram.resources.speak.v1.websocket.V1WebSocketClient; +import java.util.function.Supplier; + +public class AsyncV1Client { + protected final ClientOptions clientOptions; + + protected final Supplier audioClient; + + public AsyncV1Client(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.audioClient = Suppliers.memoize(() -> new AsyncAudioClient(clientOptions)); + } + + /** + * Creates a new WebSocket client for the v1 channel. + */ + public V1WebSocketClient v1WebSocket() { + return new V1WebSocketClient(clientOptions); + } + + public AsyncAudioClient audio() { + return this.audioClient.get(); + } +} diff --git a/src/main/java/com/deepgram/resources/speak/v1/V1Client.java b/src/main/java/com/deepgram/resources/speak/v1/V1Client.java new file mode 100644 index 0000000..2c0dbb5 --- /dev/null +++ b/src/main/java/com/deepgram/resources/speak/v1/V1Client.java @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.speak.v1; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.Suppliers; +import com.deepgram.resources.speak.v1.audio.AudioClient; +import com.deepgram.resources.speak.v1.websocket.V1WebSocketClient; +import java.util.function.Supplier; + +public class V1Client { + protected final ClientOptions clientOptions; + + protected final Supplier audioClient; + + public V1Client(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.audioClient = Suppliers.memoize(() -> new AudioClient(clientOptions)); + } + + /** + * Creates a new WebSocket client for the v1 channel. + */ + public V1WebSocketClient v1WebSocket() { + return new V1WebSocketClient(clientOptions); + } + + public AudioClient audio() { + return this.audioClient.get(); + } +} diff --git a/src/main/java/com/deepgram/resources/speak/v1/audio/AsyncAudioClient.java b/src/main/java/com/deepgram/resources/speak/v1/audio/AsyncAudioClient.java new file mode 100644 index 0000000..ac97446 --- /dev/null +++ b/src/main/java/com/deepgram/resources/speak/v1/audio/AsyncAudioClient.java @@ -0,0 +1,42 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.speak.v1.audio; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.RequestOptions; +import com.deepgram.resources.speak.v1.audio.requests.SpeakV1Request; +import java.io.InputStream; +import java.util.concurrent.CompletableFuture; + +public class AsyncAudioClient { + protected final ClientOptions clientOptions; + + private final AsyncRawAudioClient rawClient; + + public AsyncAudioClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawAudioClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawAudioClient withRawResponse() { + return this.rawClient; + } + + /** + * Convert text into natural-sounding speech using Deepgram's TTS REST API + */ + public CompletableFuture generate(SpeakV1Request request) { + return this.rawClient.generate(request).thenApply(response -> response.body()); + } + + /** + * Convert text into natural-sounding speech using Deepgram's TTS REST API + */ + public CompletableFuture generate(SpeakV1Request request, RequestOptions requestOptions) { + return this.rawClient.generate(request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/deepgram/resources/speak/v1/audio/AsyncRawAudioClient.java b/src/main/java/com/deepgram/resources/speak/v1/audio/AsyncRawAudioClient.java new file mode 100644 index 0000000..b7dc08d --- /dev/null +++ b/src/main/java/com/deepgram/resources/speak/v1/audio/AsyncRawAudioClient.java @@ -0,0 +1,148 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.speak.v1.audio; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.DeepgramApiApiException; +import com.deepgram.core.DeepgramApiException; +import com.deepgram.core.DeepgramApiHttpResponse; +import com.deepgram.core.MediaTypes; +import com.deepgram.core.ObjectMappers; +import com.deepgram.core.QueryStringMapper; +import com.deepgram.core.RequestOptions; +import com.deepgram.core.ResponseBodyInputStream; +import com.deepgram.errors.BadRequestError; +import com.deepgram.resources.speak.v1.audio.requests.SpeakV1Request; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.IOException; +import java.io.InputStream; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawAudioClient { + protected final ClientOptions clientOptions; + + public AsyncRawAudioClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Convert text into natural-sounding speech using Deepgram's TTS REST API + */ + public CompletableFuture> generate(SpeakV1Request request) { + return generate(request, null); + } + + /** + * Convert text into natural-sounding speech using Deepgram's TTS REST API + */ + public CompletableFuture> generate( + SpeakV1Request request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/speak"); + if (request.getCallback().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "callback", request.getCallback().get(), false); + } + if (request.getCallbackMethod().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "callback_method", request.getCallbackMethod().get(), false); + } + if (request.getMipOptOut().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "mip_opt_out", request.getMipOptOut().get(), false); + } + if (request.getBitRate().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "bit_rate", request.getBitRate().get(), false); + } + if (request.getContainer().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "container", request.getContainer().get(), false); + } + if (request.getEncoding().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "encoding", request.getEncoding().get(), false); + } + if (request.getModel().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "model", request.getModel().get(), false); + } + if (request.getSampleRate().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "sample_rate", request.getSampleRate().get(), false); + } + if (request.getTag().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "tag", request.getTag().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + future.complete(new DeepgramApiHttpResponse<>(new ResponseBodyInputStream(response), response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + if (response.code() == 400) { + future.completeExceptionally(new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); + return; + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + future.completeExceptionally(new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response)); + return; + } catch (IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new DeepgramApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/deepgram/resources/speak/v1/audio/AudioClient.java b/src/main/java/com/deepgram/resources/speak/v1/audio/AudioClient.java new file mode 100644 index 0000000..b43b497 --- /dev/null +++ b/src/main/java/com/deepgram/resources/speak/v1/audio/AudioClient.java @@ -0,0 +1,41 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.speak.v1.audio; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.RequestOptions; +import com.deepgram.resources.speak.v1.audio.requests.SpeakV1Request; +import java.io.InputStream; + +public class AudioClient { + protected final ClientOptions clientOptions; + + private final RawAudioClient rawClient; + + public AudioClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawAudioClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawAudioClient withRawResponse() { + return this.rawClient; + } + + /** + * Convert text into natural-sounding speech using Deepgram's TTS REST API + */ + public InputStream generate(SpeakV1Request request) { + return this.rawClient.generate(request).body(); + } + + /** + * Convert text into natural-sounding speech using Deepgram's TTS REST API + */ + public InputStream generate(SpeakV1Request request, RequestOptions requestOptions) { + return this.rawClient.generate(request, requestOptions).body(); + } +} diff --git a/src/main/java/com/deepgram/resources/speak/v1/audio/RawAudioClient.java b/src/main/java/com/deepgram/resources/speak/v1/audio/RawAudioClient.java new file mode 100644 index 0000000..77e551f --- /dev/null +++ b/src/main/java/com/deepgram/resources/speak/v1/audio/RawAudioClient.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.speak.v1.audio; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.DeepgramApiApiException; +import com.deepgram.core.DeepgramApiException; +import com.deepgram.core.DeepgramApiHttpResponse; +import com.deepgram.core.MediaTypes; +import com.deepgram.core.ObjectMappers; +import com.deepgram.core.QueryStringMapper; +import com.deepgram.core.RequestOptions; +import com.deepgram.core.ResponseBodyInputStream; +import com.deepgram.errors.BadRequestError; +import com.deepgram.resources.speak.v1.audio.requests.SpeakV1Request; +import com.fasterxml.jackson.core.JsonProcessingException; +import java.io.IOException; +import java.io.InputStream; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawAudioClient { + protected final ClientOptions clientOptions; + + public RawAudioClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + /** + * Convert text into natural-sounding speech using Deepgram's TTS REST API + */ + public DeepgramApiHttpResponse generate(SpeakV1Request request) { + return generate(request, null); + } + + /** + * Convert text into natural-sounding speech using Deepgram's TTS REST API + */ + public DeepgramApiHttpResponse generate(SpeakV1Request request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getBaseURL()) + .newBuilder() + .addPathSegments("v1/speak"); + if (request.getCallback().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "callback", request.getCallback().get(), false); + } + if (request.getCallbackMethod().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "callback_method", request.getCallbackMethod().get(), false); + } + if (request.getMipOptOut().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "mip_opt_out", request.getMipOptOut().get(), false); + } + if (request.getBitRate().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "bit_rate", request.getBitRate().get(), false); + } + if (request.getContainer().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "container", request.getContainer().get(), false); + } + if (request.getEncoding().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "encoding", request.getEncoding().get(), false); + } + if (request.getModel().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "model", request.getModel().get(), false); + } + if (request.getSampleRate().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "sample_rate", request.getSampleRate().get(), false); + } + if (request.getTag().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "tag", request.getTag().get(), true); + } + if (requestOptions != null) { + requestOptions.getQueryParameters().forEach((_key, _value) -> { + httpUrl.addQueryParameter(_key, _value); + }); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "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 new DeepgramApiHttpResponse<>(new ResponseBodyInputStream(response), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + if (response.code() == 400) { + throw new BadRequestError( + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); + throw new DeepgramApiApiException( + "Error with status code " + response.code(), response.code(), errorBody, response); + } catch (IOException e) { + throw new DeepgramApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/deepgram/resources/speak/v1/audio/requests/SpeakV1Request.java b/src/main/java/com/deepgram/resources/speak/v1/audio/requests/SpeakV1Request.java new file mode 100644 index 0000000..80866b2 --- /dev/null +++ b/src/main/java/com/deepgram/resources/speak/v1/audio/requests/SpeakV1Request.java @@ -0,0 +1,556 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.speak.v1.audio.requests; + +import com.deepgram.core.ObjectMappers; +import com.deepgram.resources.speak.v1.audio.types.AudioGenerateRequestCallbackMethod; +import com.deepgram.resources.speak.v1.audio.types.AudioGenerateRequestContainer; +import com.deepgram.resources.speak.v1.audio.types.AudioGenerateRequestEncoding; +import com.deepgram.resources.speak.v1.audio.types.AudioGenerateRequestModel; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.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 java.util.Collections; +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 = SpeakV1Request.Builder.class) +public final class SpeakV1Request { + private final Optional> tag; + + private final Optional callback; + + private final Optional callbackMethod; + + private final Optional mipOptOut; + + private final Optional bitRate; + + private final Optional container; + + private final Optional encoding; + + private final Optional model; + + private final Optional sampleRate; + + private final String text; + + private final Map additionalProperties; + + private SpeakV1Request( + Optional> tag, + Optional callback, + Optional callbackMethod, + Optional mipOptOut, + Optional bitRate, + Optional container, + Optional encoding, + Optional model, + Optional sampleRate, + String text, + Map additionalProperties) { + this.tag = tag; + this.callback = callback; + this.callbackMethod = callbackMethod; + this.mipOptOut = mipOptOut; + this.bitRate = bitRate; + this.container = container; + this.encoding = encoding; + this.model = model; + this.sampleRate = sampleRate; + this.text = text; + this.additionalProperties = additionalProperties; + } + + /** + * @return Label your requests for the purpose of identification during usage reporting + */ + @JsonIgnore + public Optional> getTag() { + return tag; + } + + /** + * @return URL to which we'll make the callback request + */ + @JsonIgnore + public Optional getCallback() { + return callback; + } + + /** + * @return HTTP method by which the callback request will be made + */ + @JsonIgnore + public Optional getCallbackMethod() { + return callbackMethod; + } + + /** + * @return Opts out requests from the Deepgram Model Improvement Program. Refer to our Docs for pricing impacts before setting this to true. https://dpgr.am/deepgram-mip + */ + @JsonIgnore + public Optional getMipOptOut() { + return mipOptOut; + } + + /** + * @return The bitrate of the audio in bits per second. Choose from predefined ranges or specific values based on the encoding type. + */ + @JsonIgnore + public Optional getBitRate() { + return bitRate; + } + + /** + * @return Container specifies the file format wrapper for the output audio. The available options depend on the encoding type. + */ + @JsonIgnore + public Optional getContainer() { + return container; + } + + /** + * @return Encoding allows you to specify the expected encoding of your audio output + */ + @JsonIgnore + public Optional getEncoding() { + return encoding; + } + + /** + * @return AI model used to process submitted text + */ + @JsonIgnore + public Optional getModel() { + return model; + } + + /** + * @return Sample Rate specifies the sample rate for the output audio. Based on the encoding, different sample rates are supported. For some encodings, the sample rate is not configurable + */ + @JsonIgnore + public Optional getSampleRate() { + return sampleRate; + } + + /** + * @return The text content to be converted to speech + */ + @JsonProperty("text") + public String getText() { + return text; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SpeakV1Request && equalTo((SpeakV1Request) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SpeakV1Request other) { + return tag.equals(other.tag) + && callback.equals(other.callback) + && callbackMethod.equals(other.callbackMethod) + && mipOptOut.equals(other.mipOptOut) + && bitRate.equals(other.bitRate) + && container.equals(other.container) + && encoding.equals(other.encoding) + && model.equals(other.model) + && sampleRate.equals(other.sampleRate) + && text.equals(other.text); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.tag, + this.callback, + this.callbackMethod, + this.mipOptOut, + this.bitRate, + this.container, + this.encoding, + this.model, + this.sampleRate, + this.text); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TextStage builder() { + return new Builder(); + } + + public interface TextStage { + /** + *

The text content to be converted to speech

+ */ + _FinalStage text(@NotNull String text); + + Builder from(SpeakV1Request other); + } + + public interface _FinalStage { + SpeakV1Request build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Label your requests for the purpose of identification during usage reporting

+ */ + _FinalStage tag(Optional> tag); + + _FinalStage tag(List tag); + + _FinalStage tag(String tag); + + /** + *

URL to which we'll make the callback request

+ */ + _FinalStage callback(Optional callback); + + _FinalStage callback(String callback); + + /** + *

HTTP method by which the callback request will be made

+ */ + _FinalStage callbackMethod(Optional callbackMethod); + + _FinalStage callbackMethod(AudioGenerateRequestCallbackMethod callbackMethod); + + /** + *

Opts out requests from the Deepgram Model Improvement Program. Refer to our Docs for pricing impacts before setting this to true. https://dpgr.am/deepgram-mip

+ */ + _FinalStage mipOptOut(Optional mipOptOut); + + _FinalStage mipOptOut(Boolean mipOptOut); + + /** + *

The bitrate of the audio in bits per second. Choose from predefined ranges or specific values based on the encoding type.

+ */ + _FinalStage bitRate(Optional bitRate); + + _FinalStage bitRate(Double bitRate); + + /** + *

Container specifies the file format wrapper for the output audio. The available options depend on the encoding type.

+ */ + _FinalStage container(Optional container); + + _FinalStage container(AudioGenerateRequestContainer container); + + /** + *

Encoding allows you to specify the expected encoding of your audio output

+ */ + _FinalStage encoding(Optional encoding); + + _FinalStage encoding(AudioGenerateRequestEncoding encoding); + + /** + *

AI model used to process submitted text

+ */ + _FinalStage model(Optional model); + + _FinalStage model(AudioGenerateRequestModel model); + + /** + *

Sample Rate specifies the sample rate for the output audio. Based on the encoding, different sample rates are supported. For some encodings, the sample rate is not configurable

+ */ + _FinalStage sampleRate(Optional sampleRate); + + _FinalStage sampleRate(Double sampleRate); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TextStage, _FinalStage { + private String text; + + private Optional sampleRate = Optional.empty(); + + private Optional model = Optional.empty(); + + private Optional encoding = Optional.empty(); + + private Optional container = Optional.empty(); + + private Optional bitRate = Optional.empty(); + + private Optional mipOptOut = Optional.empty(); + + private Optional callbackMethod = Optional.empty(); + + private Optional callback = Optional.empty(); + + private Optional> tag = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SpeakV1Request other) { + tag(other.getTag()); + callback(other.getCallback()); + callbackMethod(other.getCallbackMethod()); + mipOptOut(other.getMipOptOut()); + bitRate(other.getBitRate()); + container(other.getContainer()); + encoding(other.getEncoding()); + model(other.getModel()); + sampleRate(other.getSampleRate()); + text(other.getText()); + return this; + } + + /** + *

The text content to be converted to speech

+ *

The text content to be converted to speech

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

Sample Rate specifies the sample rate for the output audio. Based on the encoding, different sample rates are supported. For some encodings, the sample rate is not configurable

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sampleRate(Double sampleRate) { + this.sampleRate = Optional.ofNullable(sampleRate); + return this; + } + + /** + *

Sample Rate specifies the sample rate for the output audio. Based on the encoding, different sample rates are supported. For some encodings, the sample rate is not configurable

+ */ + @java.lang.Override + @JsonSetter(value = "sample_rate", nulls = Nulls.SKIP) + public _FinalStage sampleRate(Optional sampleRate) { + this.sampleRate = sampleRate; + return this; + } + + /** + *

AI model used to process submitted text

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage model(AudioGenerateRequestModel model) { + this.model = Optional.ofNullable(model); + return this; + } + + /** + *

AI model used to process submitted text

+ */ + @java.lang.Override + @JsonSetter(value = "model", nulls = Nulls.SKIP) + public _FinalStage model(Optional model) { + this.model = model; + return this; + } + + /** + *

Encoding allows you to specify the expected encoding of your audio output

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage encoding(AudioGenerateRequestEncoding encoding) { + this.encoding = Optional.ofNullable(encoding); + return this; + } + + /** + *

Encoding allows you to specify the expected encoding of your audio output

+ */ + @java.lang.Override + @JsonSetter(value = "encoding", nulls = Nulls.SKIP) + public _FinalStage encoding(Optional encoding) { + this.encoding = encoding; + return this; + } + + /** + *

Container specifies the file format wrapper for the output audio. The available options depend on the encoding type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage container(AudioGenerateRequestContainer container) { + this.container = Optional.ofNullable(container); + return this; + } + + /** + *

Container specifies the file format wrapper for the output audio. The available options depend on the encoding type.

+ */ + @java.lang.Override + @JsonSetter(value = "container", nulls = Nulls.SKIP) + public _FinalStage container(Optional container) { + this.container = container; + return this; + } + + /** + *

The bitrate of the audio in bits per second. Choose from predefined ranges or specific values based on the encoding type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage bitRate(Double bitRate) { + this.bitRate = Optional.ofNullable(bitRate); + return this; + } + + /** + *

The bitrate of the audio in bits per second. Choose from predefined ranges or specific values based on the encoding type.

+ */ + @java.lang.Override + @JsonSetter(value = "bit_rate", nulls = Nulls.SKIP) + public _FinalStage bitRate(Optional bitRate) { + this.bitRate = bitRate; + return this; + } + + /** + *

Opts out requests from the Deepgram Model Improvement Program. Refer to our Docs for pricing impacts before setting this to true. https://dpgr.am/deepgram-mip

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage mipOptOut(Boolean mipOptOut) { + this.mipOptOut = Optional.ofNullable(mipOptOut); + return this; + } + + /** + *

Opts out requests from the Deepgram Model Improvement Program. Refer to our Docs for pricing impacts before setting this to true. https://dpgr.am/deepgram-mip

+ */ + @java.lang.Override + @JsonSetter(value = "mip_opt_out", nulls = Nulls.SKIP) + public _FinalStage mipOptOut(Optional mipOptOut) { + this.mipOptOut = mipOptOut; + return this; + } + + /** + *

HTTP method by which the callback request will be made

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage callbackMethod(AudioGenerateRequestCallbackMethod callbackMethod) { + this.callbackMethod = Optional.ofNullable(callbackMethod); + return this; + } + + /** + *

HTTP method by which the callback request will be made

+ */ + @java.lang.Override + @JsonSetter(value = "callback_method", nulls = Nulls.SKIP) + public _FinalStage callbackMethod(Optional callbackMethod) { + this.callbackMethod = callbackMethod; + return this; + } + + /** + *

URL to which we'll make the callback request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage callback(String callback) { + this.callback = Optional.ofNullable(callback); + return this; + } + + /** + *

URL to which we'll make the callback request

+ */ + @java.lang.Override + @JsonSetter(value = "callback", nulls = Nulls.SKIP) + public _FinalStage callback(Optional callback) { + this.callback = callback; + return this; + } + + @java.lang.Override + public _FinalStage tag(String tag) { + this.tag = Optional.of(Collections.singletonList(tag)); + return this; + } + + /** + *

Label your requests for the purpose of identification during usage reporting

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

Label your requests for the purpose of identification during usage reporting

+ */ + @java.lang.Override + @JsonSetter(value = "tag", nulls = Nulls.SKIP) + public _FinalStage tag(Optional> tag) { + this.tag = tag; + return this; + } + + @java.lang.Override + public SpeakV1Request build() { + return new SpeakV1Request( + tag, + callback, + callbackMethod, + mipOptOut, + bitRate, + container, + encoding, + model, + sampleRate, + text, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/speak/v1/audio/types/AudioGenerateRequestCallbackMethod.java b/src/main/java/com/deepgram/resources/speak/v1/audio/types/AudioGenerateRequestCallbackMethod.java new file mode 100644 index 0000000..449fdfe --- /dev/null +++ b/src/main/java/com/deepgram/resources/speak/v1/audio/types/AudioGenerateRequestCallbackMethod.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.speak.v1.audio.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AudioGenerateRequestCallbackMethod { + public static final AudioGenerateRequestCallbackMethod PUT = + new AudioGenerateRequestCallbackMethod(Value.PUT, "PUT"); + + public static final AudioGenerateRequestCallbackMethod POST = + new AudioGenerateRequestCallbackMethod(Value.POST, "POST"); + + private final Value value; + + private final String string; + + AudioGenerateRequestCallbackMethod(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AudioGenerateRequestCallbackMethod + && this.string.equals(((AudioGenerateRequestCallbackMethod) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case PUT: + return visitor.visitPut(); + case POST: + return visitor.visitPost(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AudioGenerateRequestCallbackMethod valueOf(String value) { + switch (value) { + case "PUT": + return PUT; + case "POST": + return POST; + default: + return new AudioGenerateRequestCallbackMethod(Value.UNKNOWN, value); + } + } + + public enum Value { + POST, + + PUT, + + UNKNOWN + } + + public interface Visitor { + T visitPost(); + + T visitPut(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/speak/v1/audio/types/AudioGenerateRequestContainer.java b/src/main/java/com/deepgram/resources/speak/v1/audio/types/AudioGenerateRequestContainer.java new file mode 100644 index 0000000..04ac4f2 --- /dev/null +++ b/src/main/java/com/deepgram/resources/speak/v1/audio/types/AudioGenerateRequestContainer.java @@ -0,0 +1,94 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.speak.v1.audio.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AudioGenerateRequestContainer { + public static final AudioGenerateRequestContainer OGG = new AudioGenerateRequestContainer(Value.OGG, "ogg"); + + public static final AudioGenerateRequestContainer WAV = new AudioGenerateRequestContainer(Value.WAV, "wav"); + + public static final AudioGenerateRequestContainer NONE = new AudioGenerateRequestContainer(Value.NONE, "none"); + + private final Value value; + + private final String string; + + AudioGenerateRequestContainer(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AudioGenerateRequestContainer + && this.string.equals(((AudioGenerateRequestContainer) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case OGG: + return visitor.visitOgg(); + case WAV: + return visitor.visitWav(); + case NONE: + return visitor.visitNone(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AudioGenerateRequestContainer valueOf(String value) { + switch (value) { + case "ogg": + return OGG; + case "wav": + return WAV; + case "none": + return NONE; + default: + return new AudioGenerateRequestContainer(Value.UNKNOWN, value); + } + } + + public enum Value { + NONE, + + WAV, + + OGG, + + UNKNOWN + } + + public interface Visitor { + T visitNone(); + + T visitWav(); + + T visitOgg(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/speak/v1/audio/types/AudioGenerateRequestEncoding.java b/src/main/java/com/deepgram/resources/speak/v1/audio/types/AudioGenerateRequestEncoding.java new file mode 100644 index 0000000..f66e2f6 --- /dev/null +++ b/src/main/java/com/deepgram/resources/speak/v1/audio/types/AudioGenerateRequestEncoding.java @@ -0,0 +1,135 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.speak.v1.audio.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AudioGenerateRequestEncoding { + public static final AudioGenerateRequestEncoding MULAW = new AudioGenerateRequestEncoding(Value.MULAW, "mulaw"); + + public static final AudioGenerateRequestEncoding AAC = new AudioGenerateRequestEncoding(Value.AAC, "aac"); + + public static final AudioGenerateRequestEncoding FLAC = new AudioGenerateRequestEncoding(Value.FLAC, "flac"); + + public static final AudioGenerateRequestEncoding MP3 = new AudioGenerateRequestEncoding(Value.MP3, "mp3"); + + public static final AudioGenerateRequestEncoding LINEAR16 = + new AudioGenerateRequestEncoding(Value.LINEAR16, "linear16"); + + public static final AudioGenerateRequestEncoding OPUS = new AudioGenerateRequestEncoding(Value.OPUS, "opus"); + + public static final AudioGenerateRequestEncoding ALAW = new AudioGenerateRequestEncoding(Value.ALAW, "alaw"); + + private final Value value; + + private final String string; + + AudioGenerateRequestEncoding(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AudioGenerateRequestEncoding + && this.string.equals(((AudioGenerateRequestEncoding) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MULAW: + return visitor.visitMulaw(); + case AAC: + return visitor.visitAac(); + case FLAC: + return visitor.visitFlac(); + case MP3: + return visitor.visitMp3(); + case LINEAR16: + return visitor.visitLinear16(); + case OPUS: + return visitor.visitOpus(); + case ALAW: + return visitor.visitAlaw(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AudioGenerateRequestEncoding valueOf(String value) { + switch (value) { + case "mulaw": + return MULAW; + case "aac": + return AAC; + case "flac": + return FLAC; + case "mp3": + return MP3; + case "linear16": + return LINEAR16; + case "opus": + return OPUS; + case "alaw": + return ALAW; + default: + return new AudioGenerateRequestEncoding(Value.UNKNOWN, value); + } + } + + public enum Value { + LINEAR16, + + FLAC, + + MULAW, + + ALAW, + + MP3, + + OPUS, + + AAC, + + UNKNOWN + } + + public interface Visitor { + T visitLinear16(); + + T visitFlac(); + + T visitMulaw(); + + T visitAlaw(); + + T visitMp3(); + + T visitOpus(); + + T visitAac(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/speak/v1/audio/types/AudioGenerateRequestModel.java b/src/main/java/com/deepgram/resources/speak/v1/audio/types/AudioGenerateRequestModel.java new file mode 100644 index 0000000..df49c8d --- /dev/null +++ b/src/main/java/com/deepgram/resources/speak/v1/audio/types/AudioGenerateRequestModel.java @@ -0,0 +1,757 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.speak.v1.audio.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AudioGenerateRequestModel { + public static final AudioGenerateRequestModel AURA_ANGUS_EN = + new AudioGenerateRequestModel(Value.AURA_ANGUS_EN, "aura-angus-en"); + + public static final AudioGenerateRequestModel AURA2JUPITER_EN = + new AudioGenerateRequestModel(Value.AURA2JUPITER_EN, "aura-2-jupiter-en"); + + public static final AudioGenerateRequestModel AURA2CORA_EN = + new AudioGenerateRequestModel(Value.AURA2CORA_EN, "aura-2-cora-en"); + + public static final AudioGenerateRequestModel AURA_STELLA_EN = + new AudioGenerateRequestModel(Value.AURA_STELLA_EN, "aura-stella-en"); + + public static final AudioGenerateRequestModel AURA2HELENA_EN = + new AudioGenerateRequestModel(Value.AURA2HELENA_EN, "aura-2-helena-en"); + + public static final AudioGenerateRequestModel AURA2AQUILA_ES = + new AudioGenerateRequestModel(Value.AURA2AQUILA_ES, "aura-2-aquila-es"); + + public static final AudioGenerateRequestModel AURA2ATLAS_EN = + new AudioGenerateRequestModel(Value.AURA2ATLAS_EN, "aura-2-atlas-en"); + + public static final AudioGenerateRequestModel AURA2ORION_EN = + new AudioGenerateRequestModel(Value.AURA2ORION_EN, "aura-2-orion-en"); + + public static final AudioGenerateRequestModel AURA2DRACO_EN = + new AudioGenerateRequestModel(Value.AURA2DRACO_EN, "aura-2-draco-en"); + + public static final AudioGenerateRequestModel AURA2HYPERION_EN = + new AudioGenerateRequestModel(Value.AURA2HYPERION_EN, "aura-2-hyperion-en"); + + public static final AudioGenerateRequestModel AURA2JANUS_EN = + new AudioGenerateRequestModel(Value.AURA2JANUS_EN, "aura-2-janus-en"); + + public static final AudioGenerateRequestModel AURA_HELIOS_EN = + new AudioGenerateRequestModel(Value.AURA_HELIOS_EN, "aura-helios-en"); + + public static final AudioGenerateRequestModel AURA2PLUTO_EN = + new AudioGenerateRequestModel(Value.AURA2PLUTO_EN, "aura-2-pluto-en"); + + public static final AudioGenerateRequestModel AURA2ARCAS_EN = + new AudioGenerateRequestModel(Value.AURA2ARCAS_EN, "aura-2-arcas-en"); + + public static final AudioGenerateRequestModel AURA2NESTOR_ES = + new AudioGenerateRequestModel(Value.AURA2NESTOR_ES, "aura-2-nestor-es"); + + public static final AudioGenerateRequestModel AURA2NEPTUNE_EN = + new AudioGenerateRequestModel(Value.AURA2NEPTUNE_EN, "aura-2-neptune-en"); + + public static final AudioGenerateRequestModel AURA2MINERVA_EN = + new AudioGenerateRequestModel(Value.AURA2MINERVA_EN, "aura-2-minerva-en"); + + public static final AudioGenerateRequestModel AURA2ALVARO_ES = + new AudioGenerateRequestModel(Value.AURA2ALVARO_ES, "aura-2-alvaro-es"); + + public static final AudioGenerateRequestModel AURA_ATHENA_EN = + new AudioGenerateRequestModel(Value.AURA_ATHENA_EN, "aura-athena-en"); + + public static final AudioGenerateRequestModel AURA_PERSEUS_EN = + new AudioGenerateRequestModel(Value.AURA_PERSEUS_EN, "aura-perseus-en"); + + public static final AudioGenerateRequestModel AURA2ODYSSEUS_EN = + new AudioGenerateRequestModel(Value.AURA2ODYSSEUS_EN, "aura-2-odysseus-en"); + + public static final AudioGenerateRequestModel AURA2PANDORA_EN = + new AudioGenerateRequestModel(Value.AURA2PANDORA_EN, "aura-2-pandora-en"); + + public static final AudioGenerateRequestModel AURA2ZEUS_EN = + new AudioGenerateRequestModel(Value.AURA2ZEUS_EN, "aura-2-zeus-en"); + + public static final AudioGenerateRequestModel AURA2ELECTRA_EN = + new AudioGenerateRequestModel(Value.AURA2ELECTRA_EN, "aura-2-electra-en"); + + public static final AudioGenerateRequestModel AURA2ORPHEUS_EN = + new AudioGenerateRequestModel(Value.AURA2ORPHEUS_EN, "aura-2-orpheus-en"); + + public static final AudioGenerateRequestModel AURA2THALIA_EN = + new AudioGenerateRequestModel(Value.AURA2THALIA_EN, "aura-2-thalia-en"); + + public static final AudioGenerateRequestModel AURA2CELESTE_ES = + new AudioGenerateRequestModel(Value.AURA2CELESTE_ES, "aura-2-celeste-es"); + + public static final AudioGenerateRequestModel AURA_ASTERIA_EN = + new AudioGenerateRequestModel(Value.AURA_ASTERIA_EN, "aura-asteria-en"); + + public static final AudioGenerateRequestModel AURA2ESTRELLA_ES = + new AudioGenerateRequestModel(Value.AURA2ESTRELLA_ES, "aura-2-estrella-es"); + + public static final AudioGenerateRequestModel AURA2HERA_EN = + new AudioGenerateRequestModel(Value.AURA2HERA_EN, "aura-2-hera-en"); + + public static final AudioGenerateRequestModel AURA2MARS_EN = + new AudioGenerateRequestModel(Value.AURA2MARS_EN, "aura-2-mars-en"); + + public static final AudioGenerateRequestModel AURA2SIRIO_ES = + new AudioGenerateRequestModel(Value.AURA2SIRIO_ES, "aura-2-sirio-es"); + + public static final AudioGenerateRequestModel AURA2ASTERIA_EN = + new AudioGenerateRequestModel(Value.AURA2ASTERIA_EN, "aura-2-asteria-en"); + + public static final AudioGenerateRequestModel AURA2HERMES_EN = + new AudioGenerateRequestModel(Value.AURA2HERMES_EN, "aura-2-hermes-en"); + + public static final AudioGenerateRequestModel AURA2VESTA_EN = + new AudioGenerateRequestModel(Value.AURA2VESTA_EN, "aura-2-vesta-en"); + + public static final AudioGenerateRequestModel AURA2CARINA_ES = + new AudioGenerateRequestModel(Value.AURA2CARINA_ES, "aura-2-carina-es"); + + public static final AudioGenerateRequestModel AURA2CALLISTA_EN = + new AudioGenerateRequestModel(Value.AURA2CALLISTA_EN, "aura-2-callista-en"); + + public static final AudioGenerateRequestModel AURA2HARMONIA_EN = + new AudioGenerateRequestModel(Value.AURA2HARMONIA_EN, "aura-2-harmonia-en"); + + public static final AudioGenerateRequestModel AURA2SELENA_ES = + new AudioGenerateRequestModel(Value.AURA2SELENA_ES, "aura-2-selena-es"); + + public static final AudioGenerateRequestModel AURA2AURORA_EN = + new AudioGenerateRequestModel(Value.AURA2AURORA_EN, "aura-2-aurora-en"); + + public static final AudioGenerateRequestModel AURA_ZEUS_EN = + new AudioGenerateRequestModel(Value.AURA_ZEUS_EN, "aura-zeus-en"); + + public static final AudioGenerateRequestModel AURA2OPHELIA_EN = + new AudioGenerateRequestModel(Value.AURA2OPHELIA_EN, "aura-2-ophelia-en"); + + public static final AudioGenerateRequestModel AURA2AMALTHEA_EN = + new AudioGenerateRequestModel(Value.AURA2AMALTHEA_EN, "aura-2-amalthea-en"); + + public static final AudioGenerateRequestModel AURA_ORPHEUS_EN = + new AudioGenerateRequestModel(Value.AURA_ORPHEUS_EN, "aura-orpheus-en"); + + public static final AudioGenerateRequestModel AURA2DELIA_EN = + new AudioGenerateRequestModel(Value.AURA2DELIA_EN, "aura-2-delia-en"); + + public static final AudioGenerateRequestModel AURA_LUNA_EN = + new AudioGenerateRequestModel(Value.AURA_LUNA_EN, "aura-luna-en"); + + public static final AudioGenerateRequestModel AURA2APOLLO_EN = + new AudioGenerateRequestModel(Value.AURA2APOLLO_EN, "aura-2-apollo-en"); + + public static final AudioGenerateRequestModel AURA2SELENE_EN = + new AudioGenerateRequestModel(Value.AURA2SELENE_EN, "aura-2-selene-en"); + + public static final AudioGenerateRequestModel AURA2THEIA_EN = + new AudioGenerateRequestModel(Value.AURA2THEIA_EN, "aura-2-theia-en"); + + public static final AudioGenerateRequestModel AURA_HERA_EN = + new AudioGenerateRequestModel(Value.AURA_HERA_EN, "aura-hera-en"); + + public static final AudioGenerateRequestModel AURA2CORDELIA_EN = + new AudioGenerateRequestModel(Value.AURA2CORDELIA_EN, "aura-2-cordelia-en"); + + public static final AudioGenerateRequestModel AURA2ANDROMEDA_EN = + new AudioGenerateRequestModel(Value.AURA2ANDROMEDA_EN, "aura-2-andromeda-en"); + + public static final AudioGenerateRequestModel AURA2ARIES_EN = + new AudioGenerateRequestModel(Value.AURA2ARIES_EN, "aura-2-aries-en"); + + public static final AudioGenerateRequestModel AURA2JUNO_EN = + new AudioGenerateRequestModel(Value.AURA2JUNO_EN, "aura-2-juno-en"); + + public static final AudioGenerateRequestModel AURA2LUNA_EN = + new AudioGenerateRequestModel(Value.AURA2LUNA_EN, "aura-2-luna-en"); + + public static final AudioGenerateRequestModel AURA2DIANA_ES = + new AudioGenerateRequestModel(Value.AURA2DIANA_ES, "aura-2-diana-es"); + + public static final AudioGenerateRequestModel AURA2JAVIER_ES = + new AudioGenerateRequestModel(Value.AURA2JAVIER_ES, "aura-2-javier-es"); + + public static final AudioGenerateRequestModel AURA_ORION_EN = + new AudioGenerateRequestModel(Value.AURA_ORION_EN, "aura-orion-en"); + + public static final AudioGenerateRequestModel AURA_ARCAS_EN = + new AudioGenerateRequestModel(Value.AURA_ARCAS_EN, "aura-arcas-en"); + + public static final AudioGenerateRequestModel AURA2IRIS_EN = + new AudioGenerateRequestModel(Value.AURA2IRIS_EN, "aura-2-iris-en"); + + public static final AudioGenerateRequestModel AURA2ATHENA_EN = + new AudioGenerateRequestModel(Value.AURA2ATHENA_EN, "aura-2-athena-en"); + + public static final AudioGenerateRequestModel AURA2SATURN_EN = + new AudioGenerateRequestModel(Value.AURA2SATURN_EN, "aura-2-saturn-en"); + + public static final AudioGenerateRequestModel AURA2PHOEBE_EN = + new AudioGenerateRequestModel(Value.AURA2PHOEBE_EN, "aura-2-phoebe-en"); + + private final Value value; + + private final String string; + + AudioGenerateRequestModel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AudioGenerateRequestModel + && this.string.equals(((AudioGenerateRequestModel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case AURA_ANGUS_EN: + return visitor.visitAuraAngusEn(); + case AURA2JUPITER_EN: + return visitor.visitAura2JupiterEn(); + case AURA2CORA_EN: + return visitor.visitAura2CoraEn(); + case AURA_STELLA_EN: + return visitor.visitAuraStellaEn(); + case AURA2HELENA_EN: + return visitor.visitAura2HelenaEn(); + case AURA2AQUILA_ES: + return visitor.visitAura2AquilaEs(); + case AURA2ATLAS_EN: + return visitor.visitAura2AtlasEn(); + case AURA2ORION_EN: + return visitor.visitAura2OrionEn(); + case AURA2DRACO_EN: + return visitor.visitAura2DracoEn(); + case AURA2HYPERION_EN: + return visitor.visitAura2HyperionEn(); + case AURA2JANUS_EN: + return visitor.visitAura2JanusEn(); + case AURA_HELIOS_EN: + return visitor.visitAuraHeliosEn(); + case AURA2PLUTO_EN: + return visitor.visitAura2PlutoEn(); + case AURA2ARCAS_EN: + return visitor.visitAura2ArcasEn(); + case AURA2NESTOR_ES: + return visitor.visitAura2NestorEs(); + case AURA2NEPTUNE_EN: + return visitor.visitAura2NeptuneEn(); + case AURA2MINERVA_EN: + return visitor.visitAura2MinervaEn(); + case AURA2ALVARO_ES: + return visitor.visitAura2AlvaroEs(); + case AURA_ATHENA_EN: + return visitor.visitAuraAthenaEn(); + case AURA_PERSEUS_EN: + return visitor.visitAuraPerseusEn(); + case AURA2ODYSSEUS_EN: + return visitor.visitAura2OdysseusEn(); + case AURA2PANDORA_EN: + return visitor.visitAura2PandoraEn(); + case AURA2ZEUS_EN: + return visitor.visitAura2ZeusEn(); + case AURA2ELECTRA_EN: + return visitor.visitAura2ElectraEn(); + case AURA2ORPHEUS_EN: + return visitor.visitAura2OrpheusEn(); + case AURA2THALIA_EN: + return visitor.visitAura2ThaliaEn(); + case AURA2CELESTE_ES: + return visitor.visitAura2CelesteEs(); + case AURA_ASTERIA_EN: + return visitor.visitAuraAsteriaEn(); + case AURA2ESTRELLA_ES: + return visitor.visitAura2EstrellaEs(); + case AURA2HERA_EN: + return visitor.visitAura2HeraEn(); + case AURA2MARS_EN: + return visitor.visitAura2MarsEn(); + case AURA2SIRIO_ES: + return visitor.visitAura2SirioEs(); + case AURA2ASTERIA_EN: + return visitor.visitAura2AsteriaEn(); + case AURA2HERMES_EN: + return visitor.visitAura2HermesEn(); + case AURA2VESTA_EN: + return visitor.visitAura2VestaEn(); + case AURA2CARINA_ES: + return visitor.visitAura2CarinaEs(); + case AURA2CALLISTA_EN: + return visitor.visitAura2CallistaEn(); + case AURA2HARMONIA_EN: + return visitor.visitAura2HarmoniaEn(); + case AURA2SELENA_ES: + return visitor.visitAura2SelenaEs(); + case AURA2AURORA_EN: + return visitor.visitAura2AuroraEn(); + case AURA_ZEUS_EN: + return visitor.visitAuraZeusEn(); + case AURA2OPHELIA_EN: + return visitor.visitAura2OpheliaEn(); + case AURA2AMALTHEA_EN: + return visitor.visitAura2AmaltheaEn(); + case AURA_ORPHEUS_EN: + return visitor.visitAuraOrpheusEn(); + case AURA2DELIA_EN: + return visitor.visitAura2DeliaEn(); + case AURA_LUNA_EN: + return visitor.visitAuraLunaEn(); + case AURA2APOLLO_EN: + return visitor.visitAura2ApolloEn(); + case AURA2SELENE_EN: + return visitor.visitAura2SeleneEn(); + case AURA2THEIA_EN: + return visitor.visitAura2TheiaEn(); + case AURA_HERA_EN: + return visitor.visitAuraHeraEn(); + case AURA2CORDELIA_EN: + return visitor.visitAura2CordeliaEn(); + case AURA2ANDROMEDA_EN: + return visitor.visitAura2AndromedaEn(); + case AURA2ARIES_EN: + return visitor.visitAura2AriesEn(); + case AURA2JUNO_EN: + return visitor.visitAura2JunoEn(); + case AURA2LUNA_EN: + return visitor.visitAura2LunaEn(); + case AURA2DIANA_ES: + return visitor.visitAura2DianaEs(); + case AURA2JAVIER_ES: + return visitor.visitAura2JavierEs(); + case AURA_ORION_EN: + return visitor.visitAuraOrionEn(); + case AURA_ARCAS_EN: + return visitor.visitAuraArcasEn(); + case AURA2IRIS_EN: + return visitor.visitAura2IrisEn(); + case AURA2ATHENA_EN: + return visitor.visitAura2AthenaEn(); + case AURA2SATURN_EN: + return visitor.visitAura2SaturnEn(); + case AURA2PHOEBE_EN: + return visitor.visitAura2PhoebeEn(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AudioGenerateRequestModel valueOf(String value) { + switch (value) { + case "aura-angus-en": + return AURA_ANGUS_EN; + case "aura-2-jupiter-en": + return AURA2JUPITER_EN; + case "aura-2-cora-en": + return AURA2CORA_EN; + case "aura-stella-en": + return AURA_STELLA_EN; + case "aura-2-helena-en": + return AURA2HELENA_EN; + case "aura-2-aquila-es": + return AURA2AQUILA_ES; + case "aura-2-atlas-en": + return AURA2ATLAS_EN; + case "aura-2-orion-en": + return AURA2ORION_EN; + case "aura-2-draco-en": + return AURA2DRACO_EN; + case "aura-2-hyperion-en": + return AURA2HYPERION_EN; + case "aura-2-janus-en": + return AURA2JANUS_EN; + case "aura-helios-en": + return AURA_HELIOS_EN; + case "aura-2-pluto-en": + return AURA2PLUTO_EN; + case "aura-2-arcas-en": + return AURA2ARCAS_EN; + case "aura-2-nestor-es": + return AURA2NESTOR_ES; + case "aura-2-neptune-en": + return AURA2NEPTUNE_EN; + case "aura-2-minerva-en": + return AURA2MINERVA_EN; + case "aura-2-alvaro-es": + return AURA2ALVARO_ES; + case "aura-athena-en": + return AURA_ATHENA_EN; + case "aura-perseus-en": + return AURA_PERSEUS_EN; + case "aura-2-odysseus-en": + return AURA2ODYSSEUS_EN; + case "aura-2-pandora-en": + return AURA2PANDORA_EN; + case "aura-2-zeus-en": + return AURA2ZEUS_EN; + case "aura-2-electra-en": + return AURA2ELECTRA_EN; + case "aura-2-orpheus-en": + return AURA2ORPHEUS_EN; + case "aura-2-thalia-en": + return AURA2THALIA_EN; + case "aura-2-celeste-es": + return AURA2CELESTE_ES; + case "aura-asteria-en": + return AURA_ASTERIA_EN; + case "aura-2-estrella-es": + return AURA2ESTRELLA_ES; + case "aura-2-hera-en": + return AURA2HERA_EN; + case "aura-2-mars-en": + return AURA2MARS_EN; + case "aura-2-sirio-es": + return AURA2SIRIO_ES; + case "aura-2-asteria-en": + return AURA2ASTERIA_EN; + case "aura-2-hermes-en": + return AURA2HERMES_EN; + case "aura-2-vesta-en": + return AURA2VESTA_EN; + case "aura-2-carina-es": + return AURA2CARINA_ES; + case "aura-2-callista-en": + return AURA2CALLISTA_EN; + case "aura-2-harmonia-en": + return AURA2HARMONIA_EN; + case "aura-2-selena-es": + return AURA2SELENA_ES; + case "aura-2-aurora-en": + return AURA2AURORA_EN; + case "aura-zeus-en": + return AURA_ZEUS_EN; + case "aura-2-ophelia-en": + return AURA2OPHELIA_EN; + case "aura-2-amalthea-en": + return AURA2AMALTHEA_EN; + case "aura-orpheus-en": + return AURA_ORPHEUS_EN; + case "aura-2-delia-en": + return AURA2DELIA_EN; + case "aura-luna-en": + return AURA_LUNA_EN; + case "aura-2-apollo-en": + return AURA2APOLLO_EN; + case "aura-2-selene-en": + return AURA2SELENE_EN; + case "aura-2-theia-en": + return AURA2THEIA_EN; + case "aura-hera-en": + return AURA_HERA_EN; + case "aura-2-cordelia-en": + return AURA2CORDELIA_EN; + case "aura-2-andromeda-en": + return AURA2ANDROMEDA_EN; + case "aura-2-aries-en": + return AURA2ARIES_EN; + case "aura-2-juno-en": + return AURA2JUNO_EN; + case "aura-2-luna-en": + return AURA2LUNA_EN; + case "aura-2-diana-es": + return AURA2DIANA_ES; + case "aura-2-javier-es": + return AURA2JAVIER_ES; + case "aura-orion-en": + return AURA_ORION_EN; + case "aura-arcas-en": + return AURA_ARCAS_EN; + case "aura-2-iris-en": + return AURA2IRIS_EN; + case "aura-2-athena-en": + return AURA2ATHENA_EN; + case "aura-2-saturn-en": + return AURA2SATURN_EN; + case "aura-2-phoebe-en": + return AURA2PHOEBE_EN; + default: + return new AudioGenerateRequestModel(Value.UNKNOWN, value); + } + } + + public enum Value { + AURA_ASTERIA_EN, + + AURA_LUNA_EN, + + AURA_STELLA_EN, + + AURA_ATHENA_EN, + + AURA_HERA_EN, + + AURA_ORION_EN, + + AURA_ARCAS_EN, + + AURA_PERSEUS_EN, + + AURA_ANGUS_EN, + + AURA_ORPHEUS_EN, + + AURA_HELIOS_EN, + + AURA_ZEUS_EN, + + AURA2AMALTHEA_EN, + + AURA2ANDROMEDA_EN, + + AURA2APOLLO_EN, + + AURA2ARCAS_EN, + + AURA2ARIES_EN, + + AURA2ASTERIA_EN, + + AURA2ATHENA_EN, + + AURA2ATLAS_EN, + + AURA2AURORA_EN, + + AURA2CALLISTA_EN, + + AURA2CORDELIA_EN, + + AURA2CORA_EN, + + AURA2DELIA_EN, + + AURA2DRACO_EN, + + AURA2ELECTRA_EN, + + AURA2HARMONIA_EN, + + AURA2HELENA_EN, + + AURA2HERA_EN, + + AURA2HERMES_EN, + + AURA2HYPERION_EN, + + AURA2IRIS_EN, + + AURA2JANUS_EN, + + AURA2JUNO_EN, + + AURA2JUPITER_EN, + + AURA2LUNA_EN, + + AURA2MARS_EN, + + AURA2MINERVA_EN, + + AURA2NEPTUNE_EN, + + AURA2ODYSSEUS_EN, + + AURA2OPHELIA_EN, + + AURA2ORION_EN, + + AURA2ORPHEUS_EN, + + AURA2PANDORA_EN, + + AURA2PHOEBE_EN, + + AURA2PLUTO_EN, + + AURA2SATURN_EN, + + AURA2SELENE_EN, + + AURA2THALIA_EN, + + AURA2THEIA_EN, + + AURA2VESTA_EN, + + AURA2ZEUS_EN, + + AURA2SIRIO_ES, + + AURA2NESTOR_ES, + + AURA2CARINA_ES, + + AURA2CELESTE_ES, + + AURA2ALVARO_ES, + + AURA2DIANA_ES, + + AURA2AQUILA_ES, + + AURA2SELENA_ES, + + AURA2ESTRELLA_ES, + + AURA2JAVIER_ES, + + UNKNOWN + } + + public interface Visitor { + T visitAuraAsteriaEn(); + + T visitAuraLunaEn(); + + T visitAuraStellaEn(); + + T visitAuraAthenaEn(); + + T visitAuraHeraEn(); + + T visitAuraOrionEn(); + + T visitAuraArcasEn(); + + T visitAuraPerseusEn(); + + T visitAuraAngusEn(); + + T visitAuraOrpheusEn(); + + T visitAuraHeliosEn(); + + T visitAuraZeusEn(); + + T visitAura2AmaltheaEn(); + + T visitAura2AndromedaEn(); + + T visitAura2ApolloEn(); + + T visitAura2ArcasEn(); + + T visitAura2AriesEn(); + + T visitAura2AsteriaEn(); + + T visitAura2AthenaEn(); + + T visitAura2AtlasEn(); + + T visitAura2AuroraEn(); + + T visitAura2CallistaEn(); + + T visitAura2CordeliaEn(); + + T visitAura2CoraEn(); + + T visitAura2DeliaEn(); + + T visitAura2DracoEn(); + + T visitAura2ElectraEn(); + + T visitAura2HarmoniaEn(); + + T visitAura2HelenaEn(); + + T visitAura2HeraEn(); + + T visitAura2HermesEn(); + + T visitAura2HyperionEn(); + + T visitAura2IrisEn(); + + T visitAura2JanusEn(); + + T visitAura2JunoEn(); + + T visitAura2JupiterEn(); + + T visitAura2LunaEn(); + + T visitAura2MarsEn(); + + T visitAura2MinervaEn(); + + T visitAura2NeptuneEn(); + + T visitAura2OdysseusEn(); + + T visitAura2OpheliaEn(); + + T visitAura2OrionEn(); + + T visitAura2OrpheusEn(); + + T visitAura2PandoraEn(); + + T visitAura2PhoebeEn(); + + T visitAura2PlutoEn(); + + T visitAura2SaturnEn(); + + T visitAura2SeleneEn(); + + T visitAura2ThaliaEn(); + + T visitAura2TheiaEn(); + + T visitAura2VestaEn(); + + T visitAura2ZeusEn(); + + T visitAura2SirioEs(); + + T visitAura2NestorEs(); + + T visitAura2CarinaEs(); + + T visitAura2CelesteEs(); + + T visitAura2AlvaroEs(); + + T visitAura2DianaEs(); + + T visitAura2AquilaEs(); + + T visitAura2SelenaEs(); + + T visitAura2EstrellaEs(); + + T visitAura2JavierEs(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/speak/v1/types/SpeakV1Clear.java b/src/main/java/com/deepgram/resources/speak/v1/types/SpeakV1Clear.java new file mode 100644 index 0000000..1c170c3 --- /dev/null +++ b/src/main/java/com/deepgram/resources/speak/v1/types/SpeakV1Clear.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.speak.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SpeakV1Clear.Builder.class) +public final class SpeakV1Clear { + private final SpeakV1ClearType type; + + private final Map additionalProperties; + + private SpeakV1Clear(SpeakV1ClearType type, Map additionalProperties) { + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return Message type identifier + */ + @JsonProperty("type") + public SpeakV1ClearType getType() { + return type; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SpeakV1Clear && equalTo((SpeakV1Clear) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SpeakV1Clear other) { + return type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TypeStage builder() { + return new Builder(); + } + + public interface TypeStage { + /** + *

Message type identifier

+ */ + _FinalStage type(@NotNull SpeakV1ClearType type); + + Builder from(SpeakV1Clear other); + } + + public interface _FinalStage { + SpeakV1Clear build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TypeStage, _FinalStage { + private SpeakV1ClearType type; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SpeakV1Clear other) { + type(other.getType()); + return this; + } + + /** + *

Message type identifier

+ *

Message type identifier

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull SpeakV1ClearType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + @java.lang.Override + public SpeakV1Clear build() { + return new SpeakV1Clear(type, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/speak/v1/types/SpeakV1ClearType.java b/src/main/java/com/deepgram/resources/speak/v1/types/SpeakV1ClearType.java new file mode 100644 index 0000000..34f07c8 --- /dev/null +++ b/src/main/java/com/deepgram/resources/speak/v1/types/SpeakV1ClearType.java @@ -0,0 +1,93 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.speak.v1.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class SpeakV1ClearType { + public static final SpeakV1ClearType CLOSE = new SpeakV1ClearType(Value.CLOSE, "Close"); + + public static final SpeakV1ClearType FLUSH = new SpeakV1ClearType(Value.FLUSH, "Flush"); + + public static final SpeakV1ClearType CLEAR = new SpeakV1ClearType(Value.CLEAR, "Clear"); + + private final Value value; + + private final String string; + + SpeakV1ClearType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof SpeakV1ClearType && this.string.equals(((SpeakV1ClearType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CLOSE: + return visitor.visitClose(); + case FLUSH: + return visitor.visitFlush(); + case CLEAR: + return visitor.visitClear(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static SpeakV1ClearType valueOf(String value) { + switch (value) { + case "Close": + return CLOSE; + case "Flush": + return FLUSH; + case "Clear": + return CLEAR; + default: + return new SpeakV1ClearType(Value.UNKNOWN, value); + } + } + + public enum Value { + FLUSH, + + CLEAR, + + CLOSE, + + UNKNOWN + } + + public interface Visitor { + T visitFlush(); + + T visitClear(); + + T visitClose(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/speak/v1/types/SpeakV1Cleared.java b/src/main/java/com/deepgram/resources/speak/v1/types/SpeakV1Cleared.java new file mode 100644 index 0000000..b381236 --- /dev/null +++ b/src/main/java/com/deepgram/resources/speak/v1/types/SpeakV1Cleared.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.speak.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SpeakV1Cleared.Builder.class) +public final class SpeakV1Cleared { + private final SpeakV1ClearedType type; + + private final double sequenceId; + + private final Map additionalProperties; + + private SpeakV1Cleared(SpeakV1ClearedType type, double sequenceId, Map additionalProperties) { + this.type = type; + this.sequenceId = sequenceId; + this.additionalProperties = additionalProperties; + } + + /** + * @return Message type identifier + */ + @JsonProperty("type") + public SpeakV1ClearedType getType() { + return type; + } + + /** + * @return The sequence ID of the response + */ + @JsonProperty("sequence_id") + public double getSequenceId() { + return sequenceId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SpeakV1Cleared && equalTo((SpeakV1Cleared) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SpeakV1Cleared other) { + return type.equals(other.type) && sequenceId == other.sequenceId; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.sequenceId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TypeStage builder() { + return new Builder(); + } + + public interface TypeStage { + /** + *

Message type identifier

+ */ + SequenceIdStage type(@NotNull SpeakV1ClearedType type); + + Builder from(SpeakV1Cleared other); + } + + public interface SequenceIdStage { + /** + *

The sequence ID of the response

+ */ + _FinalStage sequenceId(double sequenceId); + } + + public interface _FinalStage { + SpeakV1Cleared build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TypeStage, SequenceIdStage, _FinalStage { + private SpeakV1ClearedType type; + + private double sequenceId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SpeakV1Cleared other) { + type(other.getType()); + sequenceId(other.getSequenceId()); + return this; + } + + /** + *

Message type identifier

+ *

Message type identifier

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

The sequence ID of the response

+ *

The sequence ID of the response

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("sequence_id") + public _FinalStage sequenceId(double sequenceId) { + this.sequenceId = sequenceId; + return this; + } + + @java.lang.Override + public SpeakV1Cleared build() { + return new SpeakV1Cleared(type, sequenceId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/speak/v1/types/SpeakV1ClearedType.java b/src/main/java/com/deepgram/resources/speak/v1/types/SpeakV1ClearedType.java new file mode 100644 index 0000000..4576b13 --- /dev/null +++ b/src/main/java/com/deepgram/resources/speak/v1/types/SpeakV1ClearedType.java @@ -0,0 +1,83 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.speak.v1.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class SpeakV1ClearedType { + public static final SpeakV1ClearedType CLEARED = new SpeakV1ClearedType(Value.CLEARED, "Cleared"); + + public static final SpeakV1ClearedType FLUSHED = new SpeakV1ClearedType(Value.FLUSHED, "Flushed"); + + private final Value value; + + private final String string; + + SpeakV1ClearedType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof SpeakV1ClearedType && this.string.equals(((SpeakV1ClearedType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CLEARED: + return visitor.visitCleared(); + case FLUSHED: + return visitor.visitFlushed(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static SpeakV1ClearedType valueOf(String value) { + switch (value) { + case "Cleared": + return CLEARED; + case "Flushed": + return FLUSHED; + default: + return new SpeakV1ClearedType(Value.UNKNOWN, value); + } + } + + public enum Value { + FLUSHED, + + CLEARED, + + UNKNOWN + } + + public interface Visitor { + T visitFlushed(); + + T visitCleared(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/speak/v1/types/SpeakV1Close.java b/src/main/java/com/deepgram/resources/speak/v1/types/SpeakV1Close.java new file mode 100644 index 0000000..81cc593 --- /dev/null +++ b/src/main/java/com/deepgram/resources/speak/v1/types/SpeakV1Close.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.speak.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SpeakV1Close.Builder.class) +public final class SpeakV1Close { + private final SpeakV1CloseType type; + + private final Map additionalProperties; + + private SpeakV1Close(SpeakV1CloseType type, Map additionalProperties) { + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return Message type identifier + */ + @JsonProperty("type") + public SpeakV1CloseType getType() { + return type; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SpeakV1Close && equalTo((SpeakV1Close) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SpeakV1Close other) { + return type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TypeStage builder() { + return new Builder(); + } + + public interface TypeStage { + /** + *

Message type identifier

+ */ + _FinalStage type(@NotNull SpeakV1CloseType type); + + Builder from(SpeakV1Close other); + } + + public interface _FinalStage { + SpeakV1Close build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TypeStage, _FinalStage { + private SpeakV1CloseType type; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SpeakV1Close other) { + type(other.getType()); + return this; + } + + /** + *

Message type identifier

+ *

Message type identifier

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull SpeakV1CloseType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + @java.lang.Override + public SpeakV1Close build() { + return new SpeakV1Close(type, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/speak/v1/types/SpeakV1CloseType.java b/src/main/java/com/deepgram/resources/speak/v1/types/SpeakV1CloseType.java new file mode 100644 index 0000000..826f057 --- /dev/null +++ b/src/main/java/com/deepgram/resources/speak/v1/types/SpeakV1CloseType.java @@ -0,0 +1,93 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.speak.v1.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class SpeakV1CloseType { + public static final SpeakV1CloseType CLOSE = new SpeakV1CloseType(Value.CLOSE, "Close"); + + public static final SpeakV1CloseType FLUSH = new SpeakV1CloseType(Value.FLUSH, "Flush"); + + public static final SpeakV1CloseType CLEAR = new SpeakV1CloseType(Value.CLEAR, "Clear"); + + private final Value value; + + private final String string; + + SpeakV1CloseType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof SpeakV1CloseType && this.string.equals(((SpeakV1CloseType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CLOSE: + return visitor.visitClose(); + case FLUSH: + return visitor.visitFlush(); + case CLEAR: + return visitor.visitClear(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static SpeakV1CloseType valueOf(String value) { + switch (value) { + case "Close": + return CLOSE; + case "Flush": + return FLUSH; + case "Clear": + return CLEAR; + default: + return new SpeakV1CloseType(Value.UNKNOWN, value); + } + } + + public enum Value { + FLUSH, + + CLEAR, + + CLOSE, + + UNKNOWN + } + + public interface Visitor { + T visitFlush(); + + T visitClear(); + + T visitClose(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/speak/v1/types/SpeakV1Flush.java b/src/main/java/com/deepgram/resources/speak/v1/types/SpeakV1Flush.java new file mode 100644 index 0000000..848dd1d --- /dev/null +++ b/src/main/java/com/deepgram/resources/speak/v1/types/SpeakV1Flush.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.speak.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SpeakV1Flush.Builder.class) +public final class SpeakV1Flush { + private final SpeakV1FlushType type; + + private final Map additionalProperties; + + private SpeakV1Flush(SpeakV1FlushType type, Map additionalProperties) { + this.type = type; + this.additionalProperties = additionalProperties; + } + + /** + * @return Message type identifier + */ + @JsonProperty("type") + public SpeakV1FlushType getType() { + return type; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SpeakV1Flush && equalTo((SpeakV1Flush) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SpeakV1Flush other) { + return type.equals(other.type); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TypeStage builder() { + return new Builder(); + } + + public interface TypeStage { + /** + *

Message type identifier

+ */ + _FinalStage type(@NotNull SpeakV1FlushType type); + + Builder from(SpeakV1Flush other); + } + + public interface _FinalStage { + SpeakV1Flush build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TypeStage, _FinalStage { + private SpeakV1FlushType type; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SpeakV1Flush other) { + type(other.getType()); + return this; + } + + /** + *

Message type identifier

+ *

Message type identifier

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull SpeakV1FlushType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + @java.lang.Override + public SpeakV1Flush build() { + return new SpeakV1Flush(type, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/speak/v1/types/SpeakV1FlushType.java b/src/main/java/com/deepgram/resources/speak/v1/types/SpeakV1FlushType.java new file mode 100644 index 0000000..9b17c52 --- /dev/null +++ b/src/main/java/com/deepgram/resources/speak/v1/types/SpeakV1FlushType.java @@ -0,0 +1,93 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.speak.v1.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class SpeakV1FlushType { + public static final SpeakV1FlushType CLOSE = new SpeakV1FlushType(Value.CLOSE, "Close"); + + public static final SpeakV1FlushType FLUSH = new SpeakV1FlushType(Value.FLUSH, "Flush"); + + public static final SpeakV1FlushType CLEAR = new SpeakV1FlushType(Value.CLEAR, "Clear"); + + private final Value value; + + private final String string; + + SpeakV1FlushType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof SpeakV1FlushType && this.string.equals(((SpeakV1FlushType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CLOSE: + return visitor.visitClose(); + case FLUSH: + return visitor.visitFlush(); + case CLEAR: + return visitor.visitClear(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static SpeakV1FlushType valueOf(String value) { + switch (value) { + case "Close": + return CLOSE; + case "Flush": + return FLUSH; + case "Clear": + return CLEAR; + default: + return new SpeakV1FlushType(Value.UNKNOWN, value); + } + } + + public enum Value { + FLUSH, + + CLEAR, + + CLOSE, + + UNKNOWN + } + + public interface Visitor { + T visitFlush(); + + T visitClear(); + + T visitClose(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/speak/v1/types/SpeakV1Flushed.java b/src/main/java/com/deepgram/resources/speak/v1/types/SpeakV1Flushed.java new file mode 100644 index 0000000..ba4139b --- /dev/null +++ b/src/main/java/com/deepgram/resources/speak/v1/types/SpeakV1Flushed.java @@ -0,0 +1,162 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.speak.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SpeakV1Flushed.Builder.class) +public final class SpeakV1Flushed { + private final SpeakV1FlushedType type; + + private final double sequenceId; + + private final Map additionalProperties; + + private SpeakV1Flushed(SpeakV1FlushedType type, double sequenceId, Map additionalProperties) { + this.type = type; + this.sequenceId = sequenceId; + this.additionalProperties = additionalProperties; + } + + /** + * @return Message type identifier + */ + @JsonProperty("type") + public SpeakV1FlushedType getType() { + return type; + } + + /** + * @return The sequence ID of the response + */ + @JsonProperty("sequence_id") + public double getSequenceId() { + return sequenceId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SpeakV1Flushed && equalTo((SpeakV1Flushed) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SpeakV1Flushed other) { + return type.equals(other.type) && sequenceId == other.sequenceId; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.sequenceId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TypeStage builder() { + return new Builder(); + } + + public interface TypeStage { + /** + *

Message type identifier

+ */ + SequenceIdStage type(@NotNull SpeakV1FlushedType type); + + Builder from(SpeakV1Flushed other); + } + + public interface SequenceIdStage { + /** + *

The sequence ID of the response

+ */ + _FinalStage sequenceId(double sequenceId); + } + + public interface _FinalStage { + SpeakV1Flushed build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TypeStage, SequenceIdStage, _FinalStage { + private SpeakV1FlushedType type; + + private double sequenceId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SpeakV1Flushed other) { + type(other.getType()); + sequenceId(other.getSequenceId()); + return this; + } + + /** + *

Message type identifier

+ *

Message type identifier

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

The sequence ID of the response

+ *

The sequence ID of the response

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("sequence_id") + public _FinalStage sequenceId(double sequenceId) { + this.sequenceId = sequenceId; + return this; + } + + @java.lang.Override + public SpeakV1Flushed build() { + return new SpeakV1Flushed(type, sequenceId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/speak/v1/types/SpeakV1FlushedType.java b/src/main/java/com/deepgram/resources/speak/v1/types/SpeakV1FlushedType.java new file mode 100644 index 0000000..4436df4 --- /dev/null +++ b/src/main/java/com/deepgram/resources/speak/v1/types/SpeakV1FlushedType.java @@ -0,0 +1,83 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.speak.v1.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class SpeakV1FlushedType { + public static final SpeakV1FlushedType CLEARED = new SpeakV1FlushedType(Value.CLEARED, "Cleared"); + + public static final SpeakV1FlushedType FLUSHED = new SpeakV1FlushedType(Value.FLUSHED, "Flushed"); + + private final Value value; + + private final String string; + + SpeakV1FlushedType(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof SpeakV1FlushedType && this.string.equals(((SpeakV1FlushedType) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CLEARED: + return visitor.visitCleared(); + case FLUSHED: + return visitor.visitFlushed(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static SpeakV1FlushedType valueOf(String value) { + switch (value) { + case "Cleared": + return CLEARED; + case "Flushed": + return FLUSHED; + default: + return new SpeakV1FlushedType(Value.UNKNOWN, value); + } + } + + public enum Value { + FLUSHED, + + CLEARED, + + UNKNOWN + } + + public interface Visitor { + T visitFlushed(); + + T visitCleared(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/resources/speak/v1/types/SpeakV1Metadata.java b/src/main/java/com/deepgram/resources/speak/v1/types/SpeakV1Metadata.java new file mode 100644 index 0000000..56efa7c --- /dev/null +++ b/src/main/java/com/deepgram/resources/speak/v1/types/SpeakV1Metadata.java @@ -0,0 +1,245 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.speak.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SpeakV1Metadata.Builder.class) +public final class SpeakV1Metadata { + private final String requestId; + + private final String modelName; + + private final String modelVersion; + + private final String modelUuid; + + private final Map additionalProperties; + + private SpeakV1Metadata( + String requestId, + String modelName, + String modelVersion, + String modelUuid, + Map additionalProperties) { + this.requestId = requestId; + this.modelName = modelName; + this.modelVersion = modelVersion; + this.modelUuid = modelUuid; + this.additionalProperties = additionalProperties; + } + + /** + * @return Message type identifier + */ + @JsonProperty("type") + public String getType() { + return "Metadata"; + } + + /** + * @return Unique identifier for the request + */ + @JsonProperty("request_id") + public String getRequestId() { + return requestId; + } + + /** + * @return Name of the model being used + */ + @JsonProperty("model_name") + public String getModelName() { + return modelName; + } + + /** + * @return Version of the model being used + */ + @JsonProperty("model_version") + public String getModelVersion() { + return modelVersion; + } + + /** + * @return Unique identifier for the model + */ + @JsonProperty("model_uuid") + public String getModelUuid() { + return modelUuid; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SpeakV1Metadata && equalTo((SpeakV1Metadata) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SpeakV1Metadata other) { + return requestId.equals(other.requestId) + && modelName.equals(other.modelName) + && modelVersion.equals(other.modelVersion) + && modelUuid.equals(other.modelUuid); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.requestId, this.modelName, this.modelVersion, this.modelUuid); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static RequestIdStage builder() { + return new Builder(); + } + + public interface RequestIdStage { + /** + *

Unique identifier for the request

+ */ + ModelNameStage requestId(@NotNull String requestId); + + Builder from(SpeakV1Metadata other); + } + + public interface ModelNameStage { + /** + *

Name of the model being used

+ */ + ModelVersionStage modelName(@NotNull String modelName); + } + + public interface ModelVersionStage { + /** + *

Version of the model being used

+ */ + ModelUuidStage modelVersion(@NotNull String modelVersion); + } + + public interface ModelUuidStage { + /** + *

Unique identifier for the model

+ */ + _FinalStage modelUuid(@NotNull String modelUuid); + } + + public interface _FinalStage { + SpeakV1Metadata build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements RequestIdStage, ModelNameStage, ModelVersionStage, ModelUuidStage, _FinalStage { + private String requestId; + + private String modelName; + + private String modelVersion; + + private String modelUuid; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SpeakV1Metadata other) { + requestId(other.getRequestId()); + modelName(other.getModelName()); + modelVersion(other.getModelVersion()); + modelUuid(other.getModelUuid()); + return this; + } + + /** + *

Unique identifier for the request

+ *

Unique identifier for the request

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

Name of the model being used

+ *

Name of the model being used

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

Version of the model being used

+ *

Version of the model being used

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

Unique identifier for the model

+ *

Unique identifier for the model

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("model_uuid") + public _FinalStage modelUuid(@NotNull String modelUuid) { + this.modelUuid = Objects.requireNonNull(modelUuid, "modelUuid must not be null"); + return this; + } + + @java.lang.Override + public SpeakV1Metadata build() { + return new SpeakV1Metadata(requestId, modelName, modelVersion, modelUuid, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/speak/v1/types/SpeakV1Text.java b/src/main/java/com/deepgram/resources/speak/v1/types/SpeakV1Text.java new file mode 100644 index 0000000..0f5704f --- /dev/null +++ b/src/main/java/com/deepgram/resources/speak/v1/types/SpeakV1Text.java @@ -0,0 +1,137 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.speak.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SpeakV1Text.Builder.class) +public final class SpeakV1Text { + private final String text; + + private final Map additionalProperties; + + private SpeakV1Text(String text, Map additionalProperties) { + this.text = text; + this.additionalProperties = additionalProperties; + } + + /** + * @return Message type identifier + */ + @JsonProperty("type") + public String getType() { + return "Speak"; + } + + /** + * @return The input text to be converted to speech + */ + @JsonProperty("text") + public String getText() { + return text; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SpeakV1Text && equalTo((SpeakV1Text) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SpeakV1Text other) { + return text.equals(other.text); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.text); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TextStage builder() { + return new Builder(); + } + + public interface TextStage { + /** + *

The input text to be converted to speech

+ */ + _FinalStage text(@NotNull String text); + + Builder from(SpeakV1Text other); + } + + public interface _FinalStage { + SpeakV1Text build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TextStage, _FinalStage { + private String text; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SpeakV1Text other) { + text(other.getText()); + return this; + } + + /** + *

The input text to be converted to speech

+ *

The input text to be converted to speech

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("text") + public _FinalStage text(@NotNull String text) { + this.text = Objects.requireNonNull(text, "text must not be null"); + return this; + } + + @java.lang.Override + public SpeakV1Text build() { + return new SpeakV1Text(text, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/speak/v1/types/SpeakV1Warning.java b/src/main/java/com/deepgram/resources/speak/v1/types/SpeakV1Warning.java new file mode 100644 index 0000000..f8ba1d2 --- /dev/null +++ b/src/main/java/com/deepgram/resources/speak/v1/types/SpeakV1Warning.java @@ -0,0 +1,170 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.speak.v1.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SpeakV1Warning.Builder.class) +public final class SpeakV1Warning { + private final String description; + + private final String code; + + private final Map additionalProperties; + + private SpeakV1Warning(String description, String code, Map additionalProperties) { + this.description = description; + this.code = code; + this.additionalProperties = additionalProperties; + } + + /** + * @return Message type identifier + */ + @JsonProperty("type") + public String getType() { + return "Warning"; + } + + /** + * @return A description of what went wrong + */ + @JsonProperty("description") + public String getDescription() { + return description; + } + + /** + * @return Error code identifying the type of error + */ + @JsonProperty("code") + public String getCode() { + return code; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SpeakV1Warning && equalTo((SpeakV1Warning) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SpeakV1Warning other) { + return description.equals(other.description) && code.equals(other.code); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.description, this.code); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DescriptionStage builder() { + return new Builder(); + } + + public interface DescriptionStage { + /** + *

A description of what went wrong

+ */ + CodeStage description(@NotNull String description); + + Builder from(SpeakV1Warning other); + } + + public interface CodeStage { + /** + *

Error code identifying the type of error

+ */ + _FinalStage code(@NotNull String code); + } + + public interface _FinalStage { + SpeakV1Warning build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DescriptionStage, CodeStage, _FinalStage { + private String description; + + private String code; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SpeakV1Warning other) { + description(other.getDescription()); + code(other.getCode()); + return this; + } + + /** + *

A description of what went wrong

+ *

A description of what went wrong

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

Error code identifying the type of error

+ *

Error code identifying the type of error

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("code") + public _FinalStage code(@NotNull String code) { + this.code = Objects.requireNonNull(code, "code must not be null"); + return this; + } + + @java.lang.Override + public SpeakV1Warning build() { + return new SpeakV1Warning(description, code, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/speak/v1/websocket/V1ConnectOptions.java b/src/main/java/com/deepgram/resources/speak/v1/websocket/V1ConnectOptions.java new file mode 100644 index 0000000..0b4c47a --- /dev/null +++ b/src/main/java/com/deepgram/resources/speak/v1/websocket/V1ConnectOptions.java @@ -0,0 +1,183 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.speak.v1.websocket; + +import com.deepgram.core.ObjectMappers; +import com.deepgram.types.SpeakV1Encoding; +import com.deepgram.types.SpeakV1MipOptOut; +import com.deepgram.types.SpeakV1Model; +import com.deepgram.types.SpeakV1SampleRate; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = V1ConnectOptions.Builder.class) +public final class V1ConnectOptions { + private final Optional encoding; + + private final Optional mipOptOut; + + private final Optional model; + + private final Optional sampleRate; + + private final Map additionalProperties; + + private V1ConnectOptions( + Optional encoding, + Optional mipOptOut, + Optional model, + Optional sampleRate, + Map additionalProperties) { + this.encoding = encoding; + this.mipOptOut = mipOptOut; + this.model = model; + this.sampleRate = sampleRate; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("encoding") + public Optional getEncoding() { + return encoding; + } + + @JsonProperty("mip_opt_out") + public Optional getMipOptOut() { + return mipOptOut; + } + + @JsonProperty("model") + public Optional getModel() { + return model; + } + + @JsonProperty("sample_rate") + public Optional getSampleRate() { + return sampleRate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof V1ConnectOptions && equalTo((V1ConnectOptions) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(V1ConnectOptions other) { + return encoding.equals(other.encoding) + && mipOptOut.equals(other.mipOptOut) + && model.equals(other.model) + && sampleRate.equals(other.sampleRate); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.encoding, this.mipOptOut, this.model, this.sampleRate); + } + + @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 encoding = Optional.empty(); + + private Optional mipOptOut = Optional.empty(); + + private Optional model = Optional.empty(); + + private Optional sampleRate = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(V1ConnectOptions other) { + encoding(other.getEncoding()); + mipOptOut(other.getMipOptOut()); + model(other.getModel()); + sampleRate(other.getSampleRate()); + return this; + } + + @JsonSetter(value = "encoding", nulls = Nulls.SKIP) + public Builder encoding(Optional encoding) { + this.encoding = encoding; + return this; + } + + public Builder encoding(SpeakV1Encoding encoding) { + this.encoding = Optional.ofNullable(encoding); + return this; + } + + @JsonSetter(value = "mip_opt_out", nulls = Nulls.SKIP) + public Builder mipOptOut(Optional mipOptOut) { + this.mipOptOut = mipOptOut; + return this; + } + + public Builder mipOptOut(SpeakV1MipOptOut mipOptOut) { + this.mipOptOut = Optional.ofNullable(mipOptOut); + return this; + } + + @JsonSetter(value = "model", nulls = Nulls.SKIP) + public Builder model(Optional model) { + this.model = model; + return this; + } + + public Builder model(SpeakV1Model model) { + this.model = Optional.ofNullable(model); + return this; + } + + @JsonSetter(value = "sample_rate", nulls = Nulls.SKIP) + public Builder sampleRate(Optional sampleRate) { + this.sampleRate = sampleRate; + return this; + } + + public Builder sampleRate(SpeakV1SampleRate sampleRate) { + this.sampleRate = Optional.ofNullable(sampleRate); + return this; + } + + public V1ConnectOptions build() { + return new V1ConnectOptions(encoding, mipOptOut, model, sampleRate, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/resources/speak/v1/websocket/V1WebSocketClient.java b/src/main/java/com/deepgram/resources/speak/v1/websocket/V1WebSocketClient.java new file mode 100644 index 0000000..ed122ca --- /dev/null +++ b/src/main/java/com/deepgram/resources/speak/v1/websocket/V1WebSocketClient.java @@ -0,0 +1,423 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.resources.speak.v1.websocket; + +import com.deepgram.core.ClientOptions; +import com.deepgram.core.DisconnectReason; +import com.deepgram.core.ObjectMappers; +import com.deepgram.core.ReconnectingWebSocketListener; +import com.deepgram.core.WebSocketReadyState; +import com.deepgram.resources.speak.v1.types.SpeakV1Clear; +import com.deepgram.resources.speak.v1.types.SpeakV1Cleared; +import com.deepgram.resources.speak.v1.types.SpeakV1Close; +import com.deepgram.resources.speak.v1.types.SpeakV1Flush; +import com.deepgram.resources.speak.v1.types.SpeakV1Flushed; +import com.deepgram.resources.speak.v1.types.SpeakV1Metadata; +import com.deepgram.resources.speak.v1.types.SpeakV1Text; +import com.deepgram.resources.speak.v1.types.SpeakV1Warning; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ScheduledExecutorService; +import java.util.function.Consumer; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.WebSocket; +import okio.ByteString; + +/** + * WebSocket client for the v1 channel. + * Provides real-time bidirectional communication with strongly-typed messages. + */ +public class V1WebSocketClient implements AutoCloseable { + protected final ClientOptions clientOptions; + + private final ObjectMapper objectMapper; + + private final OkHttpClient okHttpClient; + + private ScheduledExecutorService timeoutExecutor; + + private volatile WebSocketReadyState readyState = WebSocketReadyState.CLOSED; + + private volatile Runnable onConnectedHandler; + + private volatile Consumer onDisconnectedHandler; + + private volatile Consumer onErrorHandler; + + private volatile Consumer onMessageHandler; + + private volatile ReconnectingWebSocketListener.ReconnectOptions reconnectOptions; + + private CompletableFuture connectionFuture; + + private ReconnectingWebSocketListener reconnectingListener; + + private volatile Consumer speakV1AudioHandler; + + private volatile Consumer metadataHandler; + + private volatile Consumer flushedHandler; + + private volatile Consumer clearedHandler; + + private volatile Consumer warningHandler; + + /** + * Creates a new async WebSocket client for the v1 channel. + */ + public V1WebSocketClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.objectMapper = ObjectMappers.JSON_MAPPER; + this.okHttpClient = clientOptions.httpClient(); + } + + /** + * Establishes the WebSocket connection asynchronously with automatic reconnection. + * @return a CompletableFuture that completes when the connection is established + * @param options connection options including query parameters + */ + public CompletableFuture connect(V1ConnectOptions options) { + connectionFuture = new CompletableFuture<>(); + String baseUrl = clientOptions.environment().getProductionURL(); + String fullPath = "/v1/speak"; + if (baseUrl.endsWith("/") && fullPath.startsWith("/")) { + fullPath = fullPath.substring(1); + } else if (!baseUrl.endsWith("/") && !fullPath.startsWith("/")) { + fullPath = "/" + fullPath; + } + // OkHttp's HttpUrl only supports http/https schemes; convert wss/ws for URL parsing + if (baseUrl.startsWith("wss://")) { + baseUrl = "https://" + baseUrl.substring(6); + } else if (baseUrl.startsWith("ws://")) { + baseUrl = "http://" + baseUrl.substring(5); + } + HttpUrl parsedUrl = HttpUrl.parse(baseUrl + fullPath); + if (parsedUrl == null) { + throw new IllegalArgumentException("Invalid WebSocket URL: " + baseUrl + fullPath); + } + HttpUrl.Builder urlBuilder = parsedUrl.newBuilder(); + if (options.getEncoding() != null && options.getEncoding().isPresent()) { + urlBuilder.addQueryParameter( + "encoding", String.valueOf(options.getEncoding().get())); + } + if (options.getMipOptOut() != null && options.getMipOptOut().isPresent()) { + urlBuilder.addQueryParameter( + "mip_opt_out", String.valueOf(options.getMipOptOut().get())); + } + if (options.getModel() != null && options.getModel().isPresent()) { + urlBuilder.addQueryParameter( + "model", String.valueOf(options.getModel().get())); + } + if (options.getSampleRate() != null && options.getSampleRate().isPresent()) { + urlBuilder.addQueryParameter( + "sample_rate", String.valueOf(options.getSampleRate().get())); + } + Request.Builder requestBuilder = new Request.Builder().url(urlBuilder.build()); + clientOptions.headers(null).forEach(requestBuilder::addHeader); + final Request request = requestBuilder.build(); + this.readyState = WebSocketReadyState.CONNECTING; + ReconnectingWebSocketListener.ReconnectOptions reconnectOpts = this.reconnectOptions != null + ? this.reconnectOptions + : ReconnectingWebSocketListener.ReconnectOptions.builder().build(); + this.reconnectingListener = + new ReconnectingWebSocketListener(reconnectOpts, () -> { + if (clientOptions.webSocketFactory().isPresent()) { + return clientOptions.webSocketFactory().get().create(request, this.reconnectingListener); + } else { + return okHttpClient.newWebSocket(request, this.reconnectingListener); + } + }) { + @Override + protected void onWebSocketOpen(WebSocket webSocket, Response response) { + readyState = WebSocketReadyState.OPEN; + if (onConnectedHandler != null) { + onConnectedHandler.run(); + } + connectionFuture.complete(null); + } + + @Override + protected void onWebSocketMessage(WebSocket webSocket, String text) { + handleIncomingMessage(text); + } + + @Override + protected void onWebSocketBinaryMessage(WebSocket webSocket, ByteString bytes) { + if (speakV1AudioHandler != null) { + speakV1AudioHandler.accept(bytes); + } + } + + @Override + protected void onWebSocketFailure(WebSocket webSocket, Throwable t, Response response) { + readyState = WebSocketReadyState.CLOSED; + if (onErrorHandler != null) { + onErrorHandler.accept(new RuntimeException(t)); + } + connectionFuture.completeExceptionally(t); + } + + @Override + protected void onWebSocketClosed(WebSocket webSocket, int code, String reason) { + readyState = WebSocketReadyState.CLOSED; + if (onDisconnectedHandler != null) { + onDisconnectedHandler.accept(new DisconnectReason(code, reason)); + } + } + }; + reconnectingListener.connect(); + return connectionFuture; + } + + /** + * Establishes the WebSocket connection asynchronously with default options. + * @return a CompletableFuture that completes when the connection is established + */ + public CompletableFuture connect() { + return connect(V1ConnectOptions.builder().build()); + } + + /** + * Disconnects the WebSocket connection and releases resources. + */ + public void disconnect() { + reconnectingListener.disconnect(); + if (timeoutExecutor != null) { + timeoutExecutor.shutdownNow(); + timeoutExecutor = null; + } + } + + /** + * Gets the current state of the WebSocket connection. + * + * This provides the actual connection state, similar to the W3C WebSocket API. + * + * @return the current WebSocket ready state + */ + public WebSocketReadyState getReadyState() { + return readyState; + } + + /** + * Sends a SpeakV1Text message to the server asynchronously. + * @param message the message to send + * @return a CompletableFuture that completes when the message is sent + */ + public CompletableFuture sendText(SpeakV1Text message) { + return sendMessage(message); + } + + /** + * Sends a SpeakV1Flush message to the server asynchronously. + * @param message the message to send + * @return a CompletableFuture that completes when the message is sent + */ + public CompletableFuture sendFlush(SpeakV1Flush message) { + return sendMessage(message); + } + + /** + * Sends a SpeakV1Clear message to the server asynchronously. + * @param message the message to send + * @return a CompletableFuture that completes when the message is sent + */ + public CompletableFuture sendClear(SpeakV1Clear message) { + return sendMessage(message); + } + + /** + * Sends a SpeakV1Close message to the server asynchronously. + * @param message the message to send + * @return a CompletableFuture that completes when the message is sent + */ + public CompletableFuture sendClose(SpeakV1Close message) { + return sendMessage(message); + } + + /** + * Registers a handler for SpeakV1Audio messages from the server. + * @param handler the handler to invoke when a message is received + */ + public void onSpeakV1Audio(Consumer handler) { + this.speakV1AudioHandler = handler; + } + + /** + * Registers a handler for SpeakV1Metadata messages from the server. + * @param handler the handler to invoke when a message is received + */ + public void onMetadata(Consumer handler) { + this.metadataHandler = handler; + } + + /** + * Registers a handler for SpeakV1Flushed messages from the server. + * @param handler the handler to invoke when a message is received + */ + public void onFlushed(Consumer handler) { + this.flushedHandler = handler; + } + + /** + * Registers a handler for SpeakV1Cleared messages from the server. + * @param handler the handler to invoke when a message is received + */ + public void onCleared(Consumer handler) { + this.clearedHandler = handler; + } + + /** + * Registers a handler for SpeakV1Warning messages from the server. + * @param handler the handler to invoke when a message is received + */ + public void onWarning(Consumer handler) { + this.warningHandler = handler; + } + + /** + * Registers a handler called when the connection is established. + * @param handler the handler to invoke when connected + */ + public void onConnected(Runnable handler) { + this.onConnectedHandler = handler; + } + + /** + * Registers a handler called when the connection is closed. + * @param handler the handler to invoke when disconnected + */ + public void onDisconnected(Consumer handler) { + this.onDisconnectedHandler = handler; + } + + /** + * Registers a handler called when an error occurs. + * @param handler the handler to invoke on error + */ + public void onError(Consumer handler) { + this.onErrorHandler = handler; + } + + /** + * Registers a handler called for every incoming text message. + * The handler receives the raw JSON string before type-specific dispatch. + * @param handler the handler to invoke with the raw message JSON + */ + public void onMessage(Consumer handler) { + this.onMessageHandler = handler; + } + + /** + * Configures reconnection behavior. Must be called before {@link #connect}. + * + * @param options the reconnection options (backoff, retries, queue size) + */ + public void reconnectOptions(ReconnectingWebSocketListener.ReconnectOptions options) { + this.reconnectOptions = options; + } + + /** + * Closes this WebSocket client, releasing all resources. + * Equivalent to calling {@link #disconnect()}. + */ + @Override + public void close() { + disconnect(); + } + + /** + * Ensures the WebSocket is connected and ready to send messages. + * @throws IllegalStateException if the socket is not connected or not open + */ + private void assertSocketIsOpen() { + if (reconnectingListener.getWebSocket() == null) { + throw new IllegalStateException("WebSocket is not connected. Call connect() first."); + } + if (readyState != WebSocketReadyState.OPEN) { + throw new IllegalStateException("WebSocket is not open. Current state: " + readyState); + } + } + + private CompletableFuture sendMessage(Object body) { + CompletableFuture future = new CompletableFuture<>(); + try { + assertSocketIsOpen(); + String json = objectMapper.writeValueAsString(body); + // Use reconnecting listener's send method which handles queuing + reconnectingListener.send(json); + future.complete(null); + } catch (IllegalStateException e) { + future.completeExceptionally(e); + } catch (Exception e) { + future.completeExceptionally(new RuntimeException("Failed to send message", e)); + } + return future; + } + + private void handleIncomingMessage(String json) { + try { + if (onMessageHandler != null) { + onMessageHandler.accept(json); + } + JsonNode node = objectMapper.readTree(json); + if (node == null || node.isNull()) { + throw new IllegalArgumentException("Received null or invalid JSON message"); + } + JsonNode typeNode = node.get("type"); + if (typeNode == null || typeNode.isNull()) { + throw new IllegalArgumentException("Message missing 'type' field"); + } + String type = typeNode.asText(); + switch (type) { + case "Metadata": + if (metadataHandler != null) { + SpeakV1Metadata event = objectMapper.treeToValue(node, SpeakV1Metadata.class); + if (event != null) { + metadataHandler.accept(event); + } + } + break; + case "Flushed": + if (flushedHandler != null) { + SpeakV1Flushed event = objectMapper.treeToValue(node, SpeakV1Flushed.class); + if (event != null) { + flushedHandler.accept(event); + } + } + break; + case "Cleared": + if (clearedHandler != null) { + SpeakV1Cleared event = objectMapper.treeToValue(node, SpeakV1Cleared.class); + if (event != null) { + clearedHandler.accept(event); + } + } + break; + case "Warning": + if (warningHandler != null) { + SpeakV1Warning event = objectMapper.treeToValue(node, SpeakV1Warning.class); + if (event != null) { + warningHandler.accept(event); + } + } + break; + default: + if (onErrorHandler != null) { + onErrorHandler.accept(new RuntimeException("Unknown WebSocket message type: '" + type + + "'. Update your SDK version to support new message types.")); + } + break; + } + } catch (Exception e) { + if (onErrorHandler != null) { + onErrorHandler.accept(e); + } + } + } +} diff --git a/src/main/java/com/deepgram/types/AgentThinkModelsV1Response.java b/src/main/java/com/deepgram/types/AgentThinkModelsV1Response.java new file mode 100644 index 0000000..5b5bb15 --- /dev/null +++ b/src/main/java/com/deepgram/types/AgentThinkModelsV1Response.java @@ -0,0 +1,117 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = AgentThinkModelsV1Response.Builder.class) +public final class AgentThinkModelsV1Response { + private final List models; + + private final Map additionalProperties; + + private AgentThinkModelsV1Response( + List models, Map additionalProperties) { + this.models = models; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("models") + public List getModels() { + return models; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentThinkModelsV1Response && equalTo((AgentThinkModelsV1Response) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentThinkModelsV1Response other) { + return models.equals(other.models); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.models); + } + + @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 models = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AgentThinkModelsV1Response other) { + models(other.getModels()); + return this; + } + + @JsonSetter(value = "models", nulls = Nulls.SKIP) + public Builder models(List models) { + this.models.clear(); + if (models != null) { + this.models.addAll(models); + } + return this; + } + + public Builder addModels(AgentThinkModelsV1ResponseModelsItem models) { + this.models.add(models); + return this; + } + + public Builder addAllModels(List models) { + if (models != null) { + this.models.addAll(models); + } + return this; + } + + public AgentThinkModelsV1Response build() { + return new AgentThinkModelsV1Response(models, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/AgentThinkModelsV1ResponseModelsItem.java b/src/main/java/com/deepgram/types/AgentThinkModelsV1ResponseModelsItem.java new file mode 100644 index 0000000..6a4193b --- /dev/null +++ b/src/main/java/com/deepgram/types/AgentThinkModelsV1ResponseModelsItem.java @@ -0,0 +1,135 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +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 java.io.IOException; +import java.util.Objects; + +@JsonDeserialize(using = AgentThinkModelsV1ResponseModelsItem.Deserializer.class) +public final class AgentThinkModelsV1ResponseModelsItem { + private final Object value; + + private final int type; + + private AgentThinkModelsV1ResponseModelsItem(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + @SuppressWarnings("unchecked") + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((AgentThinkModelsV1ResponseModelsItemZero) this.value); + } else if (this.type == 1) { + return visitor.visit((AgentThinkModelsV1ResponseModelsItemOne) this.value); + } else if (this.type == 2) { + return visitor.visit((AgentThinkModelsV1ResponseModelsItemTwo) this.value); + } else if (this.type == 3) { + return visitor.visit((AgentThinkModelsV1ResponseModelsItemThree) this.value); + } else if (this.type == 4) { + return visitor.visit((AgentThinkModelsV1ResponseModelsItemId) 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 AgentThinkModelsV1ResponseModelsItem + && equalTo((AgentThinkModelsV1ResponseModelsItem) other); + } + + private boolean equalTo(AgentThinkModelsV1ResponseModelsItem 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 AgentThinkModelsV1ResponseModelsItem of(AgentThinkModelsV1ResponseModelsItemZero value) { + return new AgentThinkModelsV1ResponseModelsItem(value, 0); + } + + public static AgentThinkModelsV1ResponseModelsItem of(AgentThinkModelsV1ResponseModelsItemOne value) { + return new AgentThinkModelsV1ResponseModelsItem(value, 1); + } + + public static AgentThinkModelsV1ResponseModelsItem of(AgentThinkModelsV1ResponseModelsItemTwo value) { + return new AgentThinkModelsV1ResponseModelsItem(value, 2); + } + + public static AgentThinkModelsV1ResponseModelsItem of(AgentThinkModelsV1ResponseModelsItemThree value) { + return new AgentThinkModelsV1ResponseModelsItem(value, 3); + } + + public static AgentThinkModelsV1ResponseModelsItem of(AgentThinkModelsV1ResponseModelsItemId value) { + return new AgentThinkModelsV1ResponseModelsItem(value, 4); + } + + public interface Visitor { + T visit(AgentThinkModelsV1ResponseModelsItemZero value); + + T visit(AgentThinkModelsV1ResponseModelsItemOne value); + + T visit(AgentThinkModelsV1ResponseModelsItemTwo value); + + T visit(AgentThinkModelsV1ResponseModelsItemThree value); + + T visit(AgentThinkModelsV1ResponseModelsItemId value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(AgentThinkModelsV1ResponseModelsItem.class); + } + + @java.lang.Override + public AgentThinkModelsV1ResponseModelsItem deserialize(JsonParser p, DeserializationContext context) + throws IOException { + Object value = p.readValueAs(Object.class); + try { + return of( + ObjectMappers.JSON_MAPPER.convertValue(value, AgentThinkModelsV1ResponseModelsItemZero.class)); + } catch (RuntimeException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, AgentThinkModelsV1ResponseModelsItemOne.class)); + } catch (RuntimeException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, AgentThinkModelsV1ResponseModelsItemTwo.class)); + } catch (RuntimeException e) { + } + try { + return of( + ObjectMappers.JSON_MAPPER.convertValue(value, AgentThinkModelsV1ResponseModelsItemThree.class)); + } catch (RuntimeException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, AgentThinkModelsV1ResponseModelsItemId.class)); + } catch (RuntimeException e) { + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/deepgram/types/AgentThinkModelsV1ResponseModelsItemId.java b/src/main/java/com/deepgram/types/AgentThinkModelsV1ResponseModelsItemId.java new file mode 100644 index 0000000..f09bc0b --- /dev/null +++ b/src/main/java/com/deepgram/types/AgentThinkModelsV1ResponseModelsItemId.java @@ -0,0 +1,171 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AgentThinkModelsV1ResponseModelsItemId.Builder.class) +public final class AgentThinkModelsV1ResponseModelsItemId { + private final String id; + + private final String name; + + private final Map additionalProperties; + + private AgentThinkModelsV1ResponseModelsItemId(String id, String name, Map additionalProperties) { + this.id = id; + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier of the AWS Bedrock model (any model string accepted for BYO LLMs) + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The display name of the model + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return The provider of the model + */ + @JsonProperty("provider") + public String getProvider() { + return "aws_bedrock"; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentThinkModelsV1ResponseModelsItemId + && equalTo((AgentThinkModelsV1ResponseModelsItemId) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentThinkModelsV1ResponseModelsItemId other) { + return id.equals(other.id) && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier of the AWS Bedrock model (any model string accepted for BYO LLMs)

+ */ + NameStage id(@NotNull String id); + + Builder from(AgentThinkModelsV1ResponseModelsItemId other); + } + + public interface NameStage { + /** + *

The display name of the model

+ */ + _FinalStage name(@NotNull String name); + } + + public interface _FinalStage { + AgentThinkModelsV1ResponseModelsItemId build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, NameStage, _FinalStage { + private String id; + + private String name; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentThinkModelsV1ResponseModelsItemId other) { + id(other.getId()); + name(other.getName()); + return this; + } + + /** + *

The unique identifier of the AWS Bedrock model (any model string accepted for BYO LLMs)

+ *

The unique identifier of the AWS Bedrock model (any model string accepted for BYO LLMs)

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

The display name of the model

+ *

The display name of the model

+ * @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 AgentThinkModelsV1ResponseModelsItemId build() { + return new AgentThinkModelsV1ResponseModelsItemId(id, name, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/AgentThinkModelsV1ResponseModelsItemOne.java b/src/main/java/com/deepgram/types/AgentThinkModelsV1ResponseModelsItemOne.java new file mode 100644 index 0000000..b756dd7 --- /dev/null +++ b/src/main/java/com/deepgram/types/AgentThinkModelsV1ResponseModelsItemOne.java @@ -0,0 +1,172 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AgentThinkModelsV1ResponseModelsItemOne.Builder.class) +public final class AgentThinkModelsV1ResponseModelsItemOne { + private final AgentThinkModelsV1ResponseModelsItemOneId id; + + private final String name; + + private final Map additionalProperties; + + private AgentThinkModelsV1ResponseModelsItemOne( + AgentThinkModelsV1ResponseModelsItemOneId id, String name, Map additionalProperties) { + this.id = id; + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier of the Anthropic model + */ + @JsonProperty("id") + public AgentThinkModelsV1ResponseModelsItemOneId getId() { + return id; + } + + /** + * @return The display name of the model + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return The provider of the model + */ + @JsonProperty("provider") + public String getProvider() { + return "anthropic"; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentThinkModelsV1ResponseModelsItemOne + && equalTo((AgentThinkModelsV1ResponseModelsItemOne) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentThinkModelsV1ResponseModelsItemOne other) { + return id.equals(other.id) && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier of the Anthropic model

+ */ + NameStage id(@NotNull AgentThinkModelsV1ResponseModelsItemOneId id); + + Builder from(AgentThinkModelsV1ResponseModelsItemOne other); + } + + public interface NameStage { + /** + *

The display name of the model

+ */ + _FinalStage name(@NotNull String name); + } + + public interface _FinalStage { + AgentThinkModelsV1ResponseModelsItemOne build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, NameStage, _FinalStage { + private AgentThinkModelsV1ResponseModelsItemOneId id; + + private String name; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentThinkModelsV1ResponseModelsItemOne other) { + id(other.getId()); + name(other.getName()); + return this; + } + + /** + *

The unique identifier of the Anthropic model

+ *

The unique identifier of the Anthropic model

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

The display name of the model

+ *

The display name of the model

+ * @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 AgentThinkModelsV1ResponseModelsItemOne build() { + return new AgentThinkModelsV1ResponseModelsItemOne(id, name, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/AgentThinkModelsV1ResponseModelsItemOneId.java b/src/main/java/com/deepgram/types/AgentThinkModelsV1ResponseModelsItemOneId.java new file mode 100644 index 0000000..2f672d3 --- /dev/null +++ b/src/main/java/com/deepgram/types/AgentThinkModelsV1ResponseModelsItemOneId.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AgentThinkModelsV1ResponseModelsItemOneId { + public static final AgentThinkModelsV1ResponseModelsItemOneId CLAUDE_SONNET420250514 = + new AgentThinkModelsV1ResponseModelsItemOneId(Value.CLAUDE_SONNET420250514, "claude-sonnet-4-20250514"); + + public static final AgentThinkModelsV1ResponseModelsItemOneId CLAUDE35HAIKU_LATEST = + new AgentThinkModelsV1ResponseModelsItemOneId(Value.CLAUDE35HAIKU_LATEST, "claude-3-5-haiku-latest"); + + private final Value value; + + private final String string; + + AgentThinkModelsV1ResponseModelsItemOneId(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AgentThinkModelsV1ResponseModelsItemOneId + && this.string.equals(((AgentThinkModelsV1ResponseModelsItemOneId) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case CLAUDE_SONNET420250514: + return visitor.visitClaudeSonnet420250514(); + case CLAUDE35HAIKU_LATEST: + return visitor.visitClaude35HaikuLatest(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AgentThinkModelsV1ResponseModelsItemOneId valueOf(String value) { + switch (value) { + case "claude-sonnet-4-20250514": + return CLAUDE_SONNET420250514; + case "claude-3-5-haiku-latest": + return CLAUDE35HAIKU_LATEST; + default: + return new AgentThinkModelsV1ResponseModelsItemOneId(Value.UNKNOWN, value); + } + } + + public enum Value { + CLAUDE35HAIKU_LATEST, + + CLAUDE_SONNET420250514, + + UNKNOWN + } + + public interface Visitor { + T visitClaude35HaikuLatest(); + + T visitClaudeSonnet420250514(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/types/AgentThinkModelsV1ResponseModelsItemThree.java b/src/main/java/com/deepgram/types/AgentThinkModelsV1ResponseModelsItemThree.java new file mode 100644 index 0000000..257e433 --- /dev/null +++ b/src/main/java/com/deepgram/types/AgentThinkModelsV1ResponseModelsItemThree.java @@ -0,0 +1,146 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AgentThinkModelsV1ResponseModelsItemThree.Builder.class) +public final class AgentThinkModelsV1ResponseModelsItemThree { + private final String name; + + private final Map additionalProperties; + + private AgentThinkModelsV1ResponseModelsItemThree(String name, Map additionalProperties) { + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier of the Groq model + */ + @JsonProperty("id") + public String getId() { + return "openai/gpt-oss-20b"; + } + + /** + * @return The display name of the model + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return The provider of the model + */ + @JsonProperty("provider") + public String getProvider() { + return "groq"; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentThinkModelsV1ResponseModelsItemThree + && equalTo((AgentThinkModelsV1ResponseModelsItemThree) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentThinkModelsV1ResponseModelsItemThree 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 NameStage builder() { + return new Builder(); + } + + public interface NameStage { + /** + *

The display name of the model

+ */ + _FinalStage name(@NotNull String name); + + Builder from(AgentThinkModelsV1ResponseModelsItemThree other); + } + + public interface _FinalStage { + AgentThinkModelsV1ResponseModelsItemThree build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements NameStage, _FinalStage { + private String name; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentThinkModelsV1ResponseModelsItemThree other) { + name(other.getName()); + return this; + } + + /** + *

The display name of the model

+ *

The display name of the model

+ * @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 AgentThinkModelsV1ResponseModelsItemThree build() { + return new AgentThinkModelsV1ResponseModelsItemThree(name, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/AgentThinkModelsV1ResponseModelsItemTwo.java b/src/main/java/com/deepgram/types/AgentThinkModelsV1ResponseModelsItemTwo.java new file mode 100644 index 0000000..b58d537 --- /dev/null +++ b/src/main/java/com/deepgram/types/AgentThinkModelsV1ResponseModelsItemTwo.java @@ -0,0 +1,172 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AgentThinkModelsV1ResponseModelsItemTwo.Builder.class) +public final class AgentThinkModelsV1ResponseModelsItemTwo { + private final AgentThinkModelsV1ResponseModelsItemTwoId id; + + private final String name; + + private final Map additionalProperties; + + private AgentThinkModelsV1ResponseModelsItemTwo( + AgentThinkModelsV1ResponseModelsItemTwoId id, String name, Map additionalProperties) { + this.id = id; + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier of the Google model + */ + @JsonProperty("id") + public AgentThinkModelsV1ResponseModelsItemTwoId getId() { + return id; + } + + /** + * @return The display name of the model + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return The provider of the model + */ + @JsonProperty("provider") + public String getProvider() { + return "google"; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentThinkModelsV1ResponseModelsItemTwo + && equalTo((AgentThinkModelsV1ResponseModelsItemTwo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentThinkModelsV1ResponseModelsItemTwo other) { + return id.equals(other.id) && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier of the Google model

+ */ + NameStage id(@NotNull AgentThinkModelsV1ResponseModelsItemTwoId id); + + Builder from(AgentThinkModelsV1ResponseModelsItemTwo other); + } + + public interface NameStage { + /** + *

The display name of the model

+ */ + _FinalStage name(@NotNull String name); + } + + public interface _FinalStage { + AgentThinkModelsV1ResponseModelsItemTwo build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, NameStage, _FinalStage { + private AgentThinkModelsV1ResponseModelsItemTwoId id; + + private String name; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentThinkModelsV1ResponseModelsItemTwo other) { + id(other.getId()); + name(other.getName()); + return this; + } + + /** + *

The unique identifier of the Google model

+ *

The unique identifier of the Google model

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

The display name of the model

+ *

The display name of the model

+ * @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 AgentThinkModelsV1ResponseModelsItemTwo build() { + return new AgentThinkModelsV1ResponseModelsItemTwo(id, name, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/AgentThinkModelsV1ResponseModelsItemTwoId.java b/src/main/java/com/deepgram/types/AgentThinkModelsV1ResponseModelsItemTwoId.java new file mode 100644 index 0000000..2141a58 --- /dev/null +++ b/src/main/java/com/deepgram/types/AgentThinkModelsV1ResponseModelsItemTwoId.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AgentThinkModelsV1ResponseModelsItemTwoId { + public static final AgentThinkModelsV1ResponseModelsItemTwoId GEMINI20FLASH_LITE = + new AgentThinkModelsV1ResponseModelsItemTwoId(Value.GEMINI20FLASH_LITE, "gemini-2.0-flash-lite"); + + public static final AgentThinkModelsV1ResponseModelsItemTwoId GEMINI25FLASH = + new AgentThinkModelsV1ResponseModelsItemTwoId(Value.GEMINI25FLASH, "gemini-2.5-flash"); + + public static final AgentThinkModelsV1ResponseModelsItemTwoId GEMINI20FLASH = + new AgentThinkModelsV1ResponseModelsItemTwoId(Value.GEMINI20FLASH, "gemini-2.0-flash"); + + private final Value value; + + private final String string; + + AgentThinkModelsV1ResponseModelsItemTwoId(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AgentThinkModelsV1ResponseModelsItemTwoId + && this.string.equals(((AgentThinkModelsV1ResponseModelsItemTwoId) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case GEMINI20FLASH_LITE: + return visitor.visitGemini20FlashLite(); + case GEMINI25FLASH: + return visitor.visitGemini25Flash(); + case GEMINI20FLASH: + return visitor.visitGemini20Flash(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AgentThinkModelsV1ResponseModelsItemTwoId valueOf(String value) { + switch (value) { + case "gemini-2.0-flash-lite": + return GEMINI20FLASH_LITE; + case "gemini-2.5-flash": + return GEMINI25FLASH; + case "gemini-2.0-flash": + return GEMINI20FLASH; + default: + return new AgentThinkModelsV1ResponseModelsItemTwoId(Value.UNKNOWN, value); + } + } + + public enum Value { + GEMINI25FLASH, + + GEMINI20FLASH, + + GEMINI20FLASH_LITE, + + UNKNOWN + } + + public interface Visitor { + T visitGemini25Flash(); + + T visitGemini20Flash(); + + T visitGemini20FlashLite(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/types/AgentThinkModelsV1ResponseModelsItemZero.java b/src/main/java/com/deepgram/types/AgentThinkModelsV1ResponseModelsItemZero.java new file mode 100644 index 0000000..e41781c --- /dev/null +++ b/src/main/java/com/deepgram/types/AgentThinkModelsV1ResponseModelsItemZero.java @@ -0,0 +1,172 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AgentThinkModelsV1ResponseModelsItemZero.Builder.class) +public final class AgentThinkModelsV1ResponseModelsItemZero { + private final AgentThinkModelsV1ResponseModelsItemZeroId id; + + private final String name; + + private final Map additionalProperties; + + private AgentThinkModelsV1ResponseModelsItemZero( + AgentThinkModelsV1ResponseModelsItemZeroId id, String name, Map additionalProperties) { + this.id = id; + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier of the OpenAI model + */ + @JsonProperty("id") + public AgentThinkModelsV1ResponseModelsItemZeroId getId() { + return id; + } + + /** + * @return The display name of the model + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return The provider of the model + */ + @JsonProperty("provider") + public String getProvider() { + return "open_ai"; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AgentThinkModelsV1ResponseModelsItemZero + && equalTo((AgentThinkModelsV1ResponseModelsItemZero) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AgentThinkModelsV1ResponseModelsItemZero other) { + return id.equals(other.id) && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

The unique identifier of the OpenAI model

+ */ + NameStage id(@NotNull AgentThinkModelsV1ResponseModelsItemZeroId id); + + Builder from(AgentThinkModelsV1ResponseModelsItemZero other); + } + + public interface NameStage { + /** + *

The display name of the model

+ */ + _FinalStage name(@NotNull String name); + } + + public interface _FinalStage { + AgentThinkModelsV1ResponseModelsItemZero build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, NameStage, _FinalStage { + private AgentThinkModelsV1ResponseModelsItemZeroId id; + + private String name; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AgentThinkModelsV1ResponseModelsItemZero other) { + id(other.getId()); + name(other.getName()); + return this; + } + + /** + *

The unique identifier of the OpenAI model

+ *

The unique identifier of the OpenAI model

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

The display name of the model

+ *

The display name of the model

+ * @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 AgentThinkModelsV1ResponseModelsItemZero build() { + return new AgentThinkModelsV1ResponseModelsItemZero(id, name, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/AgentThinkModelsV1ResponseModelsItemZeroId.java b/src/main/java/com/deepgram/types/AgentThinkModelsV1ResponseModelsItemZeroId.java new file mode 100644 index 0000000..1bab642 --- /dev/null +++ b/src/main/java/com/deepgram/types/AgentThinkModelsV1ResponseModelsItemZeroId.java @@ -0,0 +1,152 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AgentThinkModelsV1ResponseModelsItemZeroId { + public static final AgentThinkModelsV1ResponseModelsItemZeroId GPT5MINI = + new AgentThinkModelsV1ResponseModelsItemZeroId(Value.GPT5MINI, "gpt-5-mini"); + + public static final AgentThinkModelsV1ResponseModelsItemZeroId GPT4O_MINI = + new AgentThinkModelsV1ResponseModelsItemZeroId(Value.GPT4O_MINI, "gpt-4o-mini"); + + public static final AgentThinkModelsV1ResponseModelsItemZeroId GPT4O = + new AgentThinkModelsV1ResponseModelsItemZeroId(Value.GPT4O, "gpt-4o"); + + public static final AgentThinkModelsV1ResponseModelsItemZeroId GPT41NANO = + new AgentThinkModelsV1ResponseModelsItemZeroId(Value.GPT41NANO, "gpt-4.1-nano"); + + public static final AgentThinkModelsV1ResponseModelsItemZeroId GPT5 = + new AgentThinkModelsV1ResponseModelsItemZeroId(Value.GPT5, "gpt-5"); + + public static final AgentThinkModelsV1ResponseModelsItemZeroId GPT41MINI = + new AgentThinkModelsV1ResponseModelsItemZeroId(Value.GPT41MINI, "gpt-4.1-mini"); + + public static final AgentThinkModelsV1ResponseModelsItemZeroId GPT5NANO = + new AgentThinkModelsV1ResponseModelsItemZeroId(Value.GPT5NANO, "gpt-5-nano"); + + public static final AgentThinkModelsV1ResponseModelsItemZeroId GPT41 = + new AgentThinkModelsV1ResponseModelsItemZeroId(Value.GPT41, "gpt-4.1"); + + private final Value value; + + private final String string; + + AgentThinkModelsV1ResponseModelsItemZeroId(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof AgentThinkModelsV1ResponseModelsItemZeroId + && this.string.equals(((AgentThinkModelsV1ResponseModelsItemZeroId) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case GPT5MINI: + return visitor.visitGpt5Mini(); + case GPT4O_MINI: + return visitor.visitGpt4OMini(); + case GPT4O: + return visitor.visitGpt4O(); + case GPT41NANO: + return visitor.visitGpt41Nano(); + case GPT5: + return visitor.visitGpt5(); + case GPT41MINI: + return visitor.visitGpt41Mini(); + case GPT5NANO: + return visitor.visitGpt5Nano(); + case GPT41: + return visitor.visitGpt41(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AgentThinkModelsV1ResponseModelsItemZeroId valueOf(String value) { + switch (value) { + case "gpt-5-mini": + return GPT5MINI; + case "gpt-4o-mini": + return GPT4O_MINI; + case "gpt-4o": + return GPT4O; + case "gpt-4.1-nano": + return GPT41NANO; + case "gpt-5": + return GPT5; + case "gpt-4.1-mini": + return GPT41MINI; + case "gpt-5-nano": + return GPT5NANO; + case "gpt-4.1": + return GPT41; + default: + return new AgentThinkModelsV1ResponseModelsItemZeroId(Value.UNKNOWN, value); + } + } + + public enum Value { + GPT5, + + GPT5MINI, + + GPT5NANO, + + GPT41, + + GPT41MINI, + + GPT41NANO, + + GPT4O, + + GPT4O_MINI, + + UNKNOWN + } + + public interface Visitor { + T visitGpt5(); + + T visitGpt5Mini(); + + T visitGpt5Nano(); + + T visitGpt41(); + + T visitGpt41Mini(); + + T visitGpt41Nano(); + + T visitGpt4O(); + + T visitGpt4OMini(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/types/Anthropic.java b/src/main/java/com/deepgram/types/Anthropic.java new file mode 100644 index 0000000..9cb3fad --- /dev/null +++ b/src/main/java/com/deepgram/types/Anthropic.java @@ -0,0 +1,41 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.WrappedAlias; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class Anthropic implements WrappedAlias { + private final Object value; + + private Anthropic(Object value) { + this.value = value; + } + + @JsonValue + public Object get() { + return this.value; + } + + @java.lang.Override + public boolean equals(Object other) { + return this == other || (other instanceof Anthropic && this.value.equals(((Anthropic) other).value)); + } + + @java.lang.Override + public int hashCode() { + return value.hashCode(); + } + + @java.lang.Override + public String toString() { + return value.toString(); + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static Anthropic of(Object value) { + return new Anthropic(value); + } +} diff --git a/src/main/java/com/deepgram/types/AwsBedrockThinkProvider.java b/src/main/java/com/deepgram/types/AwsBedrockThinkProvider.java new file mode 100644 index 0000000..f66186e --- /dev/null +++ b/src/main/java/com/deepgram/types/AwsBedrockThinkProvider.java @@ -0,0 +1,43 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.WrappedAlias; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AwsBedrockThinkProvider implements WrappedAlias { + private final Object value; + + private AwsBedrockThinkProvider(Object value) { + this.value = value; + } + + @JsonValue + public Object get() { + return this.value; + } + + @java.lang.Override + public boolean equals(Object other) { + return this == other + || (other instanceof AwsBedrockThinkProvider + && this.value.equals(((AwsBedrockThinkProvider) other).value)); + } + + @java.lang.Override + public int hashCode() { + return value.hashCode(); + } + + @java.lang.Override + public String toString() { + return value.toString(); + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AwsBedrockThinkProvider of(Object value) { + return new AwsBedrockThinkProvider(value); + } +} diff --git a/src/main/java/com/deepgram/types/AwsPollySpeakProvider.java b/src/main/java/com/deepgram/types/AwsPollySpeakProvider.java new file mode 100644 index 0000000..ea8e77e --- /dev/null +++ b/src/main/java/com/deepgram/types/AwsPollySpeakProvider.java @@ -0,0 +1,42 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.WrappedAlias; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class AwsPollySpeakProvider implements WrappedAlias { + private final Object value; + + private AwsPollySpeakProvider(Object value) { + this.value = value; + } + + @JsonValue + public Object get() { + return this.value; + } + + @java.lang.Override + public boolean equals(Object other) { + return this == other + || (other instanceof AwsPollySpeakProvider && this.value.equals(((AwsPollySpeakProvider) other).value)); + } + + @java.lang.Override + public int hashCode() { + return value.hashCode(); + } + + @java.lang.Override + public String toString() { + return value.toString(); + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static AwsPollySpeakProvider of(Object value) { + return new AwsPollySpeakProvider(value); + } +} diff --git a/src/main/java/com/deepgram/types/BillingBreakdownV1Response.java b/src/main/java/com/deepgram/types/BillingBreakdownV1Response.java new file mode 100644 index 0000000..ecb9982 --- /dev/null +++ b/src/main/java/com/deepgram/types/BillingBreakdownV1Response.java @@ -0,0 +1,236 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = BillingBreakdownV1Response.Builder.class) +public final class BillingBreakdownV1Response { + private final String start; + + private final String end; + + private final BillingBreakdownV1ResponseResolution resolution; + + private final List results; + + private final Map additionalProperties; + + private BillingBreakdownV1Response( + String start, + String end, + BillingBreakdownV1ResponseResolution resolution, + List results, + Map additionalProperties) { + this.start = start; + this.end = end; + this.resolution = resolution; + this.results = results; + this.additionalProperties = additionalProperties; + } + + /** + * @return Start date of the billing summmary period + */ + @JsonProperty("start") + public String getStart() { + return start; + } + + /** + * @return End date of the billing summary period + */ + @JsonProperty("end") + public String getEnd() { + return end; + } + + @JsonProperty("resolution") + public BillingBreakdownV1ResponseResolution getResolution() { + return resolution; + } + + @JsonProperty("results") + public List getResults() { + return results; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BillingBreakdownV1Response && equalTo((BillingBreakdownV1Response) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(BillingBreakdownV1Response other) { + return start.equals(other.start) + && end.equals(other.end) + && resolution.equals(other.resolution) + && results.equals(other.results); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.start, this.end, this.resolution, this.results); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static StartStage builder() { + return new Builder(); + } + + public interface StartStage { + /** + *

Start date of the billing summmary period

+ */ + EndStage start(@NotNull String start); + + Builder from(BillingBreakdownV1Response other); + } + + public interface EndStage { + /** + *

End date of the billing summary period

+ */ + ResolutionStage end(@NotNull String end); + } + + public interface ResolutionStage { + _FinalStage resolution(@NotNull BillingBreakdownV1ResponseResolution resolution); + } + + public interface _FinalStage { + BillingBreakdownV1Response build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage results(List results); + + _FinalStage addResults(BillingBreakdownV1ResponseResultsItem results); + + _FinalStage addAllResults(List results); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements StartStage, EndStage, ResolutionStage, _FinalStage { + private String start; + + private String end; + + private BillingBreakdownV1ResponseResolution resolution; + + private List results = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(BillingBreakdownV1Response other) { + start(other.getStart()); + end(other.getEnd()); + resolution(other.getResolution()); + results(other.getResults()); + return this; + } + + /** + *

Start date of the billing summmary period

+ *

Start date of the billing summmary period

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

End date of the billing summary period

+ *

End date of the billing summary period

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("end") + public ResolutionStage end(@NotNull String end) { + this.end = Objects.requireNonNull(end, "end must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("resolution") + public _FinalStage resolution(@NotNull BillingBreakdownV1ResponseResolution resolution) { + this.resolution = Objects.requireNonNull(resolution, "resolution must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllResults(List results) { + if (results != null) { + this.results.addAll(results); + } + return this; + } + + @java.lang.Override + public _FinalStage addResults(BillingBreakdownV1ResponseResultsItem results) { + this.results.add(results); + return this; + } + + @java.lang.Override + @JsonSetter(value = "results", nulls = Nulls.SKIP) + public _FinalStage results(List results) { + this.results.clear(); + if (results != null) { + this.results.addAll(results); + } + return this; + } + + @java.lang.Override + public BillingBreakdownV1Response build() { + return new BillingBreakdownV1Response(start, end, resolution, results, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/BillingBreakdownV1ResponseResolution.java b/src/main/java/com/deepgram/types/BillingBreakdownV1ResponseResolution.java new file mode 100644 index 0000000..5527d1c --- /dev/null +++ b/src/main/java/com/deepgram/types/BillingBreakdownV1ResponseResolution.java @@ -0,0 +1,164 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = BillingBreakdownV1ResponseResolution.Builder.class) +public final class BillingBreakdownV1ResponseResolution { + private final String units; + + private final double amount; + + private final Map additionalProperties; + + private BillingBreakdownV1ResponseResolution( + String units, double amount, Map additionalProperties) { + this.units = units; + this.amount = amount; + this.additionalProperties = additionalProperties; + } + + /** + * @return Time unit for the resolution + */ + @JsonProperty("units") + public String getUnits() { + return units; + } + + /** + * @return Amount of units + */ + @JsonProperty("amount") + public double getAmount() { + return amount; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BillingBreakdownV1ResponseResolution + && equalTo((BillingBreakdownV1ResponseResolution) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(BillingBreakdownV1ResponseResolution other) { + return units.equals(other.units) && amount == other.amount; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.units, this.amount); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static UnitsStage builder() { + return new Builder(); + } + + public interface UnitsStage { + /** + *

Time unit for the resolution

+ */ + AmountStage units(@NotNull String units); + + Builder from(BillingBreakdownV1ResponseResolution other); + } + + public interface AmountStage { + /** + *

Amount of units

+ */ + _FinalStage amount(double amount); + } + + public interface _FinalStage { + BillingBreakdownV1ResponseResolution build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements UnitsStage, AmountStage, _FinalStage { + private String units; + + private double amount; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(BillingBreakdownV1ResponseResolution other) { + units(other.getUnits()); + amount(other.getAmount()); + return this; + } + + /** + *

Time unit for the resolution

+ *

Time unit for the resolution

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

Amount of units

+ *

Amount of units

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public _FinalStage amount(double amount) { + this.amount = amount; + return this; + } + + @java.lang.Override + public BillingBreakdownV1ResponseResolution build() { + return new BillingBreakdownV1ResponseResolution(units, amount, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/BillingBreakdownV1ResponseResultsItem.java b/src/main/java/com/deepgram/types/BillingBreakdownV1ResponseResultsItem.java new file mode 100644 index 0000000..7927fe8 --- /dev/null +++ b/src/main/java/com/deepgram/types/BillingBreakdownV1ResponseResultsItem.java @@ -0,0 +1,155 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = BillingBreakdownV1ResponseResultsItem.Builder.class) +public final class BillingBreakdownV1ResponseResultsItem { + private final float dollars; + + private final BillingBreakdownV1ResponseResultsItemGrouping grouping; + + private final Map additionalProperties; + + private BillingBreakdownV1ResponseResultsItem( + float dollars, + BillingBreakdownV1ResponseResultsItemGrouping grouping, + Map additionalProperties) { + this.dollars = dollars; + this.grouping = grouping; + this.additionalProperties = additionalProperties; + } + + /** + * @return USD cost of the billing for this grouping + */ + @JsonProperty("dollars") + public float getDollars() { + return dollars; + } + + @JsonProperty("grouping") + public BillingBreakdownV1ResponseResultsItemGrouping getGrouping() { + return grouping; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BillingBreakdownV1ResponseResultsItem + && equalTo((BillingBreakdownV1ResponseResultsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(BillingBreakdownV1ResponseResultsItem other) { + return dollars == other.dollars && grouping.equals(other.grouping); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.dollars, this.grouping); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DollarsStage builder() { + return new Builder(); + } + + public interface DollarsStage { + /** + *

USD cost of the billing for this grouping

+ */ + GroupingStage dollars(float dollars); + + Builder from(BillingBreakdownV1ResponseResultsItem other); + } + + public interface GroupingStage { + _FinalStage grouping(@NotNull BillingBreakdownV1ResponseResultsItemGrouping grouping); + } + + public interface _FinalStage { + BillingBreakdownV1ResponseResultsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DollarsStage, GroupingStage, _FinalStage { + private float dollars; + + private BillingBreakdownV1ResponseResultsItemGrouping grouping; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(BillingBreakdownV1ResponseResultsItem other) { + dollars(other.getDollars()); + grouping(other.getGrouping()); + return this; + } + + /** + *

USD cost of the billing for this grouping

+ *

USD cost of the billing for this grouping

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("dollars") + public GroupingStage dollars(float dollars) { + this.dollars = dollars; + return this; + } + + @java.lang.Override + @JsonSetter("grouping") + public _FinalStage grouping(@NotNull BillingBreakdownV1ResponseResultsItemGrouping grouping) { + this.grouping = Objects.requireNonNull(grouping, "grouping must not be null"); + return this; + } + + @java.lang.Override + public BillingBreakdownV1ResponseResultsItem build() { + return new BillingBreakdownV1ResponseResultsItem(dollars, grouping, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/BillingBreakdownV1ResponseResultsItemGrouping.java b/src/main/java/com/deepgram/types/BillingBreakdownV1ResponseResultsItemGrouping.java new file mode 100644 index 0000000..afd1800 --- /dev/null +++ b/src/main/java/com/deepgram/types/BillingBreakdownV1ResponseResultsItemGrouping.java @@ -0,0 +1,266 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = BillingBreakdownV1ResponseResultsItemGrouping.Builder.class) +public final class BillingBreakdownV1ResponseResultsItemGrouping { + private final Optional start; + + private final Optional end; + + private final Optional accessor; + + private final Optional deployment; + + private final Optional lineItem; + + private final Optional> tags; + + private final Map additionalProperties; + + private BillingBreakdownV1ResponseResultsItemGrouping( + Optional start, + Optional end, + Optional accessor, + Optional deployment, + Optional lineItem, + Optional> tags, + Map additionalProperties) { + this.start = start; + this.end = end; + this.accessor = accessor; + this.deployment = deployment; + this.lineItem = lineItem; + this.tags = tags; + this.additionalProperties = additionalProperties; + } + + /** + * @return Start date for this group + */ + @JsonProperty("start") + public Optional getStart() { + return start; + } + + /** + * @return End date for this group + */ + @JsonProperty("end") + public Optional getEnd() { + return end; + } + + /** + * @return Optional accessor identifier, null unless grouped by accessor. + */ + @JsonProperty("accessor") + public Optional getAccessor() { + return accessor; + } + + /** + * @return Optional deployment identifier, null unless grouped by deployment. + */ + @JsonProperty("deployment") + public Optional getDeployment() { + return deployment; + } + + /** + * @return Optional line item identifier, null unless grouped by line item. + */ + @JsonProperty("line_item") + public Optional getLineItem() { + return lineItem; + } + + /** + * @return Optional list of tags, null unless grouped by tags. + */ + @JsonProperty("tags") + public Optional> getTags() { + return tags; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BillingBreakdownV1ResponseResultsItemGrouping + && equalTo((BillingBreakdownV1ResponseResultsItemGrouping) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(BillingBreakdownV1ResponseResultsItemGrouping other) { + return start.equals(other.start) + && end.equals(other.end) + && accessor.equals(other.accessor) + && deployment.equals(other.deployment) + && lineItem.equals(other.lineItem) + && tags.equals(other.tags); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.start, this.end, this.accessor, this.deployment, this.lineItem, this.tags); + } + + @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 start = Optional.empty(); + + private Optional end = Optional.empty(); + + private Optional accessor = Optional.empty(); + + private Optional deployment = Optional.empty(); + + private Optional lineItem = Optional.empty(); + + private Optional> tags = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(BillingBreakdownV1ResponseResultsItemGrouping other) { + start(other.getStart()); + end(other.getEnd()); + accessor(other.getAccessor()); + deployment(other.getDeployment()); + lineItem(other.getLineItem()); + tags(other.getTags()); + return this; + } + + /** + *

Start date for this group

+ */ + @JsonSetter(value = "start", nulls = Nulls.SKIP) + public Builder start(Optional start) { + this.start = start; + return this; + } + + public Builder start(String start) { + this.start = Optional.ofNullable(start); + return this; + } + + /** + *

End date for this group

+ */ + @JsonSetter(value = "end", nulls = Nulls.SKIP) + public Builder end(Optional end) { + this.end = end; + return this; + } + + public Builder end(String end) { + this.end = Optional.ofNullable(end); + return this; + } + + /** + *

Optional accessor identifier, null unless grouped by accessor.

+ */ + @JsonSetter(value = "accessor", nulls = Nulls.SKIP) + public Builder accessor(Optional accessor) { + this.accessor = accessor; + return this; + } + + public Builder accessor(String accessor) { + this.accessor = Optional.ofNullable(accessor); + return this; + } + + /** + *

Optional deployment identifier, null unless grouped by deployment.

+ */ + @JsonSetter(value = "deployment", nulls = Nulls.SKIP) + public Builder deployment(Optional deployment) { + this.deployment = deployment; + return this; + } + + public Builder deployment(String deployment) { + this.deployment = Optional.ofNullable(deployment); + return this; + } + + /** + *

Optional line item identifier, null unless grouped by line item.

+ */ + @JsonSetter(value = "line_item", nulls = Nulls.SKIP) + public Builder lineItem(Optional lineItem) { + this.lineItem = lineItem; + return this; + } + + public Builder lineItem(String lineItem) { + this.lineItem = Optional.ofNullable(lineItem); + return this; + } + + /** + *

Optional list of tags, null unless grouped by tags.

+ */ + @JsonSetter(value = "tags", nulls = Nulls.SKIP) + public Builder tags(Optional> tags) { + this.tags = tags; + return this; + } + + public Builder tags(List tags) { + this.tags = Optional.ofNullable(tags); + return this; + } + + public BillingBreakdownV1ResponseResultsItemGrouping build() { + return new BillingBreakdownV1ResponseResultsItemGrouping( + start, end, accessor, deployment, lineItem, tags, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/Cartesia.java b/src/main/java/com/deepgram/types/Cartesia.java new file mode 100644 index 0000000..a223933 --- /dev/null +++ b/src/main/java/com/deepgram/types/Cartesia.java @@ -0,0 +1,41 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.WrappedAlias; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class Cartesia implements WrappedAlias { + private final Object value; + + private Cartesia(Object value) { + this.value = value; + } + + @JsonValue + public Object get() { + return this.value; + } + + @java.lang.Override + public boolean equals(Object other) { + return this == other || (other instanceof Cartesia && this.value.equals(((Cartesia) other).value)); + } + + @java.lang.Override + public int hashCode() { + return value.hashCode(); + } + + @java.lang.Override + public String toString() { + return value.toString(); + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static Cartesia of(Object value) { + return new Cartesia(value); + } +} diff --git a/src/main/java/com/deepgram/types/CreateKeyV1RequestOne.java b/src/main/java/com/deepgram/types/CreateKeyV1RequestOne.java new file mode 100644 index 0000000..39c7538 --- /dev/null +++ b/src/main/java/com/deepgram/types/CreateKeyV1RequestOne.java @@ -0,0 +1,42 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.WrappedAlias; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class CreateKeyV1RequestOne implements WrappedAlias { + private final Object value; + + private CreateKeyV1RequestOne(Object value) { + this.value = value; + } + + @JsonValue + public Object get() { + return this.value; + } + + @java.lang.Override + public boolean equals(Object other) { + return this == other + || (other instanceof CreateKeyV1RequestOne && this.value.equals(((CreateKeyV1RequestOne) other).value)); + } + + @java.lang.Override + public int hashCode() { + return value.hashCode(); + } + + @java.lang.Override + public String toString() { + return value.toString(); + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static CreateKeyV1RequestOne of(Object value) { + return new CreateKeyV1RequestOne(value); + } +} diff --git a/src/main/java/com/deepgram/types/CreateKeyV1Response.java b/src/main/java/com/deepgram/types/CreateKeyV1Response.java new file mode 100644 index 0000000..b42a780 --- /dev/null +++ b/src/main/java/com/deepgram/types/CreateKeyV1Response.java @@ -0,0 +1,265 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.time.OffsetDateTime; +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 = CreateKeyV1Response.Builder.class) +public final class CreateKeyV1Response { + private final Optional apiKeyId; + + private final Optional key; + + private final Optional comment; + + private final Optional> scopes; + + private final Optional> tags; + + private final Optional expirationDate; + + private final Map additionalProperties; + + private CreateKeyV1Response( + Optional apiKeyId, + Optional key, + Optional comment, + Optional> scopes, + Optional> tags, + Optional expirationDate, + Map additionalProperties) { + this.apiKeyId = apiKeyId; + this.key = key; + this.comment = comment; + this.scopes = scopes; + this.tags = tags; + this.expirationDate = expirationDate; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier of the API key + */ + @JsonProperty("api_key_id") + public Optional getApiKeyId() { + return apiKeyId; + } + + /** + * @return The API key + */ + @JsonProperty("key") + public Optional getKey() { + return key; + } + + /** + * @return A comment for the API key + */ + @JsonProperty("comment") + public Optional getComment() { + return comment; + } + + /** + * @return The scopes for the API key + */ + @JsonProperty("scopes") + public Optional> getScopes() { + return scopes; + } + + /** + * @return The tags for the API key + */ + @JsonProperty("tags") + public Optional> getTags() { + return tags; + } + + /** + * @return The expiration date of the API key + */ + @JsonProperty("expiration_date") + public Optional getExpirationDate() { + return expirationDate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateKeyV1Response && equalTo((CreateKeyV1Response) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateKeyV1Response other) { + return apiKeyId.equals(other.apiKeyId) + && key.equals(other.key) + && comment.equals(other.comment) + && scopes.equals(other.scopes) + && tags.equals(other.tags) + && expirationDate.equals(other.expirationDate); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKeyId, this.key, this.comment, this.scopes, this.tags, this.expirationDate); + } + + @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 apiKeyId = Optional.empty(); + + private Optional key = Optional.empty(); + + private Optional comment = Optional.empty(); + + private Optional> scopes = Optional.empty(); + + private Optional> tags = Optional.empty(); + + private Optional expirationDate = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateKeyV1Response other) { + apiKeyId(other.getApiKeyId()); + key(other.getKey()); + comment(other.getComment()); + scopes(other.getScopes()); + tags(other.getTags()); + expirationDate(other.getExpirationDate()); + return this; + } + + /** + *

The unique identifier of the API key

+ */ + @JsonSetter(value = "api_key_id", nulls = Nulls.SKIP) + public Builder apiKeyId(Optional apiKeyId) { + this.apiKeyId = apiKeyId; + return this; + } + + public Builder apiKeyId(String apiKeyId) { + this.apiKeyId = Optional.ofNullable(apiKeyId); + return this; + } + + /** + *

The API key

+ */ + @JsonSetter(value = "key", nulls = Nulls.SKIP) + public Builder key(Optional key) { + this.key = key; + return this; + } + + public Builder key(String key) { + this.key = Optional.ofNullable(key); + return this; + } + + /** + *

A comment for the API key

+ */ + @JsonSetter(value = "comment", nulls = Nulls.SKIP) + public Builder comment(Optional comment) { + this.comment = comment; + return this; + } + + public Builder comment(String comment) { + this.comment = Optional.ofNullable(comment); + return this; + } + + /** + *

The scopes for the API key

+ */ + @JsonSetter(value = "scopes", nulls = Nulls.SKIP) + public Builder scopes(Optional> scopes) { + this.scopes = scopes; + return this; + } + + public Builder scopes(List scopes) { + this.scopes = Optional.ofNullable(scopes); + return this; + } + + /** + *

The tags for the API key

+ */ + @JsonSetter(value = "tags", nulls = Nulls.SKIP) + public Builder tags(Optional> tags) { + this.tags = tags; + return this; + } + + public Builder tags(List tags) { + this.tags = Optional.ofNullable(tags); + return this; + } + + /** + *

The expiration date of the API key

+ */ + @JsonSetter(value = "expiration_date", nulls = Nulls.SKIP) + public Builder expirationDate(Optional expirationDate) { + this.expirationDate = expirationDate; + return this; + } + + public Builder expirationDate(OffsetDateTime expirationDate) { + this.expirationDate = Optional.ofNullable(expirationDate); + return this; + } + + public CreateKeyV1Response build() { + return new CreateKeyV1Response(apiKeyId, key, comment, scopes, tags, expirationDate, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/CreateProjectDistributionCredentialsV1Response.java b/src/main/java/com/deepgram/types/CreateProjectDistributionCredentialsV1Response.java new file mode 100644 index 0000000..e203de5 --- /dev/null +++ b/src/main/java/com/deepgram/types/CreateProjectDistributionCredentialsV1Response.java @@ -0,0 +1,150 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateProjectDistributionCredentialsV1Response.Builder.class) +public final class CreateProjectDistributionCredentialsV1Response { + private final CreateProjectDistributionCredentialsV1ResponseMember member; + + private final CreateProjectDistributionCredentialsV1ResponseDistributionCredentials distributionCredentials; + + private final Map additionalProperties; + + private CreateProjectDistributionCredentialsV1Response( + CreateProjectDistributionCredentialsV1ResponseMember member, + CreateProjectDistributionCredentialsV1ResponseDistributionCredentials distributionCredentials, + Map additionalProperties) { + this.member = member; + this.distributionCredentials = distributionCredentials; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("member") + public CreateProjectDistributionCredentialsV1ResponseMember getMember() { + return member; + } + + @JsonProperty("distribution_credentials") + public CreateProjectDistributionCredentialsV1ResponseDistributionCredentials getDistributionCredentials() { + return distributionCredentials; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateProjectDistributionCredentialsV1Response + && equalTo((CreateProjectDistributionCredentialsV1Response) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateProjectDistributionCredentialsV1Response other) { + return member.equals(other.member) && distributionCredentials.equals(other.distributionCredentials); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.member, this.distributionCredentials); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static MemberStage builder() { + return new Builder(); + } + + public interface MemberStage { + DistributionCredentialsStage member(@NotNull CreateProjectDistributionCredentialsV1ResponseMember member); + + Builder from(CreateProjectDistributionCredentialsV1Response other); + } + + public interface DistributionCredentialsStage { + _FinalStage distributionCredentials( + @NotNull CreateProjectDistributionCredentialsV1ResponseDistributionCredentials distributionCredentials); + } + + public interface _FinalStage { + CreateProjectDistributionCredentialsV1Response build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements MemberStage, DistributionCredentialsStage, _FinalStage { + private CreateProjectDistributionCredentialsV1ResponseMember member; + + private CreateProjectDistributionCredentialsV1ResponseDistributionCredentials distributionCredentials; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateProjectDistributionCredentialsV1Response other) { + member(other.getMember()); + distributionCredentials(other.getDistributionCredentials()); + return this; + } + + @java.lang.Override + @JsonSetter("member") + public DistributionCredentialsStage member( + @NotNull CreateProjectDistributionCredentialsV1ResponseMember member) { + this.member = Objects.requireNonNull(member, "member must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("distribution_credentials") + public _FinalStage distributionCredentials( + @NotNull + CreateProjectDistributionCredentialsV1ResponseDistributionCredentials distributionCredentials) { + this.distributionCredentials = + Objects.requireNonNull(distributionCredentials, "distributionCredentials must not be null"); + return this; + } + + @java.lang.Override + public CreateProjectDistributionCredentialsV1Response build() { + return new CreateProjectDistributionCredentialsV1Response( + member, distributionCredentials, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/CreateProjectDistributionCredentialsV1ResponseDistributionCredentials.java b/src/main/java/com/deepgram/types/CreateProjectDistributionCredentialsV1ResponseDistributionCredentials.java new file mode 100644 index 0000000..a8fe5af --- /dev/null +++ b/src/main/java/com/deepgram/types/CreateProjectDistributionCredentialsV1ResponseDistributionCredentials.java @@ -0,0 +1,313 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = CreateProjectDistributionCredentialsV1ResponseDistributionCredentials.Builder.class) +public final class CreateProjectDistributionCredentialsV1ResponseDistributionCredentials { + private final String distributionCredentialsId; + + private final String provider; + + private final Optional comment; + + private final List scopes; + + private final OffsetDateTime created; + + private final Map additionalProperties; + + private CreateProjectDistributionCredentialsV1ResponseDistributionCredentials( + String distributionCredentialsId, + String provider, + Optional comment, + List scopes, + OffsetDateTime created, + Map additionalProperties) { + this.distributionCredentialsId = distributionCredentialsId; + this.provider = provider; + this.comment = comment; + this.scopes = scopes; + this.created = created; + this.additionalProperties = additionalProperties; + } + + /** + * @return Unique identifier for the distribution credentials + */ + @JsonProperty("distribution_credentials_id") + public String getDistributionCredentialsId() { + return distributionCredentialsId; + } + + /** + * @return The provider of the distribution service + */ + @JsonProperty("provider") + public String getProvider() { + return provider; + } + + /** + * @return Optional comment about the credentials + */ + @JsonProperty("comment") + public Optional getComment() { + return comment; + } + + /** + * @return List of permission scopes for the credentials + */ + @JsonProperty("scopes") + public List getScopes() { + return scopes; + } + + /** + * @return Timestamp when the credentials were created + */ + @JsonProperty("created") + public OffsetDateTime getCreated() { + return created; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateProjectDistributionCredentialsV1ResponseDistributionCredentials + && equalTo((CreateProjectDistributionCredentialsV1ResponseDistributionCredentials) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateProjectDistributionCredentialsV1ResponseDistributionCredentials other) { + return distributionCredentialsId.equals(other.distributionCredentialsId) + && provider.equals(other.provider) + && comment.equals(other.comment) + && scopes.equals(other.scopes) + && created.equals(other.created); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.distributionCredentialsId, this.provider, this.comment, this.scopes, this.created); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DistributionCredentialsIdStage builder() { + return new Builder(); + } + + public interface DistributionCredentialsIdStage { + /** + *

Unique identifier for the distribution credentials

+ */ + ProviderStage distributionCredentialsId(@NotNull String distributionCredentialsId); + + Builder from(CreateProjectDistributionCredentialsV1ResponseDistributionCredentials other); + } + + public interface ProviderStage { + /** + *

The provider of the distribution service

+ */ + CreatedStage provider(@NotNull String provider); + } + + public interface CreatedStage { + /** + *

Timestamp when the credentials were created

+ */ + _FinalStage created(@NotNull OffsetDateTime created); + } + + public interface _FinalStage { + CreateProjectDistributionCredentialsV1ResponseDistributionCredentials build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Optional comment about the credentials

+ */ + _FinalStage comment(Optional comment); + + _FinalStage comment(String comment); + + /** + *

List of permission scopes for the credentials

+ */ + _FinalStage scopes(List scopes); + + _FinalStage addScopes(String scopes); + + _FinalStage addAllScopes(List scopes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements DistributionCredentialsIdStage, ProviderStage, CreatedStage, _FinalStage { + private String distributionCredentialsId; + + private String provider; + + private OffsetDateTime created; + + private List scopes = new ArrayList<>(); + + private Optional comment = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateProjectDistributionCredentialsV1ResponseDistributionCredentials other) { + distributionCredentialsId(other.getDistributionCredentialsId()); + provider(other.getProvider()); + comment(other.getComment()); + scopes(other.getScopes()); + created(other.getCreated()); + return this; + } + + /** + *

Unique identifier for the distribution credentials

+ *

Unique identifier for the distribution credentials

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

The provider of the distribution service

+ *

The provider of the distribution service

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

Timestamp when the credentials were created

+ *

Timestamp when the credentials were created

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

List of permission scopes for the credentials

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllScopes(List scopes) { + if (scopes != null) { + this.scopes.addAll(scopes); + } + return this; + } + + /** + *

List of permission scopes for the credentials

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addScopes(String scopes) { + this.scopes.add(scopes); + return this; + } + + /** + *

List of permission scopes for the credentials

+ */ + @java.lang.Override + @JsonSetter(value = "scopes", nulls = Nulls.SKIP) + public _FinalStage scopes(List scopes) { + this.scopes.clear(); + if (scopes != null) { + this.scopes.addAll(scopes); + } + return this; + } + + /** + *

Optional comment about the credentials

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage comment(String comment) { + this.comment = Optional.ofNullable(comment); + return this; + } + + /** + *

Optional comment about the credentials

+ */ + @java.lang.Override + @JsonSetter(value = "comment", nulls = Nulls.SKIP) + public _FinalStage comment(Optional comment) { + this.comment = comment; + return this; + } + + @java.lang.Override + public CreateProjectDistributionCredentialsV1ResponseDistributionCredentials build() { + return new CreateProjectDistributionCredentialsV1ResponseDistributionCredentials( + distributionCredentialsId, provider, comment, scopes, created, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/CreateProjectDistributionCredentialsV1ResponseMember.java b/src/main/java/com/deepgram/types/CreateProjectDistributionCredentialsV1ResponseMember.java new file mode 100644 index 0000000..4c7468c --- /dev/null +++ b/src/main/java/com/deepgram/types/CreateProjectDistributionCredentialsV1ResponseMember.java @@ -0,0 +1,164 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateProjectDistributionCredentialsV1ResponseMember.Builder.class) +public final class CreateProjectDistributionCredentialsV1ResponseMember { + private final String memberId; + + private final String email; + + private final Map additionalProperties; + + private CreateProjectDistributionCredentialsV1ResponseMember( + String memberId, String email, Map additionalProperties) { + this.memberId = memberId; + this.email = email; + this.additionalProperties = additionalProperties; + } + + /** + * @return Unique identifier for the member + */ + @JsonProperty("member_id") + public String getMemberId() { + return memberId; + } + + /** + * @return Email address of the member + */ + @JsonProperty("email") + public String getEmail() { + return email; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateProjectDistributionCredentialsV1ResponseMember + && equalTo((CreateProjectDistributionCredentialsV1ResponseMember) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateProjectDistributionCredentialsV1ResponseMember other) { + return memberId.equals(other.memberId) && email.equals(other.email); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.memberId, this.email); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static MemberIdStage builder() { + return new Builder(); + } + + public interface MemberIdStage { + /** + *

Unique identifier for the member

+ */ + EmailStage memberId(@NotNull String memberId); + + Builder from(CreateProjectDistributionCredentialsV1ResponseMember other); + } + + public interface EmailStage { + /** + *

Email address of the member

+ */ + _FinalStage email(@NotNull String email); + } + + public interface _FinalStage { + CreateProjectDistributionCredentialsV1ResponseMember build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements MemberIdStage, EmailStage, _FinalStage { + private String memberId; + + private String email; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateProjectDistributionCredentialsV1ResponseMember other) { + memberId(other.getMemberId()); + email(other.getEmail()); + return this; + } + + /** + *

Unique identifier for the member

+ *

Unique identifier for the member

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

Email address of the member

+ *

Email address of the member

+ * @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; + } + + @java.lang.Override + public CreateProjectDistributionCredentialsV1ResponseMember build() { + return new CreateProjectDistributionCredentialsV1ResponseMember(memberId, email, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/CreateProjectInviteV1Response.java b/src/main/java/com/deepgram/types/CreateProjectInviteV1Response.java new file mode 100644 index 0000000..ea23219 --- /dev/null +++ b/src/main/java/com/deepgram/types/CreateProjectInviteV1Response.java @@ -0,0 +1,111 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateProjectInviteV1Response.Builder.class) +public final class CreateProjectInviteV1Response { + private final Optional message; + + private final Map additionalProperties; + + private CreateProjectInviteV1Response(Optional message, Map additionalProperties) { + this.message = message; + this.additionalProperties = additionalProperties; + } + + /** + * @return confirmation message + */ + @JsonProperty("message") + public Optional getMessage() { + return message; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateProjectInviteV1Response && equalTo((CreateProjectInviteV1Response) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateProjectInviteV1Response 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 Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional message = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateProjectInviteV1Response other) { + message(other.getMessage()); + return this; + } + + /** + *

confirmation message

+ */ + @JsonSetter(value = "message", nulls = Nulls.SKIP) + public Builder message(Optional message) { + this.message = message; + return this; + } + + public Builder message(String message) { + this.message = Optional.ofNullable(message); + return this; + } + + public CreateProjectInviteV1Response build() { + return new CreateProjectInviteV1Response(message, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/Deepgram.java b/src/main/java/com/deepgram/types/Deepgram.java new file mode 100644 index 0000000..75bf033 --- /dev/null +++ b/src/main/java/com/deepgram/types/Deepgram.java @@ -0,0 +1,41 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.WrappedAlias; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class Deepgram implements WrappedAlias { + private final Object value; + + private Deepgram(Object value) { + this.value = value; + } + + @JsonValue + public Object get() { + return this.value; + } + + @java.lang.Override + public boolean equals(Object other) { + return this == other || (other instanceof Deepgram && this.value.equals(((Deepgram) other).value)); + } + + @java.lang.Override + public int hashCode() { + return value.hashCode(); + } + + @java.lang.Override + public String toString() { + return value.toString(); + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static Deepgram of(Object value) { + return new Deepgram(value); + } +} diff --git a/src/main/java/com/deepgram/types/DeleteProjectInviteV1Response.java b/src/main/java/com/deepgram/types/DeleteProjectInviteV1Response.java new file mode 100644 index 0000000..def781c --- /dev/null +++ b/src/main/java/com/deepgram/types/DeleteProjectInviteV1Response.java @@ -0,0 +1,111 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteProjectInviteV1Response.Builder.class) +public final class DeleteProjectInviteV1Response { + private final Optional message; + + private final Map additionalProperties; + + private DeleteProjectInviteV1Response(Optional message, Map additionalProperties) { + this.message = message; + this.additionalProperties = additionalProperties; + } + + /** + * @return confirmation message + */ + @JsonProperty("message") + public Optional getMessage() { + return message; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteProjectInviteV1Response && equalTo((DeleteProjectInviteV1Response) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeleteProjectInviteV1Response 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 Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional message = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeleteProjectInviteV1Response other) { + message(other.getMessage()); + return this; + } + + /** + *

confirmation message

+ */ + @JsonSetter(value = "message", nulls = Nulls.SKIP) + public Builder message(Optional message) { + this.message = message; + return this; + } + + public Builder message(String message) { + this.message = Optional.ofNullable(message); + return this; + } + + public DeleteProjectInviteV1Response build() { + return new DeleteProjectInviteV1Response(message, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/DeleteProjectKeyV1Response.java b/src/main/java/com/deepgram/types/DeleteProjectKeyV1Response.java new file mode 100644 index 0000000..43281bf --- /dev/null +++ b/src/main/java/com/deepgram/types/DeleteProjectKeyV1Response.java @@ -0,0 +1,105 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteProjectKeyV1Response.Builder.class) +public final class DeleteProjectKeyV1Response { + private final Optional message; + + private final Map additionalProperties; + + private DeleteProjectKeyV1Response(Optional message, Map additionalProperties) { + this.message = message; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("message") + public Optional getMessage() { + return message; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteProjectKeyV1Response && equalTo((DeleteProjectKeyV1Response) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeleteProjectKeyV1Response 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 Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional message = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeleteProjectKeyV1Response other) { + message(other.getMessage()); + return this; + } + + @JsonSetter(value = "message", nulls = Nulls.SKIP) + public Builder message(Optional message) { + this.message = message; + return this; + } + + public Builder message(String message) { + this.message = Optional.ofNullable(message); + return this; + } + + public DeleteProjectKeyV1Response build() { + return new DeleteProjectKeyV1Response(message, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/DeleteProjectMemberV1Response.java b/src/main/java/com/deepgram/types/DeleteProjectMemberV1Response.java new file mode 100644 index 0000000..84fe9b7 --- /dev/null +++ b/src/main/java/com/deepgram/types/DeleteProjectMemberV1Response.java @@ -0,0 +1,111 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteProjectMemberV1Response.Builder.class) +public final class DeleteProjectMemberV1Response { + private final Optional message; + + private final Map additionalProperties; + + private DeleteProjectMemberV1Response(Optional message, Map additionalProperties) { + this.message = message; + this.additionalProperties = additionalProperties; + } + + /** + * @return confirmation message + */ + @JsonProperty("message") + public Optional getMessage() { + return message; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteProjectMemberV1Response && equalTo((DeleteProjectMemberV1Response) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeleteProjectMemberV1Response 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 Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional message = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeleteProjectMemberV1Response other) { + message(other.getMessage()); + return this; + } + + /** + *

confirmation message

+ */ + @JsonSetter(value = "message", nulls = Nulls.SKIP) + public Builder message(Optional message) { + this.message = message; + return this; + } + + public Builder message(String message) { + this.message = Optional.ofNullable(message); + return this; + } + + public DeleteProjectMemberV1Response build() { + return new DeleteProjectMemberV1Response(message, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/DeleteProjectV1Response.java b/src/main/java/com/deepgram/types/DeleteProjectV1Response.java new file mode 100644 index 0000000..3842ab7 --- /dev/null +++ b/src/main/java/com/deepgram/types/DeleteProjectV1Response.java @@ -0,0 +1,111 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteProjectV1Response.Builder.class) +public final class DeleteProjectV1Response { + private final Optional message; + + private final Map additionalProperties; + + private DeleteProjectV1Response(Optional message, Map additionalProperties) { + this.message = message; + this.additionalProperties = additionalProperties; + } + + /** + * @return Confirmation message + */ + @JsonProperty("message") + public Optional getMessage() { + return message; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteProjectV1Response && equalTo((DeleteProjectV1Response) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeleteProjectV1Response 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 Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional message = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeleteProjectV1Response other) { + message(other.getMessage()); + return this; + } + + /** + *

Confirmation message

+ */ + @JsonSetter(value = "message", nulls = Nulls.SKIP) + public Builder message(Optional message) { + this.message = message; + return this; + } + + public Builder message(String message) { + this.message = Optional.ofNullable(message); + return this; + } + + public DeleteProjectV1Response build() { + return new DeleteProjectV1Response(message, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ElevenLabsSpeakProvider.java b/src/main/java/com/deepgram/types/ElevenLabsSpeakProvider.java new file mode 100644 index 0000000..8dc5a3f --- /dev/null +++ b/src/main/java/com/deepgram/types/ElevenLabsSpeakProvider.java @@ -0,0 +1,43 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.WrappedAlias; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ElevenLabsSpeakProvider implements WrappedAlias { + private final Object value; + + private ElevenLabsSpeakProvider(Object value) { + this.value = value; + } + + @JsonValue + public Object get() { + return this.value; + } + + @java.lang.Override + public boolean equals(Object other) { + return this == other + || (other instanceof ElevenLabsSpeakProvider + && this.value.equals(((ElevenLabsSpeakProvider) other).value)); + } + + @java.lang.Override + public int hashCode() { + return value.hashCode(); + } + + @java.lang.Override + public String toString() { + return value.toString(); + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ElevenLabsSpeakProvider of(Object value) { + return new ElevenLabsSpeakProvider(value); + } +} diff --git a/src/main/java/com/deepgram/types/ErrorResponse.java b/src/main/java/com/deepgram/types/ErrorResponse.java new file mode 100644 index 0000000..7c6c796 --- /dev/null +++ b/src/main/java/com/deepgram/types/ErrorResponse.java @@ -0,0 +1,107 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +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 java.io.IOException; +import java.util.Objects; + +@JsonDeserialize(using = ErrorResponse.Deserializer.class) +public final class ErrorResponse { + private final Object value; + + private final int type; + + private ErrorResponse(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + @SuppressWarnings("unchecked") + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((String) this.value); + } else if (this.type == 1) { + return visitor.visit((ErrorResponseLegacyError) this.value); + } else if (this.type == 2) { + return visitor.visit((ErrorResponseModernError) 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 ErrorResponse && equalTo((ErrorResponse) other); + } + + private boolean equalTo(ErrorResponse 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 ErrorResponse of(String value) { + return new ErrorResponse(value, 0); + } + + public static ErrorResponse of(ErrorResponseLegacyError value) { + return new ErrorResponse(value, 1); + } + + public static ErrorResponse of(ErrorResponseModernError value) { + return new ErrorResponse(value, 2); + } + + public interface Visitor { + T visit(String value); + + T visit(ErrorResponseLegacyError value); + + T visit(ErrorResponseModernError value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(ErrorResponse.class); + } + + @java.lang.Override + public ErrorResponse deserialize(JsonParser p, DeserializationContext context) throws IOException { + Object value = p.readValueAs(Object.class); + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, String.class)); + } catch (RuntimeException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, ErrorResponseLegacyError.class)); + } catch (RuntimeException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, ErrorResponseModernError.class)); + } catch (RuntimeException e) { + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/deepgram/types/ErrorResponseLegacyError.java b/src/main/java/com/deepgram/types/ErrorResponseLegacyError.java new file mode 100644 index 0000000..29aa12d --- /dev/null +++ b/src/main/java/com/deepgram/types/ErrorResponseLegacyError.java @@ -0,0 +1,171 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ErrorResponseLegacyError.Builder.class) +public final class ErrorResponseLegacyError { + private final Optional errCode; + + private final Optional errMsg; + + private final Optional requestId; + + private final Map additionalProperties; + + private ErrorResponseLegacyError( + Optional errCode, + Optional errMsg, + Optional requestId, + Map additionalProperties) { + this.errCode = errCode; + this.errMsg = errMsg; + this.requestId = requestId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The error code + */ + @JsonProperty("err_code") + public Optional getErrCode() { + return errCode; + } + + /** + * @return The error message + */ + @JsonProperty("err_msg") + public Optional getErrMsg() { + return errMsg; + } + + /** + * @return The request ID + */ + @JsonProperty("request_id") + public Optional getRequestId() { + return requestId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ErrorResponseLegacyError && equalTo((ErrorResponseLegacyError) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ErrorResponseLegacyError other) { + return errCode.equals(other.errCode) && errMsg.equals(other.errMsg) && requestId.equals(other.requestId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.errCode, this.errMsg, this.requestId); + } + + @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 errCode = Optional.empty(); + + private Optional errMsg = Optional.empty(); + + private Optional requestId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ErrorResponseLegacyError other) { + errCode(other.getErrCode()); + errMsg(other.getErrMsg()); + requestId(other.getRequestId()); + return this; + } + + /** + *

The error code

+ */ + @JsonSetter(value = "err_code", nulls = Nulls.SKIP) + public Builder errCode(Optional errCode) { + this.errCode = errCode; + return this; + } + + public Builder errCode(String errCode) { + this.errCode = Optional.ofNullable(errCode); + return this; + } + + /** + *

The error message

+ */ + @JsonSetter(value = "err_msg", nulls = Nulls.SKIP) + public Builder errMsg(Optional errMsg) { + this.errMsg = errMsg; + return this; + } + + public Builder errMsg(String errMsg) { + this.errMsg = Optional.ofNullable(errMsg); + return this; + } + + /** + *

The request ID

+ */ + @JsonSetter(value = "request_id", nulls = Nulls.SKIP) + public Builder requestId(Optional requestId) { + this.requestId = requestId; + return this; + } + + public Builder requestId(String requestId) { + this.requestId = Optional.ofNullable(requestId); + return this; + } + + public ErrorResponseLegacyError build() { + return new ErrorResponseLegacyError(errCode, errMsg, requestId, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ErrorResponseModernError.java b/src/main/java/com/deepgram/types/ErrorResponseModernError.java new file mode 100644 index 0000000..7eee389 --- /dev/null +++ b/src/main/java/com/deepgram/types/ErrorResponseModernError.java @@ -0,0 +1,203 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ErrorResponseModernError.Builder.class) +public final class ErrorResponseModernError { + private final Optional category; + + private final Optional message; + + private final Optional details; + + private final Optional requestId; + + private final Map additionalProperties; + + private ErrorResponseModernError( + Optional category, + Optional message, + Optional details, + Optional requestId, + Map additionalProperties) { + this.category = category; + this.message = message; + this.details = details; + this.requestId = requestId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The category of the error + */ + @JsonProperty("category") + public Optional getCategory() { + return category; + } + + /** + * @return A message about the error + */ + @JsonProperty("message") + public Optional getMessage() { + return message; + } + + /** + * @return A description of the error + */ + @JsonProperty("details") + public Optional getDetails() { + return details; + } + + /** + * @return The unique identifier of the request + */ + @JsonProperty("request_id") + public Optional getRequestId() { + return requestId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ErrorResponseModernError && equalTo((ErrorResponseModernError) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ErrorResponseModernError other) { + return category.equals(other.category) + && message.equals(other.message) + && details.equals(other.details) + && requestId.equals(other.requestId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.category, this.message, this.details, this.requestId); + } + + @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 category = Optional.empty(); + + private Optional message = Optional.empty(); + + private Optional details = Optional.empty(); + + private Optional requestId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ErrorResponseModernError other) { + category(other.getCategory()); + message(other.getMessage()); + details(other.getDetails()); + requestId(other.getRequestId()); + return this; + } + + /** + *

The category of the error

+ */ + @JsonSetter(value = "category", nulls = Nulls.SKIP) + public Builder category(Optional category) { + this.category = category; + return this; + } + + public Builder category(String category) { + this.category = Optional.ofNullable(category); + return this; + } + + /** + *

A message about the error

+ */ + @JsonSetter(value = "message", nulls = Nulls.SKIP) + public Builder message(Optional message) { + this.message = message; + return this; + } + + public Builder message(String message) { + this.message = Optional.ofNullable(message); + return this; + } + + /** + *

A description of the error

+ */ + @JsonSetter(value = "details", nulls = Nulls.SKIP) + public Builder details(Optional details) { + this.details = details; + return this; + } + + public Builder details(String details) { + this.details = Optional.ofNullable(details); + return this; + } + + /** + *

The unique identifier of the request

+ */ + @JsonSetter(value = "request_id", nulls = Nulls.SKIP) + public Builder requestId(Optional requestId) { + this.requestId = requestId; + return this; + } + + public Builder requestId(String requestId) { + this.requestId = Optional.ofNullable(requestId); + return this; + } + + public ErrorResponseModernError build() { + return new ErrorResponseModernError(category, message, details, requestId, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/GetModelV1Response.java b/src/main/java/com/deepgram/types/GetModelV1Response.java new file mode 100644 index 0000000..e8ecd52 --- /dev/null +++ b/src/main/java/com/deepgram/types/GetModelV1Response.java @@ -0,0 +1,95 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +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 java.io.IOException; +import java.util.Objects; + +@JsonDeserialize(using = GetModelV1Response.Deserializer.class) +public final class GetModelV1Response { + private final Object value; + + private final int type; + + private GetModelV1Response(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + @SuppressWarnings("unchecked") + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((GetModelV1ResponseBatch) this.value); + } else if (this.type == 1) { + return visitor.visit((GetModelV1ResponseMetadata) 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 GetModelV1Response && equalTo((GetModelV1Response) other); + } + + private boolean equalTo(GetModelV1Response 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 GetModelV1Response of(GetModelV1ResponseBatch value) { + return new GetModelV1Response(value, 0); + } + + public static GetModelV1Response of(GetModelV1ResponseMetadata value) { + return new GetModelV1Response(value, 1); + } + + public interface Visitor { + T visit(GetModelV1ResponseBatch value); + + T visit(GetModelV1ResponseMetadata value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(GetModelV1Response.class); + } + + @java.lang.Override + public GetModelV1Response deserialize(JsonParser p, DeserializationContext context) throws IOException { + Object value = p.readValueAs(Object.class); + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, GetModelV1ResponseBatch.class)); + } catch (RuntimeException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, GetModelV1ResponseMetadata.class)); + } catch (RuntimeException e) { + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/deepgram/types/GetModelV1ResponseBatch.java b/src/main/java/com/deepgram/types/GetModelV1ResponseBatch.java new file mode 100644 index 0000000..4e67924 --- /dev/null +++ b/src/main/java/com/deepgram/types/GetModelV1ResponseBatch.java @@ -0,0 +1,319 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = GetModelV1ResponseBatch.Builder.class) +public final class GetModelV1ResponseBatch { + private final Optional name; + + private final Optional canonicalName; + + private final Optional architecture; + + private final Optional> languages; + + private final Optional version; + + private final Optional uuid; + + private final Optional batch; + + private final Optional streaming; + + private final Optional formattedOutput; + + private final Map additionalProperties; + + private GetModelV1ResponseBatch( + Optional name, + Optional canonicalName, + Optional architecture, + Optional> languages, + Optional version, + Optional uuid, + Optional batch, + Optional streaming, + Optional formattedOutput, + Map additionalProperties) { + this.name = name; + this.canonicalName = canonicalName; + this.architecture = architecture; + this.languages = languages; + this.version = version; + this.uuid = uuid; + this.batch = batch; + this.streaming = streaming; + this.formattedOutput = formattedOutput; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("name") + public Optional getName() { + return name; + } + + @JsonProperty("canonical_name") + public Optional getCanonicalName() { + return canonicalName; + } + + @JsonProperty("architecture") + public Optional getArchitecture() { + return architecture; + } + + @JsonProperty("languages") + public Optional> getLanguages() { + return languages; + } + + @JsonProperty("version") + public Optional getVersion() { + return version; + } + + @JsonProperty("uuid") + public Optional getUuid() { + return uuid; + } + + @JsonProperty("batch") + public Optional getBatch() { + return batch; + } + + @JsonProperty("streaming") + public Optional getStreaming() { + return streaming; + } + + @JsonProperty("formatted_output") + public Optional getFormattedOutput() { + return formattedOutput; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetModelV1ResponseBatch && equalTo((GetModelV1ResponseBatch) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetModelV1ResponseBatch other) { + return name.equals(other.name) + && canonicalName.equals(other.canonicalName) + && architecture.equals(other.architecture) + && languages.equals(other.languages) + && version.equals(other.version) + && uuid.equals(other.uuid) + && batch.equals(other.batch) + && streaming.equals(other.streaming) + && formattedOutput.equals(other.formattedOutput); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.name, + this.canonicalName, + this.architecture, + this.languages, + this.version, + this.uuid, + this.batch, + this.streaming, + this.formattedOutput); + } + + @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 canonicalName = Optional.empty(); + + private Optional architecture = Optional.empty(); + + private Optional> languages = Optional.empty(); + + private Optional version = Optional.empty(); + + private Optional uuid = Optional.empty(); + + private Optional batch = Optional.empty(); + + private Optional streaming = Optional.empty(); + + private Optional formattedOutput = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(GetModelV1ResponseBatch other) { + name(other.getName()); + canonicalName(other.getCanonicalName()); + architecture(other.getArchitecture()); + languages(other.getLanguages()); + version(other.getVersion()); + uuid(other.getUuid()); + batch(other.getBatch()); + streaming(other.getStreaming()); + formattedOutput(other.getFormattedOutput()); + 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 = "canonical_name", nulls = Nulls.SKIP) + public Builder canonicalName(Optional canonicalName) { + this.canonicalName = canonicalName; + return this; + } + + public Builder canonicalName(String canonicalName) { + this.canonicalName = Optional.ofNullable(canonicalName); + return this; + } + + @JsonSetter(value = "architecture", nulls = Nulls.SKIP) + public Builder architecture(Optional architecture) { + this.architecture = architecture; + return this; + } + + public Builder architecture(String architecture) { + this.architecture = Optional.ofNullable(architecture); + return this; + } + + @JsonSetter(value = "languages", nulls = Nulls.SKIP) + public Builder languages(Optional> languages) { + this.languages = languages; + return this; + } + + public Builder languages(List languages) { + this.languages = Optional.ofNullable(languages); + return this; + } + + @JsonSetter(value = "version", nulls = Nulls.SKIP) + public Builder version(Optional version) { + this.version = version; + return this; + } + + public Builder version(String version) { + this.version = Optional.ofNullable(version); + return this; + } + + @JsonSetter(value = "uuid", nulls = Nulls.SKIP) + public Builder uuid(Optional uuid) { + this.uuid = uuid; + return this; + } + + public Builder uuid(String uuid) { + this.uuid = Optional.ofNullable(uuid); + return this; + } + + @JsonSetter(value = "batch", nulls = Nulls.SKIP) + public Builder batch(Optional batch) { + this.batch = batch; + return this; + } + + public Builder batch(Boolean batch) { + this.batch = Optional.ofNullable(batch); + return this; + } + + @JsonSetter(value = "streaming", nulls = Nulls.SKIP) + public Builder streaming(Optional streaming) { + this.streaming = streaming; + return this; + } + + public Builder streaming(Boolean streaming) { + this.streaming = Optional.ofNullable(streaming); + return this; + } + + @JsonSetter(value = "formatted_output", nulls = Nulls.SKIP) + public Builder formattedOutput(Optional formattedOutput) { + this.formattedOutput = formattedOutput; + return this; + } + + public Builder formattedOutput(Boolean formattedOutput) { + this.formattedOutput = Optional.ofNullable(formattedOutput); + return this; + } + + public GetModelV1ResponseBatch build() { + return new GetModelV1ResponseBatch( + name, + canonicalName, + architecture, + languages, + version, + uuid, + batch, + streaming, + formattedOutput, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/GetModelV1ResponseMetadata.java b/src/main/java/com/deepgram/types/GetModelV1ResponseMetadata.java new file mode 100644 index 0000000..ad3c041 --- /dev/null +++ b/src/main/java/com/deepgram/types/GetModelV1ResponseMetadata.java @@ -0,0 +1,260 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = GetModelV1ResponseMetadata.Builder.class) +public final class GetModelV1ResponseMetadata { + private final Optional name; + + private final Optional canonicalName; + + private final Optional architecture; + + private final Optional> languages; + + private final Optional version; + + private final Optional uuid; + + private final Optional metadata; + + private final Map additionalProperties; + + private GetModelV1ResponseMetadata( + Optional name, + Optional canonicalName, + Optional architecture, + Optional> languages, + Optional version, + Optional uuid, + Optional metadata, + Map additionalProperties) { + this.name = name; + this.canonicalName = canonicalName; + this.architecture = architecture; + this.languages = languages; + this.version = version; + this.uuid = uuid; + this.metadata = metadata; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("name") + public Optional getName() { + return name; + } + + @JsonProperty("canonical_name") + public Optional getCanonicalName() { + return canonicalName; + } + + @JsonProperty("architecture") + public Optional getArchitecture() { + return architecture; + } + + @JsonProperty("languages") + public Optional> getLanguages() { + return languages; + } + + @JsonProperty("version") + public Optional getVersion() { + return version; + } + + @JsonProperty("uuid") + public Optional getUuid() { + return uuid; + } + + @JsonProperty("metadata") + public Optional getMetadata() { + return metadata; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetModelV1ResponseMetadata && equalTo((GetModelV1ResponseMetadata) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetModelV1ResponseMetadata other) { + return name.equals(other.name) + && canonicalName.equals(other.canonicalName) + && architecture.equals(other.architecture) + && languages.equals(other.languages) + && version.equals(other.version) + && uuid.equals(other.uuid) + && metadata.equals(other.metadata); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.name, + this.canonicalName, + this.architecture, + this.languages, + this.version, + this.uuid, + this.metadata); + } + + @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 canonicalName = Optional.empty(); + + private Optional architecture = Optional.empty(); + + private Optional> languages = Optional.empty(); + + private Optional version = Optional.empty(); + + private Optional uuid = Optional.empty(); + + private Optional metadata = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(GetModelV1ResponseMetadata other) { + name(other.getName()); + canonicalName(other.getCanonicalName()); + architecture(other.getArchitecture()); + languages(other.getLanguages()); + version(other.getVersion()); + uuid(other.getUuid()); + metadata(other.getMetadata()); + 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 = "canonical_name", nulls = Nulls.SKIP) + public Builder canonicalName(Optional canonicalName) { + this.canonicalName = canonicalName; + return this; + } + + public Builder canonicalName(String canonicalName) { + this.canonicalName = Optional.ofNullable(canonicalName); + return this; + } + + @JsonSetter(value = "architecture", nulls = Nulls.SKIP) + public Builder architecture(Optional architecture) { + this.architecture = architecture; + return this; + } + + public Builder architecture(String architecture) { + this.architecture = Optional.ofNullable(architecture); + return this; + } + + @JsonSetter(value = "languages", nulls = Nulls.SKIP) + public Builder languages(Optional> languages) { + this.languages = languages; + return this; + } + + public Builder languages(List languages) { + this.languages = Optional.ofNullable(languages); + return this; + } + + @JsonSetter(value = "version", nulls = Nulls.SKIP) + public Builder version(Optional version) { + this.version = version; + return this; + } + + public Builder version(String version) { + this.version = Optional.ofNullable(version); + return this; + } + + @JsonSetter(value = "uuid", nulls = Nulls.SKIP) + public Builder uuid(Optional uuid) { + this.uuid = uuid; + return this; + } + + public Builder uuid(String uuid) { + this.uuid = Optional.ofNullable(uuid); + return this; + } + + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public Builder metadata(Optional metadata) { + this.metadata = metadata; + return this; + } + + public Builder metadata(GetModelV1ResponseMetadataMetadata metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + public GetModelV1ResponseMetadata build() { + return new GetModelV1ResponseMetadata( + name, canonicalName, architecture, languages, version, uuid, metadata, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/GetModelV1ResponseMetadataMetadata.java b/src/main/java/com/deepgram/types/GetModelV1ResponseMetadataMetadata.java new file mode 100644 index 0000000..b59cfbb --- /dev/null +++ b/src/main/java/com/deepgram/types/GetModelV1ResponseMetadataMetadata.java @@ -0,0 +1,254 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = GetModelV1ResponseMetadataMetadata.Builder.class) +public final class GetModelV1ResponseMetadataMetadata { + private final Optional accent; + + private final Optional age; + + private final Optional color; + + private final Optional image; + + private final Optional sample; + + private final Optional> tags; + + private final Optional> useCases; + + private final Map additionalProperties; + + private GetModelV1ResponseMetadataMetadata( + Optional accent, + Optional age, + Optional color, + Optional image, + Optional sample, + Optional> tags, + Optional> useCases, + Map additionalProperties) { + this.accent = accent; + this.age = age; + this.color = color; + this.image = image; + this.sample = sample; + this.tags = tags; + this.useCases = useCases; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("accent") + public Optional getAccent() { + return accent; + } + + @JsonProperty("age") + public Optional getAge() { + return age; + } + + @JsonProperty("color") + public Optional getColor() { + return color; + } + + @JsonProperty("image") + public Optional getImage() { + return image; + } + + @JsonProperty("sample") + public Optional getSample() { + return sample; + } + + @JsonProperty("tags") + public Optional> getTags() { + return tags; + } + + @JsonProperty("use_cases") + public Optional> getUseCases() { + return useCases; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetModelV1ResponseMetadataMetadata + && equalTo((GetModelV1ResponseMetadataMetadata) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetModelV1ResponseMetadataMetadata other) { + return accent.equals(other.accent) + && age.equals(other.age) + && color.equals(other.color) + && image.equals(other.image) + && sample.equals(other.sample) + && tags.equals(other.tags) + && useCases.equals(other.useCases); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accent, this.age, this.color, this.image, this.sample, this.tags, this.useCases); + } + + @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 accent = Optional.empty(); + + private Optional age = Optional.empty(); + + private Optional color = Optional.empty(); + + private Optional image = Optional.empty(); + + private Optional sample = Optional.empty(); + + private Optional> tags = Optional.empty(); + + private Optional> useCases = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(GetModelV1ResponseMetadataMetadata other) { + accent(other.getAccent()); + age(other.getAge()); + color(other.getColor()); + image(other.getImage()); + sample(other.getSample()); + tags(other.getTags()); + useCases(other.getUseCases()); + return this; + } + + @JsonSetter(value = "accent", nulls = Nulls.SKIP) + public Builder accent(Optional accent) { + this.accent = accent; + return this; + } + + public Builder accent(String accent) { + this.accent = Optional.ofNullable(accent); + return this; + } + + @JsonSetter(value = "age", nulls = Nulls.SKIP) + public Builder age(Optional age) { + this.age = age; + return this; + } + + public Builder age(String age) { + this.age = Optional.ofNullable(age); + return this; + } + + @JsonSetter(value = "color", nulls = Nulls.SKIP) + public Builder color(Optional color) { + this.color = color; + return this; + } + + public Builder color(String color) { + this.color = Optional.ofNullable(color); + return this; + } + + @JsonSetter(value = "image", nulls = Nulls.SKIP) + public Builder image(Optional image) { + this.image = image; + return this; + } + + public Builder image(String image) { + this.image = Optional.ofNullable(image); + return this; + } + + @JsonSetter(value = "sample", nulls = Nulls.SKIP) + public Builder sample(Optional sample) { + this.sample = sample; + return this; + } + + public Builder sample(String sample) { + this.sample = Optional.ofNullable(sample); + return this; + } + + @JsonSetter(value = "tags", nulls = Nulls.SKIP) + public Builder tags(Optional> tags) { + this.tags = tags; + return this; + } + + public Builder tags(List tags) { + this.tags = Optional.ofNullable(tags); + return this; + } + + @JsonSetter(value = "use_cases", nulls = Nulls.SKIP) + public Builder useCases(Optional> useCases) { + this.useCases = useCases; + return this; + } + + public Builder useCases(List useCases) { + this.useCases = Optional.ofNullable(useCases); + return this; + } + + public GetModelV1ResponseMetadataMetadata build() { + return new GetModelV1ResponseMetadataMetadata( + accent, age, color, image, sample, tags, useCases, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/GetProjectBalanceV1Response.java b/src/main/java/com/deepgram/types/GetProjectBalanceV1Response.java new file mode 100644 index 0000000..3d00f87 --- /dev/null +++ b/src/main/java/com/deepgram/types/GetProjectBalanceV1Response.java @@ -0,0 +1,203 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetProjectBalanceV1Response.Builder.class) +public final class GetProjectBalanceV1Response { + private final Optional balanceId; + + private final Optional amount; + + private final Optional units; + + private final Optional purchaseOrderId; + + private final Map additionalProperties; + + private GetProjectBalanceV1Response( + Optional balanceId, + Optional amount, + Optional units, + Optional purchaseOrderId, + Map additionalProperties) { + this.balanceId = balanceId; + this.amount = amount; + this.units = units; + this.purchaseOrderId = purchaseOrderId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier of the balance + */ + @JsonProperty("balance_id") + public Optional getBalanceId() { + return balanceId; + } + + /** + * @return The amount of the balance + */ + @JsonProperty("amount") + public Optional getAmount() { + return amount; + } + + /** + * @return The units of the balance, such as "USD" + */ + @JsonProperty("units") + public Optional getUnits() { + return units; + } + + /** + * @return Description or reference of the purchase + */ + @JsonProperty("purchase_order_id") + public Optional getPurchaseOrderId() { + return purchaseOrderId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetProjectBalanceV1Response && equalTo((GetProjectBalanceV1Response) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetProjectBalanceV1Response other) { + return balanceId.equals(other.balanceId) + && amount.equals(other.amount) + && units.equals(other.units) + && purchaseOrderId.equals(other.purchaseOrderId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.balanceId, this.amount, this.units, this.purchaseOrderId); + } + + @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 balanceId = Optional.empty(); + + private Optional amount = Optional.empty(); + + private Optional units = Optional.empty(); + + private Optional purchaseOrderId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(GetProjectBalanceV1Response other) { + balanceId(other.getBalanceId()); + amount(other.getAmount()); + units(other.getUnits()); + purchaseOrderId(other.getPurchaseOrderId()); + return this; + } + + /** + *

The unique identifier of the balance

+ */ + @JsonSetter(value = "balance_id", nulls = Nulls.SKIP) + public Builder balanceId(Optional balanceId) { + this.balanceId = balanceId; + return this; + } + + public Builder balanceId(String balanceId) { + this.balanceId = Optional.ofNullable(balanceId); + return this; + } + + /** + *

The amount of the balance

+ */ + @JsonSetter(value = "amount", nulls = Nulls.SKIP) + public Builder amount(Optional amount) { + this.amount = amount; + return this; + } + + public Builder amount(Double amount) { + this.amount = Optional.ofNullable(amount); + return this; + } + + /** + *

The units of the balance, such as "USD"

+ */ + @JsonSetter(value = "units", nulls = Nulls.SKIP) + public Builder units(Optional units) { + this.units = units; + return this; + } + + public Builder units(String units) { + this.units = Optional.ofNullable(units); + return this; + } + + /** + *

Description or reference of the purchase

+ */ + @JsonSetter(value = "purchase_order_id", nulls = Nulls.SKIP) + public Builder purchaseOrderId(Optional purchaseOrderId) { + this.purchaseOrderId = purchaseOrderId; + return this; + } + + public Builder purchaseOrderId(String purchaseOrderId) { + this.purchaseOrderId = Optional.ofNullable(purchaseOrderId); + return this; + } + + public GetProjectBalanceV1Response build() { + return new GetProjectBalanceV1Response(balanceId, amount, units, purchaseOrderId, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/GetProjectDistributionCredentialsV1Response.java b/src/main/java/com/deepgram/types/GetProjectDistributionCredentialsV1Response.java new file mode 100644 index 0000000..f75222f --- /dev/null +++ b/src/main/java/com/deepgram/types/GetProjectDistributionCredentialsV1Response.java @@ -0,0 +1,148 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetProjectDistributionCredentialsV1Response.Builder.class) +public final class GetProjectDistributionCredentialsV1Response { + private final GetProjectDistributionCredentialsV1ResponseMember member; + + private final GetProjectDistributionCredentialsV1ResponseDistributionCredentials distributionCredentials; + + private final Map additionalProperties; + + private GetProjectDistributionCredentialsV1Response( + GetProjectDistributionCredentialsV1ResponseMember member, + GetProjectDistributionCredentialsV1ResponseDistributionCredentials distributionCredentials, + Map additionalProperties) { + this.member = member; + this.distributionCredentials = distributionCredentials; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("member") + public GetProjectDistributionCredentialsV1ResponseMember getMember() { + return member; + } + + @JsonProperty("distribution_credentials") + public GetProjectDistributionCredentialsV1ResponseDistributionCredentials getDistributionCredentials() { + return distributionCredentials; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetProjectDistributionCredentialsV1Response + && equalTo((GetProjectDistributionCredentialsV1Response) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetProjectDistributionCredentialsV1Response other) { + return member.equals(other.member) && distributionCredentials.equals(other.distributionCredentials); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.member, this.distributionCredentials); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static MemberStage builder() { + return new Builder(); + } + + public interface MemberStage { + DistributionCredentialsStage member(@NotNull GetProjectDistributionCredentialsV1ResponseMember member); + + Builder from(GetProjectDistributionCredentialsV1Response other); + } + + public interface DistributionCredentialsStage { + _FinalStage distributionCredentials( + @NotNull GetProjectDistributionCredentialsV1ResponseDistributionCredentials distributionCredentials); + } + + public interface _FinalStage { + GetProjectDistributionCredentialsV1Response build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements MemberStage, DistributionCredentialsStage, _FinalStage { + private GetProjectDistributionCredentialsV1ResponseMember member; + + private GetProjectDistributionCredentialsV1ResponseDistributionCredentials distributionCredentials; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetProjectDistributionCredentialsV1Response other) { + member(other.getMember()); + distributionCredentials(other.getDistributionCredentials()); + return this; + } + + @java.lang.Override + @JsonSetter("member") + public DistributionCredentialsStage member(@NotNull GetProjectDistributionCredentialsV1ResponseMember member) { + this.member = Objects.requireNonNull(member, "member must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("distribution_credentials") + public _FinalStage distributionCredentials( + @NotNull GetProjectDistributionCredentialsV1ResponseDistributionCredentials distributionCredentials) { + this.distributionCredentials = + Objects.requireNonNull(distributionCredentials, "distributionCredentials must not be null"); + return this; + } + + @java.lang.Override + public GetProjectDistributionCredentialsV1Response build() { + return new GetProjectDistributionCredentialsV1Response( + member, distributionCredentials, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/GetProjectDistributionCredentialsV1ResponseDistributionCredentials.java b/src/main/java/com/deepgram/types/GetProjectDistributionCredentialsV1ResponseDistributionCredentials.java new file mode 100644 index 0000000..08bd56e --- /dev/null +++ b/src/main/java/com/deepgram/types/GetProjectDistributionCredentialsV1ResponseDistributionCredentials.java @@ -0,0 +1,313 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = GetProjectDistributionCredentialsV1ResponseDistributionCredentials.Builder.class) +public final class GetProjectDistributionCredentialsV1ResponseDistributionCredentials { + private final String distributionCredentialsId; + + private final String provider; + + private final Optional comment; + + private final List scopes; + + private final OffsetDateTime created; + + private final Map additionalProperties; + + private GetProjectDistributionCredentialsV1ResponseDistributionCredentials( + String distributionCredentialsId, + String provider, + Optional comment, + List scopes, + OffsetDateTime created, + Map additionalProperties) { + this.distributionCredentialsId = distributionCredentialsId; + this.provider = provider; + this.comment = comment; + this.scopes = scopes; + this.created = created; + this.additionalProperties = additionalProperties; + } + + /** + * @return Unique identifier for the distribution credentials + */ + @JsonProperty("distribution_credentials_id") + public String getDistributionCredentialsId() { + return distributionCredentialsId; + } + + /** + * @return The provider of the distribution service + */ + @JsonProperty("provider") + public String getProvider() { + return provider; + } + + /** + * @return Optional comment about the credentials + */ + @JsonProperty("comment") + public Optional getComment() { + return comment; + } + + /** + * @return List of permission scopes for the credentials + */ + @JsonProperty("scopes") + public List getScopes() { + return scopes; + } + + /** + * @return Timestamp when the credentials were created + */ + @JsonProperty("created") + public OffsetDateTime getCreated() { + return created; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetProjectDistributionCredentialsV1ResponseDistributionCredentials + && equalTo((GetProjectDistributionCredentialsV1ResponseDistributionCredentials) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetProjectDistributionCredentialsV1ResponseDistributionCredentials other) { + return distributionCredentialsId.equals(other.distributionCredentialsId) + && provider.equals(other.provider) + && comment.equals(other.comment) + && scopes.equals(other.scopes) + && created.equals(other.created); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.distributionCredentialsId, this.provider, this.comment, this.scopes, this.created); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DistributionCredentialsIdStage builder() { + return new Builder(); + } + + public interface DistributionCredentialsIdStage { + /** + *

Unique identifier for the distribution credentials

+ */ + ProviderStage distributionCredentialsId(@NotNull String distributionCredentialsId); + + Builder from(GetProjectDistributionCredentialsV1ResponseDistributionCredentials other); + } + + public interface ProviderStage { + /** + *

The provider of the distribution service

+ */ + CreatedStage provider(@NotNull String provider); + } + + public interface CreatedStage { + /** + *

Timestamp when the credentials were created

+ */ + _FinalStage created(@NotNull OffsetDateTime created); + } + + public interface _FinalStage { + GetProjectDistributionCredentialsV1ResponseDistributionCredentials build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Optional comment about the credentials

+ */ + _FinalStage comment(Optional comment); + + _FinalStage comment(String comment); + + /** + *

List of permission scopes for the credentials

+ */ + _FinalStage scopes(List scopes); + + _FinalStage addScopes(String scopes); + + _FinalStage addAllScopes(List scopes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements DistributionCredentialsIdStage, ProviderStage, CreatedStage, _FinalStage { + private String distributionCredentialsId; + + private String provider; + + private OffsetDateTime created; + + private List scopes = new ArrayList<>(); + + private Optional comment = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetProjectDistributionCredentialsV1ResponseDistributionCredentials other) { + distributionCredentialsId(other.getDistributionCredentialsId()); + provider(other.getProvider()); + comment(other.getComment()); + scopes(other.getScopes()); + created(other.getCreated()); + return this; + } + + /** + *

Unique identifier for the distribution credentials

+ *

Unique identifier for the distribution credentials

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

The provider of the distribution service

+ *

The provider of the distribution service

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

Timestamp when the credentials were created

+ *

Timestamp when the credentials were created

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

List of permission scopes for the credentials

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllScopes(List scopes) { + if (scopes != null) { + this.scopes.addAll(scopes); + } + return this; + } + + /** + *

List of permission scopes for the credentials

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addScopes(String scopes) { + this.scopes.add(scopes); + return this; + } + + /** + *

List of permission scopes for the credentials

+ */ + @java.lang.Override + @JsonSetter(value = "scopes", nulls = Nulls.SKIP) + public _FinalStage scopes(List scopes) { + this.scopes.clear(); + if (scopes != null) { + this.scopes.addAll(scopes); + } + return this; + } + + /** + *

Optional comment about the credentials

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage comment(String comment) { + this.comment = Optional.ofNullable(comment); + return this; + } + + /** + *

Optional comment about the credentials

+ */ + @java.lang.Override + @JsonSetter(value = "comment", nulls = Nulls.SKIP) + public _FinalStage comment(Optional comment) { + this.comment = comment; + return this; + } + + @java.lang.Override + public GetProjectDistributionCredentialsV1ResponseDistributionCredentials build() { + return new GetProjectDistributionCredentialsV1ResponseDistributionCredentials( + distributionCredentialsId, provider, comment, scopes, created, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/GetProjectDistributionCredentialsV1ResponseMember.java b/src/main/java/com/deepgram/types/GetProjectDistributionCredentialsV1ResponseMember.java new file mode 100644 index 0000000..1732032 --- /dev/null +++ b/src/main/java/com/deepgram/types/GetProjectDistributionCredentialsV1ResponseMember.java @@ -0,0 +1,164 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetProjectDistributionCredentialsV1ResponseMember.Builder.class) +public final class GetProjectDistributionCredentialsV1ResponseMember { + private final String memberId; + + private final String email; + + private final Map additionalProperties; + + private GetProjectDistributionCredentialsV1ResponseMember( + String memberId, String email, Map additionalProperties) { + this.memberId = memberId; + this.email = email; + this.additionalProperties = additionalProperties; + } + + /** + * @return Unique identifier for the member + */ + @JsonProperty("member_id") + public String getMemberId() { + return memberId; + } + + /** + * @return Email address of the member + */ + @JsonProperty("email") + public String getEmail() { + return email; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetProjectDistributionCredentialsV1ResponseMember + && equalTo((GetProjectDistributionCredentialsV1ResponseMember) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetProjectDistributionCredentialsV1ResponseMember other) { + return memberId.equals(other.memberId) && email.equals(other.email); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.memberId, this.email); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static MemberIdStage builder() { + return new Builder(); + } + + public interface MemberIdStage { + /** + *

Unique identifier for the member

+ */ + EmailStage memberId(@NotNull String memberId); + + Builder from(GetProjectDistributionCredentialsV1ResponseMember other); + } + + public interface EmailStage { + /** + *

Email address of the member

+ */ + _FinalStage email(@NotNull String email); + } + + public interface _FinalStage { + GetProjectDistributionCredentialsV1ResponseMember build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements MemberIdStage, EmailStage, _FinalStage { + private String memberId; + + private String email; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetProjectDistributionCredentialsV1ResponseMember other) { + memberId(other.getMemberId()); + email(other.getEmail()); + return this; + } + + /** + *

Unique identifier for the member

+ *

Unique identifier for the member

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

Email address of the member

+ *

Email address of the member

+ * @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; + } + + @java.lang.Override + public GetProjectDistributionCredentialsV1ResponseMember build() { + return new GetProjectDistributionCredentialsV1ResponseMember(memberId, email, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/GetProjectKeyV1Response.java b/src/main/java/com/deepgram/types/GetProjectKeyV1Response.java new file mode 100644 index 0000000..4defb29 --- /dev/null +++ b/src/main/java/com/deepgram/types/GetProjectKeyV1Response.java @@ -0,0 +1,106 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetProjectKeyV1Response.Builder.class) +public final class GetProjectKeyV1Response { + private final Optional item; + + private final Map additionalProperties; + + private GetProjectKeyV1Response( + Optional item, Map additionalProperties) { + this.item = item; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("item") + public Optional getItem() { + return item; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetProjectKeyV1Response && equalTo((GetProjectKeyV1Response) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetProjectKeyV1Response other) { + return item.equals(other.item); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.item); + } + + @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 item = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(GetProjectKeyV1Response other) { + item(other.getItem()); + return this; + } + + @JsonSetter(value = "item", nulls = Nulls.SKIP) + public Builder item(Optional item) { + this.item = item; + return this; + } + + public Builder item(GetProjectKeyV1ResponseItem item) { + this.item = Optional.ofNullable(item); + return this; + } + + public GetProjectKeyV1Response build() { + return new GetProjectKeyV1Response(item, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/GetProjectKeyV1ResponseItem.java b/src/main/java/com/deepgram/types/GetProjectKeyV1ResponseItem.java new file mode 100644 index 0000000..64fb9fc --- /dev/null +++ b/src/main/java/com/deepgram/types/GetProjectKeyV1ResponseItem.java @@ -0,0 +1,106 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetProjectKeyV1ResponseItem.Builder.class) +public final class GetProjectKeyV1ResponseItem { + private final Optional member; + + private final Map additionalProperties; + + private GetProjectKeyV1ResponseItem( + Optional member, Map additionalProperties) { + this.member = member; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("member") + public Optional getMember() { + return member; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetProjectKeyV1ResponseItem && equalTo((GetProjectKeyV1ResponseItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetProjectKeyV1ResponseItem other) { + return member.equals(other.member); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.member); + } + + @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 member = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(GetProjectKeyV1ResponseItem other) { + member(other.getMember()); + return this; + } + + @JsonSetter(value = "member", nulls = Nulls.SKIP) + public Builder member(Optional member) { + this.member = member; + return this; + } + + public Builder member(GetProjectKeyV1ResponseItemMember member) { + this.member = Optional.ofNullable(member); + return this; + } + + public GetProjectKeyV1ResponseItem build() { + return new GetProjectKeyV1ResponseItem(member, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/GetProjectKeyV1ResponseItemMember.java b/src/main/java/com/deepgram/types/GetProjectKeyV1ResponseItemMember.java new file mode 100644 index 0000000..a9e3894 --- /dev/null +++ b/src/main/java/com/deepgram/types/GetProjectKeyV1ResponseItemMember.java @@ -0,0 +1,204 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetProjectKeyV1ResponseItemMember.Builder.class) +public final class GetProjectKeyV1ResponseItemMember { + private final Optional memberId; + + private final Optional email; + + private final Optional firstName; + + private final Optional lastName; + + private final Optional apiKey; + + private final Map additionalProperties; + + private GetProjectKeyV1ResponseItemMember( + Optional memberId, + Optional email, + Optional firstName, + Optional lastName, + Optional apiKey, + Map additionalProperties) { + this.memberId = memberId; + this.email = email; + this.firstName = firstName; + this.lastName = lastName; + this.apiKey = apiKey; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("member_id") + public Optional getMemberId() { + return memberId; + } + + @JsonProperty("email") + public Optional getEmail() { + return email; + } + + @JsonProperty("first_name") + public Optional getFirstName() { + return firstName; + } + + @JsonProperty("last_name") + public Optional getLastName() { + return lastName; + } + + @JsonProperty("api_key") + public Optional getApiKey() { + return apiKey; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetProjectKeyV1ResponseItemMember && equalTo((GetProjectKeyV1ResponseItemMember) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetProjectKeyV1ResponseItemMember other) { + return memberId.equals(other.memberId) + && email.equals(other.email) + && firstName.equals(other.firstName) + && lastName.equals(other.lastName) + && apiKey.equals(other.apiKey); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.memberId, this.email, this.firstName, this.lastName, this.apiKey); + } + + @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 memberId = Optional.empty(); + + private Optional email = Optional.empty(); + + private Optional firstName = Optional.empty(); + + private Optional lastName = Optional.empty(); + + private Optional apiKey = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(GetProjectKeyV1ResponseItemMember other) { + memberId(other.getMemberId()); + email(other.getEmail()); + firstName(other.getFirstName()); + lastName(other.getLastName()); + apiKey(other.getApiKey()); + return this; + } + + @JsonSetter(value = "member_id", nulls = Nulls.SKIP) + public Builder memberId(Optional memberId) { + this.memberId = memberId; + return this; + } + + public Builder memberId(String memberId) { + this.memberId = Optional.ofNullable(memberId); + return this; + } + + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public Builder email(Optional email) { + this.email = email; + return this; + } + + public Builder email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + @JsonSetter(value = "first_name", nulls = Nulls.SKIP) + public Builder firstName(Optional firstName) { + this.firstName = firstName; + return this; + } + + public Builder firstName(String firstName) { + this.firstName = Optional.ofNullable(firstName); + return this; + } + + @JsonSetter(value = "last_name", nulls = Nulls.SKIP) + public Builder lastName(Optional lastName) { + this.lastName = lastName; + return this; + } + + public Builder lastName(String lastName) { + this.lastName = Optional.ofNullable(lastName); + return this; + } + + @JsonSetter(value = "api_key", nulls = Nulls.SKIP) + public Builder apiKey(Optional apiKey) { + this.apiKey = apiKey; + return this; + } + + public Builder apiKey(GetProjectKeyV1ResponseItemMemberApiKey apiKey) { + this.apiKey = Optional.ofNullable(apiKey); + return this; + } + + public GetProjectKeyV1ResponseItemMember build() { + return new GetProjectKeyV1ResponseItemMember( + memberId, email, firstName, lastName, apiKey, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/GetProjectKeyV1ResponseItemMemberApiKey.java b/src/main/java/com/deepgram/types/GetProjectKeyV1ResponseItemMemberApiKey.java new file mode 100644 index 0000000..3ad7370 --- /dev/null +++ b/src/main/java/com/deepgram/types/GetProjectKeyV1ResponseItemMemberApiKey.java @@ -0,0 +1,231 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.time.OffsetDateTime; +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 = GetProjectKeyV1ResponseItemMemberApiKey.Builder.class) +public final class GetProjectKeyV1ResponseItemMemberApiKey { + private final Optional apiKeyId; + + private final Optional comment; + + private final Optional> scopes; + + private final Optional> tags; + + private final Optional expirationDate; + + private final Optional created; + + private final Map additionalProperties; + + private GetProjectKeyV1ResponseItemMemberApiKey( + Optional apiKeyId, + Optional comment, + Optional> scopes, + Optional> tags, + Optional expirationDate, + Optional created, + Map additionalProperties) { + this.apiKeyId = apiKeyId; + this.comment = comment; + this.scopes = scopes; + this.tags = tags; + this.expirationDate = expirationDate; + this.created = created; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("api_key_id") + public Optional getApiKeyId() { + return apiKeyId; + } + + @JsonProperty("comment") + public Optional getComment() { + return comment; + } + + @JsonProperty("scopes") + public Optional> getScopes() { + return scopes; + } + + @JsonProperty("tags") + public Optional> getTags() { + return tags; + } + + @JsonProperty("expiration_date") + public Optional getExpirationDate() { + return expirationDate; + } + + @JsonProperty("created") + public Optional getCreated() { + return created; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetProjectKeyV1ResponseItemMemberApiKey + && equalTo((GetProjectKeyV1ResponseItemMemberApiKey) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetProjectKeyV1ResponseItemMemberApiKey other) { + return apiKeyId.equals(other.apiKeyId) + && comment.equals(other.comment) + && scopes.equals(other.scopes) + && tags.equals(other.tags) + && expirationDate.equals(other.expirationDate) + && created.equals(other.created); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKeyId, this.comment, this.scopes, this.tags, this.expirationDate, this.created); + } + + @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 apiKeyId = Optional.empty(); + + private Optional comment = Optional.empty(); + + private Optional> scopes = Optional.empty(); + + private Optional> tags = Optional.empty(); + + private Optional expirationDate = Optional.empty(); + + private Optional created = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(GetProjectKeyV1ResponseItemMemberApiKey other) { + apiKeyId(other.getApiKeyId()); + comment(other.getComment()); + scopes(other.getScopes()); + tags(other.getTags()); + expirationDate(other.getExpirationDate()); + created(other.getCreated()); + return this; + } + + @JsonSetter(value = "api_key_id", nulls = Nulls.SKIP) + public Builder apiKeyId(Optional apiKeyId) { + this.apiKeyId = apiKeyId; + return this; + } + + public Builder apiKeyId(String apiKeyId) { + this.apiKeyId = Optional.ofNullable(apiKeyId); + return this; + } + + @JsonSetter(value = "comment", nulls = Nulls.SKIP) + public Builder comment(Optional comment) { + this.comment = comment; + return this; + } + + public Builder comment(String comment) { + this.comment = Optional.ofNullable(comment); + return this; + } + + @JsonSetter(value = "scopes", nulls = Nulls.SKIP) + public Builder scopes(Optional> scopes) { + this.scopes = scopes; + return this; + } + + public Builder scopes(List scopes) { + this.scopes = Optional.ofNullable(scopes); + return this; + } + + @JsonSetter(value = "tags", nulls = Nulls.SKIP) + public Builder tags(Optional> tags) { + this.tags = tags; + return this; + } + + public Builder tags(List tags) { + this.tags = Optional.ofNullable(tags); + return this; + } + + @JsonSetter(value = "expiration_date", nulls = Nulls.SKIP) + public Builder expirationDate(Optional expirationDate) { + this.expirationDate = expirationDate; + return this; + } + + public Builder expirationDate(OffsetDateTime expirationDate) { + this.expirationDate = Optional.ofNullable(expirationDate); + return this; + } + + @JsonSetter(value = "created", nulls = Nulls.SKIP) + public Builder created(Optional created) { + this.created = created; + return this; + } + + public Builder created(OffsetDateTime created) { + this.created = Optional.ofNullable(created); + return this; + } + + public GetProjectKeyV1ResponseItemMemberApiKey build() { + return new GetProjectKeyV1ResponseItemMemberApiKey( + apiKeyId, comment, scopes, tags, expirationDate, created, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/GetProjectRequestV1Response.java b/src/main/java/com/deepgram/types/GetProjectRequestV1Response.java new file mode 100644 index 0000000..716dbcb --- /dev/null +++ b/src/main/java/com/deepgram/types/GetProjectRequestV1Response.java @@ -0,0 +1,106 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetProjectRequestV1Response.Builder.class) +public final class GetProjectRequestV1Response { + private final Optional request; + + private final Map additionalProperties; + + private GetProjectRequestV1Response( + Optional request, Map additionalProperties) { + this.request = request; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("request") + public Optional getRequest() { + return request; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetProjectRequestV1Response && equalTo((GetProjectRequestV1Response) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetProjectRequestV1Response other) { + return request.equals(other.request); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.request); + } + + @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 request = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(GetProjectRequestV1Response other) { + request(other.getRequest()); + return this; + } + + @JsonSetter(value = "request", nulls = Nulls.SKIP) + public Builder request(Optional request) { + this.request = request; + return this; + } + + public Builder request(ProjectRequestResponse request) { + this.request = Optional.ofNullable(request); + return this; + } + + public GetProjectRequestV1Response build() { + return new GetProjectRequestV1Response(request, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/GetProjectV1Response.java b/src/main/java/com/deepgram/types/GetProjectV1Response.java new file mode 100644 index 0000000..4aad0e5 --- /dev/null +++ b/src/main/java/com/deepgram/types/GetProjectV1Response.java @@ -0,0 +1,171 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetProjectV1Response.Builder.class) +public final class GetProjectV1Response { + private final Optional projectId; + + private final Optional mipOptOut; + + private final Optional name; + + private final Map additionalProperties; + + private GetProjectV1Response( + Optional projectId, + Optional mipOptOut, + Optional name, + Map additionalProperties) { + this.projectId = projectId; + this.mipOptOut = mipOptOut; + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier of the project + */ + @JsonProperty("project_id") + public Optional getProjectId() { + return projectId; + } + + /** + * @return Model Improvement Program opt-out + */ + @JsonProperty("mip_opt_out") + public Optional getMipOptOut() { + return mipOptOut; + } + + /** + * @return The name of the project + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetProjectV1Response && equalTo((GetProjectV1Response) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetProjectV1Response other) { + return projectId.equals(other.projectId) && mipOptOut.equals(other.mipOptOut) && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.projectId, this.mipOptOut, 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 projectId = Optional.empty(); + + private Optional mipOptOut = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(GetProjectV1Response other) { + projectId(other.getProjectId()); + mipOptOut(other.getMipOptOut()); + name(other.getName()); + return this; + } + + /** + *

The unique identifier of the project

+ */ + @JsonSetter(value = "project_id", nulls = Nulls.SKIP) + public Builder projectId(Optional projectId) { + this.projectId = projectId; + return this; + } + + public Builder projectId(String projectId) { + this.projectId = Optional.ofNullable(projectId); + return this; + } + + /** + *

Model Improvement Program opt-out

+ */ + @JsonSetter(value = "mip_opt_out", nulls = Nulls.SKIP) + public Builder mipOptOut(Optional mipOptOut) { + this.mipOptOut = mipOptOut; + return this; + } + + public Builder mipOptOut(Boolean mipOptOut) { + this.mipOptOut = Optional.ofNullable(mipOptOut); + return this; + } + + /** + *

The name of the project

+ */ + @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 GetProjectV1Response build() { + return new GetProjectV1Response(projectId, mipOptOut, name, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/Google.java b/src/main/java/com/deepgram/types/Google.java new file mode 100644 index 0000000..234e8bf --- /dev/null +++ b/src/main/java/com/deepgram/types/Google.java @@ -0,0 +1,41 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.WrappedAlias; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class Google implements WrappedAlias { + private final Object value; + + private Google(Object value) { + this.value = value; + } + + @JsonValue + public Object get() { + return this.value; + } + + @java.lang.Override + public boolean equals(Object other) { + return this == other || (other instanceof Google && this.value.equals(((Google) other).value)); + } + + @java.lang.Override + public int hashCode() { + return value.hashCode(); + } + + @java.lang.Override + public String toString() { + return value.toString(); + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static Google of(Object value) { + return new Google(value); + } +} diff --git a/src/main/java/com/deepgram/types/GrantV1Response.java b/src/main/java/com/deepgram/types/GrantV1Response.java new file mode 100644 index 0000000..f4c886c --- /dev/null +++ b/src/main/java/com/deepgram/types/GrantV1Response.java @@ -0,0 +1,172 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = GrantV1Response.Builder.class) +public final class GrantV1Response { + private final String accessToken; + + private final Optional expiresIn; + + private final Map additionalProperties; + + private GrantV1Response(String accessToken, Optional expiresIn, Map additionalProperties) { + this.accessToken = accessToken; + this.expiresIn = expiresIn; + this.additionalProperties = additionalProperties; + } + + /** + * @return JSON Web Token (JWT) + */ + @JsonProperty("access_token") + public String getAccessToken() { + return accessToken; + } + + /** + * @return Time in seconds until the JWT expires + */ + @JsonProperty("expires_in") + public Optional getExpiresIn() { + return expiresIn; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GrantV1Response && equalTo((GrantV1Response) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GrantV1Response other) { + return accessToken.equals(other.accessToken) && expiresIn.equals(other.expiresIn); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accessToken, this.expiresIn); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccessTokenStage builder() { + return new Builder(); + } + + public interface AccessTokenStage { + /** + *

JSON Web Token (JWT)

+ */ + _FinalStage accessToken(@NotNull String accessToken); + + Builder from(GrantV1Response other); + } + + public interface _FinalStage { + GrantV1Response build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Time in seconds until the JWT expires

+ */ + _FinalStage expiresIn(Optional expiresIn); + + _FinalStage expiresIn(Double expiresIn); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AccessTokenStage, _FinalStage { + private String accessToken; + + private Optional expiresIn = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GrantV1Response other) { + accessToken(other.getAccessToken()); + expiresIn(other.getExpiresIn()); + return this; + } + + /** + *

JSON Web Token (JWT)

+ *

JSON Web Token (JWT)

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

Time in seconds until the JWT expires

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage expiresIn(Double expiresIn) { + this.expiresIn = Optional.ofNullable(expiresIn); + return this; + } + + /** + *

Time in seconds until the JWT expires

+ */ + @java.lang.Override + @JsonSetter(value = "expires_in", nulls = Nulls.SKIP) + public _FinalStage expiresIn(Optional expiresIn) { + this.expiresIn = expiresIn; + return this; + } + + @java.lang.Override + public GrantV1Response build() { + return new GrantV1Response(accessToken, expiresIn, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/Groq.java b/src/main/java/com/deepgram/types/Groq.java new file mode 100644 index 0000000..065c34a --- /dev/null +++ b/src/main/java/com/deepgram/types/Groq.java @@ -0,0 +1,41 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.WrappedAlias; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class Groq implements WrappedAlias { + private final Object value; + + private Groq(Object value) { + this.value = value; + } + + @JsonValue + public Object get() { + return this.value; + } + + @java.lang.Override + public boolean equals(Object other) { + return this == other || (other instanceof Groq && this.value.equals(((Groq) other).value)); + } + + @java.lang.Override + public int hashCode() { + return value.hashCode(); + } + + @java.lang.Override + public String toString() { + return value.toString(); + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static Groq of(Object value) { + return new Groq(value); + } +} diff --git a/src/main/java/com/deepgram/types/LeaveProjectV1Response.java b/src/main/java/com/deepgram/types/LeaveProjectV1Response.java new file mode 100644 index 0000000..057e227 --- /dev/null +++ b/src/main/java/com/deepgram/types/LeaveProjectV1Response.java @@ -0,0 +1,111 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LeaveProjectV1Response.Builder.class) +public final class LeaveProjectV1Response { + private final Optional message; + + private final Map additionalProperties; + + private LeaveProjectV1Response(Optional message, Map additionalProperties) { + this.message = message; + this.additionalProperties = additionalProperties; + } + + /** + * @return confirmation message + */ + @JsonProperty("message") + public Optional getMessage() { + return message; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LeaveProjectV1Response && equalTo((LeaveProjectV1Response) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LeaveProjectV1Response 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 Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional message = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(LeaveProjectV1Response other) { + message(other.getMessage()); + return this; + } + + /** + *

confirmation message

+ */ + @JsonSetter(value = "message", nulls = Nulls.SKIP) + public Builder message(Optional message) { + this.message = message; + return this; + } + + public Builder message(String message) { + this.message = Optional.ofNullable(message); + return this; + } + + public LeaveProjectV1Response build() { + return new LeaveProjectV1Response(message, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListBillingFieldsV1Response.java b/src/main/java/com/deepgram/types/ListBillingFieldsV1Response.java new file mode 100644 index 0000000..79f1826 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListBillingFieldsV1Response.java @@ -0,0 +1,204 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = ListBillingFieldsV1Response.Builder.class) +public final class ListBillingFieldsV1Response { + private final Optional> accessors; + + private final Optional> deployments; + + private final Optional> tags; + + private final Optional> lineItems; + + private final Map additionalProperties; + + private ListBillingFieldsV1Response( + Optional> accessors, + Optional> deployments, + Optional> tags, + Optional> lineItems, + Map additionalProperties) { + this.accessors = accessors; + this.deployments = deployments; + this.tags = tags; + this.lineItems = lineItems; + this.additionalProperties = additionalProperties; + } + + /** + * @return List of accessor UUIDs for the time period + */ + @JsonProperty("accessors") + public Optional> getAccessors() { + return accessors; + } + + /** + * @return List of deployment types for the time period + */ + @JsonProperty("deployments") + public Optional> getDeployments() { + return deployments; + } + + /** + * @return List of tags for the time period + */ + @JsonProperty("tags") + public Optional> getTags() { + return tags; + } + + /** + * @return Map of line item names to human-readable descriptions for the time period + */ + @JsonProperty("line_items") + public Optional> getLineItems() { + return lineItems; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListBillingFieldsV1Response && equalTo((ListBillingFieldsV1Response) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListBillingFieldsV1Response other) { + return accessors.equals(other.accessors) + && deployments.equals(other.deployments) + && tags.equals(other.tags) + && lineItems.equals(other.lineItems); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accessors, this.deployments, this.tags, this.lineItems); + } + + @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> accessors = Optional.empty(); + + private Optional> deployments = Optional.empty(); + + private Optional> tags = Optional.empty(); + + private Optional> lineItems = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListBillingFieldsV1Response other) { + accessors(other.getAccessors()); + deployments(other.getDeployments()); + tags(other.getTags()); + lineItems(other.getLineItems()); + return this; + } + + /** + *

List of accessor UUIDs for the time period

+ */ + @JsonSetter(value = "accessors", nulls = Nulls.SKIP) + public Builder accessors(Optional> accessors) { + this.accessors = accessors; + return this; + } + + public Builder accessors(List accessors) { + this.accessors = Optional.ofNullable(accessors); + return this; + } + + /** + *

List of deployment types for the time period

+ */ + @JsonSetter(value = "deployments", nulls = Nulls.SKIP) + public Builder deployments(Optional> deployments) { + this.deployments = deployments; + return this; + } + + public Builder deployments(List deployments) { + this.deployments = Optional.ofNullable(deployments); + return this; + } + + /** + *

List of tags for the time period

+ */ + @JsonSetter(value = "tags", nulls = Nulls.SKIP) + public Builder tags(Optional> tags) { + this.tags = tags; + return this; + } + + public Builder tags(List tags) { + this.tags = Optional.ofNullable(tags); + return this; + } + + /** + *

Map of line item names to human-readable descriptions for the time period

+ */ + @JsonSetter(value = "line_items", nulls = Nulls.SKIP) + public Builder lineItems(Optional> lineItems) { + this.lineItems = lineItems; + return this; + } + + public Builder lineItems(Map lineItems) { + this.lineItems = Optional.ofNullable(lineItems); + return this; + } + + public ListBillingFieldsV1Response build() { + return new ListBillingFieldsV1Response(accessors, deployments, tags, lineItems, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListBillingFieldsV1ResponseDeploymentsItem.java b/src/main/java/com/deepgram/types/ListBillingFieldsV1ResponseDeploymentsItem.java new file mode 100644 index 0000000..a8f60ab --- /dev/null +++ b/src/main/java/com/deepgram/types/ListBillingFieldsV1ResponseDeploymentsItem.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListBillingFieldsV1ResponseDeploymentsItem { + public static final ListBillingFieldsV1ResponseDeploymentsItem SELF_HOSTED = + new ListBillingFieldsV1ResponseDeploymentsItem(Value.SELF_HOSTED, "self-hosted"); + + public static final ListBillingFieldsV1ResponseDeploymentsItem BETA = + new ListBillingFieldsV1ResponseDeploymentsItem(Value.BETA, "beta"); + + public static final ListBillingFieldsV1ResponseDeploymentsItem HOSTED = + new ListBillingFieldsV1ResponseDeploymentsItem(Value.HOSTED, "hosted"); + + public static final ListBillingFieldsV1ResponseDeploymentsItem DEDICATED = + new ListBillingFieldsV1ResponseDeploymentsItem(Value.DEDICATED, "dedicated"); + + private final Value value; + + private final String string; + + ListBillingFieldsV1ResponseDeploymentsItem(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListBillingFieldsV1ResponseDeploymentsItem + && this.string.equals(((ListBillingFieldsV1ResponseDeploymentsItem) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case SELF_HOSTED: + return visitor.visitSelfHosted(); + case BETA: + return visitor.visitBeta(); + case HOSTED: + return visitor.visitHosted(); + case DEDICATED: + return visitor.visitDedicated(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListBillingFieldsV1ResponseDeploymentsItem valueOf(String value) { + switch (value) { + case "self-hosted": + return SELF_HOSTED; + case "beta": + return BETA; + case "hosted": + return HOSTED; + case "dedicated": + return DEDICATED; + default: + return new ListBillingFieldsV1ResponseDeploymentsItem(Value.UNKNOWN, value); + } + } + + public enum Value { + HOSTED, + + BETA, + + SELF_HOSTED, + + DEDICATED, + + UNKNOWN + } + + public interface Visitor { + T visitHosted(); + + T visitBeta(); + + T visitSelfHosted(); + + T visitDedicated(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/types/ListModelsV1Response.java b/src/main/java/com/deepgram/types/ListModelsV1Response.java new file mode 100644 index 0000000..06a032c --- /dev/null +++ b/src/main/java/com/deepgram/types/ListModelsV1Response.java @@ -0,0 +1,131 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = ListModelsV1Response.Builder.class) +public final class ListModelsV1Response { + private final Optional> stt; + + private final Optional> tts; + + private final Map additionalProperties; + + private ListModelsV1Response( + Optional> stt, + Optional> tts, + Map additionalProperties) { + this.stt = stt; + this.tts = tts; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("stt") + public Optional> getStt() { + return stt; + } + + @JsonProperty("tts") + public Optional> getTts() { + return tts; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListModelsV1Response && equalTo((ListModelsV1Response) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListModelsV1Response other) { + return stt.equals(other.stt) && tts.equals(other.tts); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.stt, this.tts); + } + + @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> stt = Optional.empty(); + + private Optional> tts = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListModelsV1Response other) { + stt(other.getStt()); + tts(other.getTts()); + return this; + } + + @JsonSetter(value = "stt", nulls = Nulls.SKIP) + public Builder stt(Optional> stt) { + this.stt = stt; + return this; + } + + public Builder stt(List stt) { + this.stt = Optional.ofNullable(stt); + return this; + } + + @JsonSetter(value = "tts", nulls = Nulls.SKIP) + public Builder tts(Optional> tts) { + this.tts = tts; + return this; + } + + public Builder tts(List tts) { + this.tts = Optional.ofNullable(tts); + return this; + } + + public ListModelsV1Response build() { + return new ListModelsV1Response(stt, tts, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListModelsV1ResponseSttModels.java b/src/main/java/com/deepgram/types/ListModelsV1ResponseSttModels.java new file mode 100644 index 0000000..22127b5 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListModelsV1ResponseSttModels.java @@ -0,0 +1,319 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = ListModelsV1ResponseSttModels.Builder.class) +public final class ListModelsV1ResponseSttModels { + private final Optional name; + + private final Optional canonicalName; + + private final Optional architecture; + + private final Optional> languages; + + private final Optional version; + + private final Optional uuid; + + private final Optional batch; + + private final Optional streaming; + + private final Optional formattedOutput; + + private final Map additionalProperties; + + private ListModelsV1ResponseSttModels( + Optional name, + Optional canonicalName, + Optional architecture, + Optional> languages, + Optional version, + Optional uuid, + Optional batch, + Optional streaming, + Optional formattedOutput, + Map additionalProperties) { + this.name = name; + this.canonicalName = canonicalName; + this.architecture = architecture; + this.languages = languages; + this.version = version; + this.uuid = uuid; + this.batch = batch; + this.streaming = streaming; + this.formattedOutput = formattedOutput; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("name") + public Optional getName() { + return name; + } + + @JsonProperty("canonical_name") + public Optional getCanonicalName() { + return canonicalName; + } + + @JsonProperty("architecture") + public Optional getArchitecture() { + return architecture; + } + + @JsonProperty("languages") + public Optional> getLanguages() { + return languages; + } + + @JsonProperty("version") + public Optional getVersion() { + return version; + } + + @JsonProperty("uuid") + public Optional getUuid() { + return uuid; + } + + @JsonProperty("batch") + public Optional getBatch() { + return batch; + } + + @JsonProperty("streaming") + public Optional getStreaming() { + return streaming; + } + + @JsonProperty("formatted_output") + public Optional getFormattedOutput() { + return formattedOutput; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListModelsV1ResponseSttModels && equalTo((ListModelsV1ResponseSttModels) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListModelsV1ResponseSttModels other) { + return name.equals(other.name) + && canonicalName.equals(other.canonicalName) + && architecture.equals(other.architecture) + && languages.equals(other.languages) + && version.equals(other.version) + && uuid.equals(other.uuid) + && batch.equals(other.batch) + && streaming.equals(other.streaming) + && formattedOutput.equals(other.formattedOutput); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.name, + this.canonicalName, + this.architecture, + this.languages, + this.version, + this.uuid, + this.batch, + this.streaming, + this.formattedOutput); + } + + @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 canonicalName = Optional.empty(); + + private Optional architecture = Optional.empty(); + + private Optional> languages = Optional.empty(); + + private Optional version = Optional.empty(); + + private Optional uuid = Optional.empty(); + + private Optional batch = Optional.empty(); + + private Optional streaming = Optional.empty(); + + private Optional formattedOutput = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListModelsV1ResponseSttModels other) { + name(other.getName()); + canonicalName(other.getCanonicalName()); + architecture(other.getArchitecture()); + languages(other.getLanguages()); + version(other.getVersion()); + uuid(other.getUuid()); + batch(other.getBatch()); + streaming(other.getStreaming()); + formattedOutput(other.getFormattedOutput()); + 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 = "canonical_name", nulls = Nulls.SKIP) + public Builder canonicalName(Optional canonicalName) { + this.canonicalName = canonicalName; + return this; + } + + public Builder canonicalName(String canonicalName) { + this.canonicalName = Optional.ofNullable(canonicalName); + return this; + } + + @JsonSetter(value = "architecture", nulls = Nulls.SKIP) + public Builder architecture(Optional architecture) { + this.architecture = architecture; + return this; + } + + public Builder architecture(String architecture) { + this.architecture = Optional.ofNullable(architecture); + return this; + } + + @JsonSetter(value = "languages", nulls = Nulls.SKIP) + public Builder languages(Optional> languages) { + this.languages = languages; + return this; + } + + public Builder languages(List languages) { + this.languages = Optional.ofNullable(languages); + return this; + } + + @JsonSetter(value = "version", nulls = Nulls.SKIP) + public Builder version(Optional version) { + this.version = version; + return this; + } + + public Builder version(String version) { + this.version = Optional.ofNullable(version); + return this; + } + + @JsonSetter(value = "uuid", nulls = Nulls.SKIP) + public Builder uuid(Optional uuid) { + this.uuid = uuid; + return this; + } + + public Builder uuid(String uuid) { + this.uuid = Optional.ofNullable(uuid); + return this; + } + + @JsonSetter(value = "batch", nulls = Nulls.SKIP) + public Builder batch(Optional batch) { + this.batch = batch; + return this; + } + + public Builder batch(Boolean batch) { + this.batch = Optional.ofNullable(batch); + return this; + } + + @JsonSetter(value = "streaming", nulls = Nulls.SKIP) + public Builder streaming(Optional streaming) { + this.streaming = streaming; + return this; + } + + public Builder streaming(Boolean streaming) { + this.streaming = Optional.ofNullable(streaming); + return this; + } + + @JsonSetter(value = "formatted_output", nulls = Nulls.SKIP) + public Builder formattedOutput(Optional formattedOutput) { + this.formattedOutput = formattedOutput; + return this; + } + + public Builder formattedOutput(Boolean formattedOutput) { + this.formattedOutput = Optional.ofNullable(formattedOutput); + return this; + } + + public ListModelsV1ResponseSttModels build() { + return new ListModelsV1ResponseSttModels( + name, + canonicalName, + architecture, + languages, + version, + uuid, + batch, + streaming, + formattedOutput, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListModelsV1ResponseTtsModels.java b/src/main/java/com/deepgram/types/ListModelsV1ResponseTtsModels.java new file mode 100644 index 0000000..1f8edb2 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListModelsV1ResponseTtsModels.java @@ -0,0 +1,260 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = ListModelsV1ResponseTtsModels.Builder.class) +public final class ListModelsV1ResponseTtsModels { + private final Optional name; + + private final Optional canonicalName; + + private final Optional architecture; + + private final Optional> languages; + + private final Optional version; + + private final Optional uuid; + + private final Optional metadata; + + private final Map additionalProperties; + + private ListModelsV1ResponseTtsModels( + Optional name, + Optional canonicalName, + Optional architecture, + Optional> languages, + Optional version, + Optional uuid, + Optional metadata, + Map additionalProperties) { + this.name = name; + this.canonicalName = canonicalName; + this.architecture = architecture; + this.languages = languages; + this.version = version; + this.uuid = uuid; + this.metadata = metadata; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("name") + public Optional getName() { + return name; + } + + @JsonProperty("canonical_name") + public Optional getCanonicalName() { + return canonicalName; + } + + @JsonProperty("architecture") + public Optional getArchitecture() { + return architecture; + } + + @JsonProperty("languages") + public Optional> getLanguages() { + return languages; + } + + @JsonProperty("version") + public Optional getVersion() { + return version; + } + + @JsonProperty("uuid") + public Optional getUuid() { + return uuid; + } + + @JsonProperty("metadata") + public Optional getMetadata() { + return metadata; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListModelsV1ResponseTtsModels && equalTo((ListModelsV1ResponseTtsModels) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListModelsV1ResponseTtsModels other) { + return name.equals(other.name) + && canonicalName.equals(other.canonicalName) + && architecture.equals(other.architecture) + && languages.equals(other.languages) + && version.equals(other.version) + && uuid.equals(other.uuid) + && metadata.equals(other.metadata); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.name, + this.canonicalName, + this.architecture, + this.languages, + this.version, + this.uuid, + this.metadata); + } + + @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 canonicalName = Optional.empty(); + + private Optional architecture = Optional.empty(); + + private Optional> languages = Optional.empty(); + + private Optional version = Optional.empty(); + + private Optional uuid = Optional.empty(); + + private Optional metadata = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListModelsV1ResponseTtsModels other) { + name(other.getName()); + canonicalName(other.getCanonicalName()); + architecture(other.getArchitecture()); + languages(other.getLanguages()); + version(other.getVersion()); + uuid(other.getUuid()); + metadata(other.getMetadata()); + 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 = "canonical_name", nulls = Nulls.SKIP) + public Builder canonicalName(Optional canonicalName) { + this.canonicalName = canonicalName; + return this; + } + + public Builder canonicalName(String canonicalName) { + this.canonicalName = Optional.ofNullable(canonicalName); + return this; + } + + @JsonSetter(value = "architecture", nulls = Nulls.SKIP) + public Builder architecture(Optional architecture) { + this.architecture = architecture; + return this; + } + + public Builder architecture(String architecture) { + this.architecture = Optional.ofNullable(architecture); + return this; + } + + @JsonSetter(value = "languages", nulls = Nulls.SKIP) + public Builder languages(Optional> languages) { + this.languages = languages; + return this; + } + + public Builder languages(List languages) { + this.languages = Optional.ofNullable(languages); + return this; + } + + @JsonSetter(value = "version", nulls = Nulls.SKIP) + public Builder version(Optional version) { + this.version = version; + return this; + } + + public Builder version(String version) { + this.version = Optional.ofNullable(version); + return this; + } + + @JsonSetter(value = "uuid", nulls = Nulls.SKIP) + public Builder uuid(Optional uuid) { + this.uuid = uuid; + return this; + } + + public Builder uuid(String uuid) { + this.uuid = Optional.ofNullable(uuid); + return this; + } + + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public Builder metadata(Optional metadata) { + this.metadata = metadata; + return this; + } + + public Builder metadata(ListModelsV1ResponseTtsModelsMetadata metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + public ListModelsV1ResponseTtsModels build() { + return new ListModelsV1ResponseTtsModels( + name, canonicalName, architecture, languages, version, uuid, metadata, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListModelsV1ResponseTtsModelsMetadata.java b/src/main/java/com/deepgram/types/ListModelsV1ResponseTtsModelsMetadata.java new file mode 100644 index 0000000..8b6a94f --- /dev/null +++ b/src/main/java/com/deepgram/types/ListModelsV1ResponseTtsModelsMetadata.java @@ -0,0 +1,254 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = ListModelsV1ResponseTtsModelsMetadata.Builder.class) +public final class ListModelsV1ResponseTtsModelsMetadata { + private final Optional accent; + + private final Optional age; + + private final Optional color; + + private final Optional image; + + private final Optional sample; + + private final Optional> tags; + + private final Optional> useCases; + + private final Map additionalProperties; + + private ListModelsV1ResponseTtsModelsMetadata( + Optional accent, + Optional age, + Optional color, + Optional image, + Optional sample, + Optional> tags, + Optional> useCases, + Map additionalProperties) { + this.accent = accent; + this.age = age; + this.color = color; + this.image = image; + this.sample = sample; + this.tags = tags; + this.useCases = useCases; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("accent") + public Optional getAccent() { + return accent; + } + + @JsonProperty("age") + public Optional getAge() { + return age; + } + + @JsonProperty("color") + public Optional getColor() { + return color; + } + + @JsonProperty("image") + public Optional getImage() { + return image; + } + + @JsonProperty("sample") + public Optional getSample() { + return sample; + } + + @JsonProperty("tags") + public Optional> getTags() { + return tags; + } + + @JsonProperty("use_cases") + public Optional> getUseCases() { + return useCases; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListModelsV1ResponseTtsModelsMetadata + && equalTo((ListModelsV1ResponseTtsModelsMetadata) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListModelsV1ResponseTtsModelsMetadata other) { + return accent.equals(other.accent) + && age.equals(other.age) + && color.equals(other.color) + && image.equals(other.image) + && sample.equals(other.sample) + && tags.equals(other.tags) + && useCases.equals(other.useCases); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accent, this.age, this.color, this.image, this.sample, this.tags, this.useCases); + } + + @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 accent = Optional.empty(); + + private Optional age = Optional.empty(); + + private Optional color = Optional.empty(); + + private Optional image = Optional.empty(); + + private Optional sample = Optional.empty(); + + private Optional> tags = Optional.empty(); + + private Optional> useCases = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListModelsV1ResponseTtsModelsMetadata other) { + accent(other.getAccent()); + age(other.getAge()); + color(other.getColor()); + image(other.getImage()); + sample(other.getSample()); + tags(other.getTags()); + useCases(other.getUseCases()); + return this; + } + + @JsonSetter(value = "accent", nulls = Nulls.SKIP) + public Builder accent(Optional accent) { + this.accent = accent; + return this; + } + + public Builder accent(String accent) { + this.accent = Optional.ofNullable(accent); + return this; + } + + @JsonSetter(value = "age", nulls = Nulls.SKIP) + public Builder age(Optional age) { + this.age = age; + return this; + } + + public Builder age(String age) { + this.age = Optional.ofNullable(age); + return this; + } + + @JsonSetter(value = "color", nulls = Nulls.SKIP) + public Builder color(Optional color) { + this.color = color; + return this; + } + + public Builder color(String color) { + this.color = Optional.ofNullable(color); + return this; + } + + @JsonSetter(value = "image", nulls = Nulls.SKIP) + public Builder image(Optional image) { + this.image = image; + return this; + } + + public Builder image(String image) { + this.image = Optional.ofNullable(image); + return this; + } + + @JsonSetter(value = "sample", nulls = Nulls.SKIP) + public Builder sample(Optional sample) { + this.sample = sample; + return this; + } + + public Builder sample(String sample) { + this.sample = Optional.ofNullable(sample); + return this; + } + + @JsonSetter(value = "tags", nulls = Nulls.SKIP) + public Builder tags(Optional> tags) { + this.tags = tags; + return this; + } + + public Builder tags(List tags) { + this.tags = Optional.ofNullable(tags); + return this; + } + + @JsonSetter(value = "use_cases", nulls = Nulls.SKIP) + public Builder useCases(Optional> useCases) { + this.useCases = useCases; + return this; + } + + public Builder useCases(List useCases) { + this.useCases = Optional.ofNullable(useCases); + return this; + } + + public ListModelsV1ResponseTtsModelsMetadata build() { + return new ListModelsV1ResponseTtsModelsMetadata( + accent, age, color, image, sample, tags, useCases, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListProjectBalancesV1Response.java b/src/main/java/com/deepgram/types/ListProjectBalancesV1Response.java new file mode 100644 index 0000000..55fbfd7 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListProjectBalancesV1Response.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = ListProjectBalancesV1Response.Builder.class) +public final class ListProjectBalancesV1Response { + private final Optional> balances; + + private final Map additionalProperties; + + private ListProjectBalancesV1Response( + Optional> balances, + Map additionalProperties) { + this.balances = balances; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("balances") + public Optional> getBalances() { + return balances; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListProjectBalancesV1Response && equalTo((ListProjectBalancesV1Response) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListProjectBalancesV1Response other) { + return balances.equals(other.balances); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.balances); + } + + @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> balances = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListProjectBalancesV1Response other) { + balances(other.getBalances()); + return this; + } + + @JsonSetter(value = "balances", nulls = Nulls.SKIP) + public Builder balances(Optional> balances) { + this.balances = balances; + return this; + } + + public Builder balances(List balances) { + this.balances = Optional.ofNullable(balances); + return this; + } + + public ListProjectBalancesV1Response build() { + return new ListProjectBalancesV1Response(balances, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListProjectBalancesV1ResponseBalancesItem.java b/src/main/java/com/deepgram/types/ListProjectBalancesV1ResponseBalancesItem.java new file mode 100644 index 0000000..ca2e5ef --- /dev/null +++ b/src/main/java/com/deepgram/types/ListProjectBalancesV1ResponseBalancesItem.java @@ -0,0 +1,205 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListProjectBalancesV1ResponseBalancesItem.Builder.class) +public final class ListProjectBalancesV1ResponseBalancesItem { + private final Optional balanceId; + + private final Optional amount; + + private final Optional units; + + private final Optional purchaseOrderId; + + private final Map additionalProperties; + + private ListProjectBalancesV1ResponseBalancesItem( + Optional balanceId, + Optional amount, + Optional units, + Optional purchaseOrderId, + Map additionalProperties) { + this.balanceId = balanceId; + this.amount = amount; + this.units = units; + this.purchaseOrderId = purchaseOrderId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier of the balance + */ + @JsonProperty("balance_id") + public Optional getBalanceId() { + return balanceId; + } + + /** + * @return The amount of the balance + */ + @JsonProperty("amount") + public Optional getAmount() { + return amount; + } + + /** + * @return The units of the balance, such as "USD" + */ + @JsonProperty("units") + public Optional getUnits() { + return units; + } + + /** + * @return Description or reference of the purchase + */ + @JsonProperty("purchase_order_id") + public Optional getPurchaseOrderId() { + return purchaseOrderId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListProjectBalancesV1ResponseBalancesItem + && equalTo((ListProjectBalancesV1ResponseBalancesItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListProjectBalancesV1ResponseBalancesItem other) { + return balanceId.equals(other.balanceId) + && amount.equals(other.amount) + && units.equals(other.units) + && purchaseOrderId.equals(other.purchaseOrderId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.balanceId, this.amount, this.units, this.purchaseOrderId); + } + + @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 balanceId = Optional.empty(); + + private Optional amount = Optional.empty(); + + private Optional units = Optional.empty(); + + private Optional purchaseOrderId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListProjectBalancesV1ResponseBalancesItem other) { + balanceId(other.getBalanceId()); + amount(other.getAmount()); + units(other.getUnits()); + purchaseOrderId(other.getPurchaseOrderId()); + return this; + } + + /** + *

The unique identifier of the balance

+ */ + @JsonSetter(value = "balance_id", nulls = Nulls.SKIP) + public Builder balanceId(Optional balanceId) { + this.balanceId = balanceId; + return this; + } + + public Builder balanceId(String balanceId) { + this.balanceId = Optional.ofNullable(balanceId); + return this; + } + + /** + *

The amount of the balance

+ */ + @JsonSetter(value = "amount", nulls = Nulls.SKIP) + public Builder amount(Optional amount) { + this.amount = amount; + return this; + } + + public Builder amount(Double amount) { + this.amount = Optional.ofNullable(amount); + return this; + } + + /** + *

The units of the balance, such as "USD"

+ */ + @JsonSetter(value = "units", nulls = Nulls.SKIP) + public Builder units(Optional units) { + this.units = units; + return this; + } + + public Builder units(String units) { + this.units = Optional.ofNullable(units); + return this; + } + + /** + *

Description or reference of the purchase

+ */ + @JsonSetter(value = "purchase_order_id", nulls = Nulls.SKIP) + public Builder purchaseOrderId(Optional purchaseOrderId) { + this.purchaseOrderId = purchaseOrderId; + return this; + } + + public Builder purchaseOrderId(String purchaseOrderId) { + this.purchaseOrderId = Optional.ofNullable(purchaseOrderId); + return this; + } + + public ListProjectBalancesV1ResponseBalancesItem build() { + return new ListProjectBalancesV1ResponseBalancesItem( + balanceId, amount, units, purchaseOrderId, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListProjectDistributionCredentialsV1Response.java b/src/main/java/com/deepgram/types/ListProjectDistributionCredentialsV1Response.java new file mode 100644 index 0000000..538a670 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListProjectDistributionCredentialsV1Response.java @@ -0,0 +1,122 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = ListProjectDistributionCredentialsV1Response.Builder.class) +public final class ListProjectDistributionCredentialsV1Response { + private final Optional> + distributionCredentials; + + private final Map additionalProperties; + + private ListProjectDistributionCredentialsV1Response( + Optional> + distributionCredentials, + Map additionalProperties) { + this.distributionCredentials = distributionCredentials; + this.additionalProperties = additionalProperties; + } + + /** + * @return Array of distribution credentials with associated member information + */ + @JsonProperty("distribution_credentials") + public Optional> + getDistributionCredentials() { + return distributionCredentials; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListProjectDistributionCredentialsV1Response + && equalTo((ListProjectDistributionCredentialsV1Response) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListProjectDistributionCredentialsV1Response other) { + return distributionCredentials.equals(other.distributionCredentials); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.distributionCredentials); + } + + @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> + distributionCredentials = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListProjectDistributionCredentialsV1Response other) { + distributionCredentials(other.getDistributionCredentials()); + return this; + } + + /** + *

Array of distribution credentials with associated member information

+ */ + @JsonSetter(value = "distribution_credentials", nulls = Nulls.SKIP) + public Builder distributionCredentials( + Optional> + distributionCredentials) { + this.distributionCredentials = distributionCredentials; + return this; + } + + public Builder distributionCredentials( + List distributionCredentials) { + this.distributionCredentials = Optional.ofNullable(distributionCredentials); + return this; + } + + public ListProjectDistributionCredentialsV1Response build() { + return new ListProjectDistributionCredentialsV1Response(distributionCredentials, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItem.java b/src/main/java/com/deepgram/types/ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItem.java new file mode 100644 index 0000000..bdce72b --- /dev/null +++ b/src/main/java/com/deepgram/types/ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItem.java @@ -0,0 +1,158 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItem.Builder.class) +public final class ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItem { + private final ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember member; + + private final ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials + distributionCredentials; + + private final Map additionalProperties; + + private ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItem( + ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember member, + ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials + distributionCredentials, + Map additionalProperties) { + this.member = member; + this.distributionCredentials = distributionCredentials; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("member") + public ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember getMember() { + return member; + } + + @JsonProperty("distribution_credentials") + public ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials + getDistributionCredentials() { + return distributionCredentials; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItem + && equalTo((ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItem other) { + return member.equals(other.member) && distributionCredentials.equals(other.distributionCredentials); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.member, this.distributionCredentials); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static MemberStage builder() { + return new Builder(); + } + + public interface MemberStage { + DistributionCredentialsStage member( + @NotNull ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember member); + + Builder from(ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItem other); + } + + public interface DistributionCredentialsStage { + _FinalStage distributionCredentials( + @NotNull + ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials + distributionCredentials); + } + + public interface _FinalStage { + ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements MemberStage, DistributionCredentialsStage, _FinalStage { + private ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember member; + + private ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials + distributionCredentials; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItem other) { + member(other.getMember()); + distributionCredentials(other.getDistributionCredentials()); + return this; + } + + @java.lang.Override + @JsonSetter("member") + public DistributionCredentialsStage member( + @NotNull ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember member) { + this.member = Objects.requireNonNull(member, "member must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("distribution_credentials") + public _FinalStage distributionCredentials( + @NotNull + ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials + distributionCredentials) { + this.distributionCredentials = + Objects.requireNonNull(distributionCredentials, "distributionCredentials must not be null"); + return this; + } + + @java.lang.Override + public ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItem build() { + return new ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItem( + member, distributionCredentials, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials.java b/src/main/java/com/deepgram/types/ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials.java new file mode 100644 index 0000000..060f413 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials.java @@ -0,0 +1,323 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = + ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials.Builder + .class) +public final class ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials { + private final String distributionCredentialsId; + + private final String provider; + + private final Optional comment; + + private final List scopes; + + private final OffsetDateTime created; + + private final Map additionalProperties; + + private ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials( + String distributionCredentialsId, + String provider, + Optional comment, + List scopes, + OffsetDateTime created, + Map additionalProperties) { + this.distributionCredentialsId = distributionCredentialsId; + this.provider = provider; + this.comment = comment; + this.scopes = scopes; + this.created = created; + this.additionalProperties = additionalProperties; + } + + /** + * @return Unique identifier for the distribution credentials + */ + @JsonProperty("distribution_credentials_id") + public String getDistributionCredentialsId() { + return distributionCredentialsId; + } + + /** + * @return The provider of the distribution service + */ + @JsonProperty("provider") + public String getProvider() { + return provider; + } + + /** + * @return Optional comment about the credentials + */ + @JsonProperty("comment") + public Optional getComment() { + return comment; + } + + /** + * @return List of permission scopes for the credentials + */ + @JsonProperty("scopes") + public List getScopes() { + return scopes; + } + + /** + * @return Timestamp when the credentials were created + */ + @JsonProperty("created") + public OffsetDateTime getCreated() { + return created; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other + instanceof + ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials + && equalTo( + (ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials) + other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo( + ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials other) { + return distributionCredentialsId.equals(other.distributionCredentialsId) + && provider.equals(other.provider) + && comment.equals(other.comment) + && scopes.equals(other.scopes) + && created.equals(other.created); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.distributionCredentialsId, this.provider, this.comment, this.scopes, this.created); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DistributionCredentialsIdStage builder() { + return new Builder(); + } + + public interface DistributionCredentialsIdStage { + /** + *

Unique identifier for the distribution credentials

+ */ + ProviderStage distributionCredentialsId(@NotNull String distributionCredentialsId); + + Builder from( + ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials other); + } + + public interface ProviderStage { + /** + *

The provider of the distribution service

+ */ + CreatedStage provider(@NotNull String provider); + } + + public interface CreatedStage { + /** + *

Timestamp when the credentials were created

+ */ + _FinalStage created(@NotNull OffsetDateTime created); + } + + public interface _FinalStage { + ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + /** + *

Optional comment about the credentials

+ */ + _FinalStage comment(Optional comment); + + _FinalStage comment(String comment); + + /** + *

List of permission scopes for the credentials

+ */ + _FinalStage scopes(List scopes); + + _FinalStage addScopes(String scopes); + + _FinalStage addAllScopes(List scopes); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements DistributionCredentialsIdStage, ProviderStage, CreatedStage, _FinalStage { + private String distributionCredentialsId; + + private String provider; + + private OffsetDateTime created; + + private List scopes = new ArrayList<>(); + + private Optional comment = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from( + ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials other) { + distributionCredentialsId(other.getDistributionCredentialsId()); + provider(other.getProvider()); + comment(other.getComment()); + scopes(other.getScopes()); + created(other.getCreated()); + return this; + } + + /** + *

Unique identifier for the distribution credentials

+ *

Unique identifier for the distribution credentials

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

The provider of the distribution service

+ *

The provider of the distribution service

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

Timestamp when the credentials were created

+ *

Timestamp when the credentials were created

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

List of permission scopes for the credentials

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllScopes(List scopes) { + if (scopes != null) { + this.scopes.addAll(scopes); + } + return this; + } + + /** + *

List of permission scopes for the credentials

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addScopes(String scopes) { + this.scopes.add(scopes); + return this; + } + + /** + *

List of permission scopes for the credentials

+ */ + @java.lang.Override + @JsonSetter(value = "scopes", nulls = Nulls.SKIP) + public _FinalStage scopes(List scopes) { + this.scopes.clear(); + if (scopes != null) { + this.scopes.addAll(scopes); + } + return this; + } + + /** + *

Optional comment about the credentials

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage comment(String comment) { + this.comment = Optional.ofNullable(comment); + return this; + } + + /** + *

Optional comment about the credentials

+ */ + @java.lang.Override + @JsonSetter(value = "comment", nulls = Nulls.SKIP) + public _FinalStage comment(Optional comment) { + this.comment = comment; + return this; + } + + @java.lang.Override + public ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials build() { + return new ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials( + distributionCredentialsId, provider, comment, scopes, created, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember.java b/src/main/java/com/deepgram/types/ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember.java new file mode 100644 index 0000000..9931e31 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember.java @@ -0,0 +1,165 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember.Builder.class) +public final class ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember { + private final String memberId; + + private final String email; + + private final Map additionalProperties; + + private ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember( + String memberId, String email, Map additionalProperties) { + this.memberId = memberId; + this.email = email; + this.additionalProperties = additionalProperties; + } + + /** + * @return Unique identifier for the member + */ + @JsonProperty("member_id") + public String getMemberId() { + return memberId; + } + + /** + * @return Email address of the member + */ + @JsonProperty("email") + public String getEmail() { + return email; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember + && equalTo((ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember other) { + return memberId.equals(other.memberId) && email.equals(other.email); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.memberId, this.email); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static MemberIdStage builder() { + return new Builder(); + } + + public interface MemberIdStage { + /** + *

Unique identifier for the member

+ */ + EmailStage memberId(@NotNull String memberId); + + Builder from(ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember other); + } + + public interface EmailStage { + /** + *

Email address of the member

+ */ + _FinalStage email(@NotNull String email); + } + + public interface _FinalStage { + ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements MemberIdStage, EmailStage, _FinalStage { + private String memberId; + + private String email; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember other) { + memberId(other.getMemberId()); + email(other.getEmail()); + return this; + } + + /** + *

Unique identifier for the member

+ *

Unique identifier for the member

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

Email address of the member

+ *

Email address of the member

+ * @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; + } + + @java.lang.Override + public ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember build() { + return new ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember( + memberId, email, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListProjectInvitesV1Response.java b/src/main/java/com/deepgram/types/ListProjectInvitesV1Response.java new file mode 100644 index 0000000..9627594 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListProjectInvitesV1Response.java @@ -0,0 +1,107 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = ListProjectInvitesV1Response.Builder.class) +public final class ListProjectInvitesV1Response { + private final Optional> invites; + + private final Map additionalProperties; + + private ListProjectInvitesV1Response( + Optional> invites, Map additionalProperties) { + this.invites = invites; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("invites") + public Optional> getInvites() { + return invites; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListProjectInvitesV1Response && equalTo((ListProjectInvitesV1Response) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListProjectInvitesV1Response other) { + return invites.equals(other.invites); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.invites); + } + + @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> invites = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListProjectInvitesV1Response other) { + invites(other.getInvites()); + return this; + } + + @JsonSetter(value = "invites", nulls = Nulls.SKIP) + public Builder invites(Optional> invites) { + this.invites = invites; + return this; + } + + public Builder invites(List invites) { + this.invites = Optional.ofNullable(invites); + return this; + } + + public ListProjectInvitesV1Response build() { + return new ListProjectInvitesV1Response(invites, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListProjectInvitesV1ResponseInvitesItem.java b/src/main/java/com/deepgram/types/ListProjectInvitesV1ResponseInvitesItem.java new file mode 100644 index 0000000..b0ff116 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListProjectInvitesV1ResponseInvitesItem.java @@ -0,0 +1,141 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListProjectInvitesV1ResponseInvitesItem.Builder.class) +public final class ListProjectInvitesV1ResponseInvitesItem { + private final Optional email; + + private final Optional scope; + + private final Map additionalProperties; + + private ListProjectInvitesV1ResponseInvitesItem( + Optional email, Optional scope, Map additionalProperties) { + this.email = email; + this.scope = scope; + this.additionalProperties = additionalProperties; + } + + /** + * @return The email address of the invitee + */ + @JsonProperty("email") + public Optional getEmail() { + return email; + } + + /** + * @return The scope of the invitee + */ + @JsonProperty("scope") + public Optional getScope() { + return scope; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListProjectInvitesV1ResponseInvitesItem + && equalTo((ListProjectInvitesV1ResponseInvitesItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListProjectInvitesV1ResponseInvitesItem other) { + return email.equals(other.email) && scope.equals(other.scope); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.email, this.scope); + } + + @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 email = Optional.empty(); + + private Optional scope = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListProjectInvitesV1ResponseInvitesItem other) { + email(other.getEmail()); + scope(other.getScope()); + return this; + } + + /** + *

The email address of the invitee

+ */ + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public Builder email(Optional email) { + this.email = email; + return this; + } + + public Builder email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + /** + *

The scope of the invitee

+ */ + @JsonSetter(value = "scope", nulls = Nulls.SKIP) + public Builder scope(Optional scope) { + this.scope = scope; + return this; + } + + public Builder scope(String scope) { + this.scope = Optional.ofNullable(scope); + return this; + } + + public ListProjectInvitesV1ResponseInvitesItem build() { + return new ListProjectInvitesV1ResponseInvitesItem(email, scope, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListProjectKeysV1Response.java b/src/main/java/com/deepgram/types/ListProjectKeysV1Response.java new file mode 100644 index 0000000..6a3d376 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListProjectKeysV1Response.java @@ -0,0 +1,107 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = ListProjectKeysV1Response.Builder.class) +public final class ListProjectKeysV1Response { + private final Optional> apiKeys; + + private final Map additionalProperties; + + private ListProjectKeysV1Response( + Optional> apiKeys, Map additionalProperties) { + this.apiKeys = apiKeys; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("api_keys") + public Optional> getApiKeys() { + return apiKeys; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListProjectKeysV1Response && equalTo((ListProjectKeysV1Response) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListProjectKeysV1Response other) { + return apiKeys.equals(other.apiKeys); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKeys); + } + + @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> apiKeys = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListProjectKeysV1Response other) { + apiKeys(other.getApiKeys()); + return this; + } + + @JsonSetter(value = "api_keys", nulls = Nulls.SKIP) + public Builder apiKeys(Optional> apiKeys) { + this.apiKeys = apiKeys; + return this; + } + + public Builder apiKeys(List apiKeys) { + this.apiKeys = Optional.ofNullable(apiKeys); + return this; + } + + public ListProjectKeysV1Response build() { + return new ListProjectKeysV1Response(apiKeys, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListProjectKeysV1ResponseApiKeysItem.java b/src/main/java/com/deepgram/types/ListProjectKeysV1ResponseApiKeysItem.java new file mode 100644 index 0000000..209a08e --- /dev/null +++ b/src/main/java/com/deepgram/types/ListProjectKeysV1ResponseApiKeysItem.java @@ -0,0 +1,131 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListProjectKeysV1ResponseApiKeysItem.Builder.class) +public final class ListProjectKeysV1ResponseApiKeysItem { + private final Optional member; + + private final Optional apiKey; + + private final Map additionalProperties; + + private ListProjectKeysV1ResponseApiKeysItem( + Optional member, + Optional apiKey, + Map additionalProperties) { + this.member = member; + this.apiKey = apiKey; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("member") + public Optional getMember() { + return member; + } + + @JsonProperty("api_key") + public Optional getApiKey() { + return apiKey; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListProjectKeysV1ResponseApiKeysItem + && equalTo((ListProjectKeysV1ResponseApiKeysItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListProjectKeysV1ResponseApiKeysItem other) { + return member.equals(other.member) && apiKey.equals(other.apiKey); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.member, this.apiKey); + } + + @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 member = Optional.empty(); + + private Optional apiKey = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListProjectKeysV1ResponseApiKeysItem other) { + member(other.getMember()); + apiKey(other.getApiKey()); + return this; + } + + @JsonSetter(value = "member", nulls = Nulls.SKIP) + public Builder member(Optional member) { + this.member = member; + return this; + } + + public Builder member(ListProjectKeysV1ResponseApiKeysItemMember member) { + this.member = Optional.ofNullable(member); + return this; + } + + @JsonSetter(value = "api_key", nulls = Nulls.SKIP) + public Builder apiKey(Optional apiKey) { + this.apiKey = apiKey; + return this; + } + + public Builder apiKey(ListProjectKeysV1ResponseApiKeysItemApiKey apiKey) { + this.apiKey = Optional.ofNullable(apiKey); + return this; + } + + public ListProjectKeysV1ResponseApiKeysItem build() { + return new ListProjectKeysV1ResponseApiKeysItem(member, apiKey, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListProjectKeysV1ResponseApiKeysItemApiKey.java b/src/main/java/com/deepgram/types/ListProjectKeysV1ResponseApiKeysItemApiKey.java new file mode 100644 index 0000000..9339abd --- /dev/null +++ b/src/main/java/com/deepgram/types/ListProjectKeysV1ResponseApiKeysItemApiKey.java @@ -0,0 +1,183 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.time.OffsetDateTime; +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 = ListProjectKeysV1ResponseApiKeysItemApiKey.Builder.class) +public final class ListProjectKeysV1ResponseApiKeysItemApiKey { + private final Optional apiKeyId; + + private final Optional comment; + + private final Optional> scopes; + + private final Optional created; + + private final Map additionalProperties; + + private ListProjectKeysV1ResponseApiKeysItemApiKey( + Optional apiKeyId, + Optional comment, + Optional> scopes, + Optional created, + Map additionalProperties) { + this.apiKeyId = apiKeyId; + this.comment = comment; + this.scopes = scopes; + this.created = created; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("api_key_id") + public Optional getApiKeyId() { + return apiKeyId; + } + + @JsonProperty("comment") + public Optional getComment() { + return comment; + } + + @JsonProperty("scopes") + public Optional> getScopes() { + return scopes; + } + + @JsonProperty("created") + public Optional getCreated() { + return created; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListProjectKeysV1ResponseApiKeysItemApiKey + && equalTo((ListProjectKeysV1ResponseApiKeysItemApiKey) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListProjectKeysV1ResponseApiKeysItemApiKey other) { + return apiKeyId.equals(other.apiKeyId) + && comment.equals(other.comment) + && scopes.equals(other.scopes) + && created.equals(other.created); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKeyId, this.comment, this.scopes, this.created); + } + + @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 apiKeyId = Optional.empty(); + + private Optional comment = Optional.empty(); + + private Optional> scopes = Optional.empty(); + + private Optional created = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListProjectKeysV1ResponseApiKeysItemApiKey other) { + apiKeyId(other.getApiKeyId()); + comment(other.getComment()); + scopes(other.getScopes()); + created(other.getCreated()); + return this; + } + + @JsonSetter(value = "api_key_id", nulls = Nulls.SKIP) + public Builder apiKeyId(Optional apiKeyId) { + this.apiKeyId = apiKeyId; + return this; + } + + public Builder apiKeyId(String apiKeyId) { + this.apiKeyId = Optional.ofNullable(apiKeyId); + return this; + } + + @JsonSetter(value = "comment", nulls = Nulls.SKIP) + public Builder comment(Optional comment) { + this.comment = comment; + return this; + } + + public Builder comment(String comment) { + this.comment = Optional.ofNullable(comment); + return this; + } + + @JsonSetter(value = "scopes", nulls = Nulls.SKIP) + public Builder scopes(Optional> scopes) { + this.scopes = scopes; + return this; + } + + public Builder scopes(List scopes) { + this.scopes = Optional.ofNullable(scopes); + return this; + } + + @JsonSetter(value = "created", nulls = Nulls.SKIP) + public Builder created(Optional created) { + this.created = created; + return this; + } + + public Builder created(OffsetDateTime created) { + this.created = Optional.ofNullable(created); + return this; + } + + public ListProjectKeysV1ResponseApiKeysItemApiKey build() { + return new ListProjectKeysV1ResponseApiKeysItemApiKey( + apiKeyId, comment, scopes, created, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListProjectKeysV1ResponseApiKeysItemMember.java b/src/main/java/com/deepgram/types/ListProjectKeysV1ResponseApiKeysItemMember.java new file mode 100644 index 0000000..5bf1ad5 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListProjectKeysV1ResponseApiKeysItemMember.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListProjectKeysV1ResponseApiKeysItemMember.Builder.class) +public final class ListProjectKeysV1ResponseApiKeysItemMember { + private final Optional memberId; + + private final Optional email; + + private final Map additionalProperties; + + private ListProjectKeysV1ResponseApiKeysItemMember( + Optional memberId, Optional email, Map additionalProperties) { + this.memberId = memberId; + this.email = email; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("member_id") + public Optional getMemberId() { + return memberId; + } + + @JsonProperty("email") + public Optional getEmail() { + return email; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListProjectKeysV1ResponseApiKeysItemMember + && equalTo((ListProjectKeysV1ResponseApiKeysItemMember) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListProjectKeysV1ResponseApiKeysItemMember other) { + return memberId.equals(other.memberId) && email.equals(other.email); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.memberId, this.email); + } + + @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 memberId = Optional.empty(); + + private Optional email = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListProjectKeysV1ResponseApiKeysItemMember other) { + memberId(other.getMemberId()); + email(other.getEmail()); + return this; + } + + @JsonSetter(value = "member_id", nulls = Nulls.SKIP) + public Builder memberId(Optional memberId) { + this.memberId = memberId; + return this; + } + + public Builder memberId(String memberId) { + this.memberId = Optional.ofNullable(memberId); + return this; + } + + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public Builder email(Optional email) { + this.email = email; + return this; + } + + public Builder email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + public ListProjectKeysV1ResponseApiKeysItemMember build() { + return new ListProjectKeysV1ResponseApiKeysItemMember(memberId, email, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListProjectMemberScopesV1Response.java b/src/main/java/com/deepgram/types/ListProjectMemberScopesV1Response.java new file mode 100644 index 0000000..99b5e34 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListProjectMemberScopesV1Response.java @@ -0,0 +1,112 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = ListProjectMemberScopesV1Response.Builder.class) +public final class ListProjectMemberScopesV1Response { + private final Optional> scopes; + + private final Map additionalProperties; + + private ListProjectMemberScopesV1Response(Optional> scopes, Map additionalProperties) { + this.scopes = scopes; + this.additionalProperties = additionalProperties; + } + + /** + * @return The API scopes of the member + */ + @JsonProperty("scopes") + public Optional> getScopes() { + return scopes; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListProjectMemberScopesV1Response && equalTo((ListProjectMemberScopesV1Response) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListProjectMemberScopesV1Response other) { + return scopes.equals(other.scopes); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.scopes); + } + + @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> scopes = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListProjectMemberScopesV1Response other) { + scopes(other.getScopes()); + return this; + } + + /** + *

The API scopes of the member

+ */ + @JsonSetter(value = "scopes", nulls = Nulls.SKIP) + public Builder scopes(Optional> scopes) { + this.scopes = scopes; + return this; + } + + public Builder scopes(List scopes) { + this.scopes = Optional.ofNullable(scopes); + return this; + } + + public ListProjectMemberScopesV1Response build() { + return new ListProjectMemberScopesV1Response(scopes, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListProjectMembersV1Response.java b/src/main/java/com/deepgram/types/ListProjectMembersV1Response.java new file mode 100644 index 0000000..5a6b903 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListProjectMembersV1Response.java @@ -0,0 +1,107 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = ListProjectMembersV1Response.Builder.class) +public final class ListProjectMembersV1Response { + private final Optional> members; + + private final Map additionalProperties; + + private ListProjectMembersV1Response( + Optional> members, Map additionalProperties) { + this.members = members; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("members") + public Optional> getMembers() { + return members; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListProjectMembersV1Response && equalTo((ListProjectMembersV1Response) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListProjectMembersV1Response other) { + return members.equals(other.members); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.members); + } + + @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> members = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListProjectMembersV1Response other) { + members(other.getMembers()); + return this; + } + + @JsonSetter(value = "members", nulls = Nulls.SKIP) + public Builder members(Optional> members) { + this.members = members; + return this; + } + + public Builder members(List members) { + this.members = Optional.ofNullable(members); + return this; + } + + public ListProjectMembersV1Response build() { + return new ListProjectMembersV1Response(members, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListProjectMembersV1ResponseMembersItem.java b/src/main/java/com/deepgram/types/ListProjectMembersV1ResponseMembersItem.java new file mode 100644 index 0000000..ae6ee1b --- /dev/null +++ b/src/main/java/com/deepgram/types/ListProjectMembersV1ResponseMembersItem.java @@ -0,0 +1,135 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListProjectMembersV1ResponseMembersItem.Builder.class) +public final class ListProjectMembersV1ResponseMembersItem { + private final Optional memberId; + + private final Optional email; + + private final Map additionalProperties; + + private ListProjectMembersV1ResponseMembersItem( + Optional memberId, Optional email, Map additionalProperties) { + this.memberId = memberId; + this.email = email; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier of the member + */ + @JsonProperty("member_id") + public Optional getMemberId() { + return memberId; + } + + @JsonProperty("email") + public Optional getEmail() { + return email; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListProjectMembersV1ResponseMembersItem + && equalTo((ListProjectMembersV1ResponseMembersItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListProjectMembersV1ResponseMembersItem other) { + return memberId.equals(other.memberId) && email.equals(other.email); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.memberId, this.email); + } + + @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 memberId = Optional.empty(); + + private Optional email = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListProjectMembersV1ResponseMembersItem other) { + memberId(other.getMemberId()); + email(other.getEmail()); + return this; + } + + /** + *

The unique identifier of the member

+ */ + @JsonSetter(value = "member_id", nulls = Nulls.SKIP) + public Builder memberId(Optional memberId) { + this.memberId = memberId; + return this; + } + + public Builder memberId(String memberId) { + this.memberId = Optional.ofNullable(memberId); + return this; + } + + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public Builder email(Optional email) { + this.email = email; + return this; + } + + public Builder email(String email) { + this.email = Optional.ofNullable(email); + return this; + } + + public ListProjectMembersV1ResponseMembersItem build() { + return new ListProjectMembersV1ResponseMembersItem(memberId, email, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListProjectPurchasesV1Response.java b/src/main/java/com/deepgram/types/ListProjectPurchasesV1Response.java new file mode 100644 index 0000000..15f77e2 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListProjectPurchasesV1Response.java @@ -0,0 +1,107 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = ListProjectPurchasesV1Response.Builder.class) +public final class ListProjectPurchasesV1Response { + private final Optional> orders; + + private final Map additionalProperties; + + private ListProjectPurchasesV1Response( + Optional> orders, Map additionalProperties) { + this.orders = orders; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("orders") + public Optional> getOrders() { + return orders; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListProjectPurchasesV1Response && equalTo((ListProjectPurchasesV1Response) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListProjectPurchasesV1Response other) { + return orders.equals(other.orders); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.orders); + } + + @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> orders = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListProjectPurchasesV1Response other) { + orders(other.getOrders()); + return this; + } + + @JsonSetter(value = "orders", nulls = Nulls.SKIP) + public Builder orders(Optional> orders) { + this.orders = orders; + return this; + } + + public Builder orders(List orders) { + this.orders = Optional.ofNullable(orders); + return this; + } + + public ListProjectPurchasesV1Response build() { + return new ListProjectPurchasesV1Response(orders, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListProjectPurchasesV1ResponseOrdersItem.java b/src/main/java/com/deepgram/types/ListProjectPurchasesV1ResponseOrdersItem.java new file mode 100644 index 0000000..047f6f4 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListProjectPurchasesV1ResponseOrdersItem.java @@ -0,0 +1,230 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = ListProjectPurchasesV1ResponseOrdersItem.Builder.class) +public final class ListProjectPurchasesV1ResponseOrdersItem { + private final Optional orderId; + + private final Optional expiration; + + private final Optional created; + + private final Optional amount; + + private final Optional units; + + private final Optional orderType; + + private final Map additionalProperties; + + private ListProjectPurchasesV1ResponseOrdersItem( + Optional orderId, + Optional expiration, + Optional created, + Optional amount, + Optional units, + Optional orderType, + Map additionalProperties) { + this.orderId = orderId; + this.expiration = expiration; + this.created = created; + this.amount = amount; + this.units = units; + this.orderType = orderType; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("order_id") + public Optional getOrderId() { + return orderId; + } + + @JsonProperty("expiration") + public Optional getExpiration() { + return expiration; + } + + @JsonProperty("created") + public Optional getCreated() { + return created; + } + + @JsonProperty("amount") + public Optional getAmount() { + return amount; + } + + @JsonProperty("units") + public Optional getUnits() { + return units; + } + + @JsonProperty("order_type") + public Optional getOrderType() { + return orderType; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListProjectPurchasesV1ResponseOrdersItem + && equalTo((ListProjectPurchasesV1ResponseOrdersItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListProjectPurchasesV1ResponseOrdersItem other) { + return orderId.equals(other.orderId) + && expiration.equals(other.expiration) + && created.equals(other.created) + && amount.equals(other.amount) + && units.equals(other.units) + && orderType.equals(other.orderType); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.orderId, this.expiration, this.created, this.amount, this.units, this.orderType); + } + + @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 orderId = Optional.empty(); + + private Optional expiration = Optional.empty(); + + private Optional created = Optional.empty(); + + private Optional amount = Optional.empty(); + + private Optional units = Optional.empty(); + + private Optional orderType = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListProjectPurchasesV1ResponseOrdersItem other) { + orderId(other.getOrderId()); + expiration(other.getExpiration()); + created(other.getCreated()); + amount(other.getAmount()); + units(other.getUnits()); + orderType(other.getOrderType()); + return this; + } + + @JsonSetter(value = "order_id", nulls = Nulls.SKIP) + public Builder orderId(Optional orderId) { + this.orderId = orderId; + return this; + } + + public Builder orderId(String orderId) { + this.orderId = Optional.ofNullable(orderId); + return this; + } + + @JsonSetter(value = "expiration", nulls = Nulls.SKIP) + public Builder expiration(Optional expiration) { + this.expiration = expiration; + return this; + } + + public Builder expiration(OffsetDateTime expiration) { + this.expiration = Optional.ofNullable(expiration); + return this; + } + + @JsonSetter(value = "created", nulls = Nulls.SKIP) + public Builder created(Optional created) { + this.created = created; + return this; + } + + public Builder created(OffsetDateTime created) { + this.created = Optional.ofNullable(created); + return this; + } + + @JsonSetter(value = "amount", nulls = Nulls.SKIP) + public Builder amount(Optional amount) { + this.amount = amount; + return this; + } + + public Builder amount(Float amount) { + this.amount = Optional.ofNullable(amount); + return this; + } + + @JsonSetter(value = "units", nulls = Nulls.SKIP) + public Builder units(Optional units) { + this.units = units; + return this; + } + + public Builder units(String units) { + this.units = Optional.ofNullable(units); + return this; + } + + @JsonSetter(value = "order_type", nulls = Nulls.SKIP) + public Builder orderType(Optional orderType) { + this.orderType = orderType; + return this; + } + + public Builder orderType(String orderType) { + this.orderType = Optional.ofNullable(orderType); + return this; + } + + public ListProjectPurchasesV1ResponseOrdersItem build() { + return new ListProjectPurchasesV1ResponseOrdersItem( + orderId, expiration, created, amount, units, orderType, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListProjectRequestsV1Response.java b/src/main/java/com/deepgram/types/ListProjectRequestsV1Response.java new file mode 100644 index 0000000..6c5becc --- /dev/null +++ b/src/main/java/com/deepgram/types/ListProjectRequestsV1Response.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = ListProjectRequestsV1Response.Builder.class) +public final class ListProjectRequestsV1Response { + private final Optional page; + + private final Optional limit; + + private final Optional> requests; + + private final Map additionalProperties; + + private ListProjectRequestsV1Response( + Optional page, + Optional limit, + Optional> requests, + Map additionalProperties) { + this.page = page; + this.limit = limit; + this.requests = requests; + this.additionalProperties = additionalProperties; + } + + /** + * @return The page number of the paginated response + */ + @JsonProperty("page") + public Optional getPage() { + return page; + } + + /** + * @return The number of results per page + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + @JsonProperty("requests") + public Optional> getRequests() { + return requests; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListProjectRequestsV1Response && equalTo((ListProjectRequestsV1Response) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListProjectRequestsV1Response other) { + return page.equals(other.page) && limit.equals(other.limit) && requests.equals(other.requests); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.page, this.limit, this.requests); + } + + @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 page = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional> requests = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListProjectRequestsV1Response other) { + page(other.getPage()); + limit(other.getLimit()); + requests(other.getRequests()); + return this; + } + + /** + *

The page number of the paginated response

+ */ + @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; + } + + /** + *

The number of results per page

+ */ + @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 = "requests", nulls = Nulls.SKIP) + public Builder requests(Optional> requests) { + this.requests = requests; + return this; + } + + public Builder requests(List requests) { + this.requests = Optional.ofNullable(requests); + return this; + } + + public ListProjectRequestsV1Response build() { + return new ListProjectRequestsV1Response(page, limit, requests, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListProjectsV1Response.java b/src/main/java/com/deepgram/types/ListProjectsV1Response.java new file mode 100644 index 0000000..a853d69 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListProjectsV1Response.java @@ -0,0 +1,107 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = ListProjectsV1Response.Builder.class) +public final class ListProjectsV1Response { + private final Optional> projects; + + private final Map additionalProperties; + + private ListProjectsV1Response( + Optional> projects, Map additionalProperties) { + this.projects = projects; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("projects") + public Optional> getProjects() { + return projects; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListProjectsV1Response && equalTo((ListProjectsV1Response) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListProjectsV1Response other) { + return projects.equals(other.projects); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.projects); + } + + @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> projects = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListProjectsV1Response other) { + projects(other.getProjects()); + return this; + } + + @JsonSetter(value = "projects", nulls = Nulls.SKIP) + public Builder projects(Optional> projects) { + this.projects = projects; + return this; + } + + public Builder projects(List projects) { + this.projects = Optional.ofNullable(projects); + return this; + } + + public ListProjectsV1Response build() { + return new ListProjectsV1Response(projects, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListProjectsV1ResponseProjectsItem.java b/src/main/java/com/deepgram/types/ListProjectsV1ResponseProjectsItem.java new file mode 100644 index 0000000..b3f308c --- /dev/null +++ b/src/main/java/com/deepgram/types/ListProjectsV1ResponseProjectsItem.java @@ -0,0 +1,141 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListProjectsV1ResponseProjectsItem.Builder.class) +public final class ListProjectsV1ResponseProjectsItem { + private final Optional projectId; + + private final Optional name; + + private final Map additionalProperties; + + private ListProjectsV1ResponseProjectsItem( + Optional projectId, Optional name, Map additionalProperties) { + this.projectId = projectId; + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier of the project + */ + @JsonProperty("project_id") + public Optional getProjectId() { + return projectId; + } + + /** + * @return The name of the project + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListProjectsV1ResponseProjectsItem + && equalTo((ListProjectsV1ResponseProjectsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListProjectsV1ResponseProjectsItem other) { + return projectId.equals(other.projectId) && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.projectId, 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 projectId = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListProjectsV1ResponseProjectsItem other) { + projectId(other.getProjectId()); + name(other.getName()); + return this; + } + + /** + *

The unique identifier of the project

+ */ + @JsonSetter(value = "project_id", nulls = Nulls.SKIP) + public Builder projectId(Optional projectId) { + this.projectId = projectId; + return this; + } + + public Builder projectId(String projectId) { + this.projectId = Optional.ofNullable(projectId); + return this; + } + + /** + *

The name of the project

+ */ + @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 ListProjectsV1ResponseProjectsItem build() { + return new ListProjectsV1ResponseProjectsItem(projectId, name, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1AcceptedResponse.java b/src/main/java/com/deepgram/types/ListenV1AcceptedResponse.java new file mode 100644 index 0000000..5d58d50 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1AcceptedResponse.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListenV1AcceptedResponse.Builder.class) +public final class ListenV1AcceptedResponse { + private final String requestId; + + private final Map additionalProperties; + + private ListenV1AcceptedResponse(String requestId, Map additionalProperties) { + this.requestId = requestId; + this.additionalProperties = additionalProperties; + } + + /** + * @return Unique identifier for tracking the asynchronous request + */ + @JsonProperty("request_id") + public String getRequestId() { + return requestId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListenV1AcceptedResponse && equalTo((ListenV1AcceptedResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListenV1AcceptedResponse other) { + return requestId.equals(other.requestId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.requestId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static RequestIdStage builder() { + return new Builder(); + } + + public interface RequestIdStage { + /** + *

Unique identifier for tracking the asynchronous request

+ */ + _FinalStage requestId(@NotNull String requestId); + + Builder from(ListenV1AcceptedResponse other); + } + + public interface _FinalStage { + ListenV1AcceptedResponse build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements RequestIdStage, _FinalStage { + private String requestId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListenV1AcceptedResponse other) { + requestId(other.getRequestId()); + return this; + } + + /** + *

Unique identifier for tracking the asynchronous request

+ *

Unique identifier for tracking the asynchronous request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("request_id") + public _FinalStage requestId(@NotNull String requestId) { + this.requestId = Objects.requireNonNull(requestId, "requestId must not be null"); + return this; + } + + @java.lang.Override + public ListenV1AcceptedResponse build() { + return new ListenV1AcceptedResponse(requestId, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1Callback.java b/src/main/java/com/deepgram/types/ListenV1Callback.java new file mode 100644 index 0000000..fd8b963 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1Callback.java @@ -0,0 +1,42 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.WrappedAlias; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListenV1Callback implements WrappedAlias { + private final Object value; + + private ListenV1Callback(Object value) { + this.value = value; + } + + @JsonValue + public Object get() { + return this.value; + } + + @java.lang.Override + public boolean equals(Object other) { + return this == other + || (other instanceof ListenV1Callback && this.value.equals(((ListenV1Callback) other).value)); + } + + @java.lang.Override + public int hashCode() { + return value.hashCode(); + } + + @java.lang.Override + public String toString() { + return value.toString(); + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListenV1Callback of(Object value) { + return new ListenV1Callback(value); + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1CallbackMethod.java b/src/main/java/com/deepgram/types/ListenV1CallbackMethod.java new file mode 100644 index 0000000..ca0488d --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1CallbackMethod.java @@ -0,0 +1,104 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListenV1CallbackMethod { + public static final ListenV1CallbackMethod DELETE = new ListenV1CallbackMethod(Value.DELETE, "DELETE"); + + public static final ListenV1CallbackMethod GET = new ListenV1CallbackMethod(Value.GET, "GET"); + + public static final ListenV1CallbackMethod PUT = new ListenV1CallbackMethod(Value.PUT, "PUT"); + + public static final ListenV1CallbackMethod POST = new ListenV1CallbackMethod(Value.POST, "POST"); + + private final Value value; + + private final String string; + + ListenV1CallbackMethod(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListenV1CallbackMethod + && this.string.equals(((ListenV1CallbackMethod) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case DELETE: + return visitor.visitDelete(); + case GET: + return visitor.visitGet(); + case PUT: + return visitor.visitPut(); + case POST: + return visitor.visitPost(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListenV1CallbackMethod valueOf(String value) { + switch (value) { + case "DELETE": + return DELETE; + case "GET": + return GET; + case "PUT": + return PUT; + case "POST": + return POST; + default: + return new ListenV1CallbackMethod(Value.UNKNOWN, value); + } + } + + public enum Value { + POST, + + GET, + + PUT, + + DELETE, + + UNKNOWN + } + + public interface Visitor { + T visitPost(); + + T visitGet(); + + T visitPut(); + + T visitDelete(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1Channels.java b/src/main/java/com/deepgram/types/ListenV1Channels.java new file mode 100644 index 0000000..81f259a --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1Channels.java @@ -0,0 +1,42 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.WrappedAlias; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListenV1Channels implements WrappedAlias { + private final Object value; + + private ListenV1Channels(Object value) { + this.value = value; + } + + @JsonValue + public Object get() { + return this.value; + } + + @java.lang.Override + public boolean equals(Object other) { + return this == other + || (other instanceof ListenV1Channels && this.value.equals(((ListenV1Channels) other).value)); + } + + @java.lang.Override + public int hashCode() { + return value.hashCode(); + } + + @java.lang.Override + public String toString() { + return value.toString(); + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListenV1Channels of(Object value) { + return new ListenV1Channels(value); + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1DetectEntities.java b/src/main/java/com/deepgram/types/ListenV1DetectEntities.java new file mode 100644 index 0000000..440c8e8 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1DetectEntities.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListenV1DetectEntities { + public static final ListenV1DetectEntities FALSE = new ListenV1DetectEntities(Value.FALSE, "false"); + + public static final ListenV1DetectEntities TRUE = new ListenV1DetectEntities(Value.TRUE, "true"); + + private final Value value; + + private final String string; + + ListenV1DetectEntities(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListenV1DetectEntities + && this.string.equals(((ListenV1DetectEntities) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FALSE: + return visitor.visitFalse(); + case TRUE: + return visitor.visitTrue(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListenV1DetectEntities valueOf(String value) { + switch (value) { + case "false": + return FALSE; + case "true": + return TRUE; + default: + return new ListenV1DetectEntities(Value.UNKNOWN, value); + } + } + + public enum Value { + TRUE, + + FALSE, + + UNKNOWN + } + + public interface Visitor { + T visitTrue(); + + T visitFalse(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1Diarize.java b/src/main/java/com/deepgram/types/ListenV1Diarize.java new file mode 100644 index 0000000..934a3a9 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1Diarize.java @@ -0,0 +1,83 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListenV1Diarize { + public static final ListenV1Diarize FALSE = new ListenV1Diarize(Value.FALSE, "false"); + + public static final ListenV1Diarize TRUE = new ListenV1Diarize(Value.TRUE, "true"); + + private final Value value; + + private final String string; + + ListenV1Diarize(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListenV1Diarize && this.string.equals(((ListenV1Diarize) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FALSE: + return visitor.visitFalse(); + case TRUE: + return visitor.visitTrue(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListenV1Diarize valueOf(String value) { + switch (value) { + case "false": + return FALSE; + case "true": + return TRUE; + default: + return new ListenV1Diarize(Value.UNKNOWN, value); + } + } + + public enum Value { + TRUE, + + FALSE, + + UNKNOWN + } + + public interface Visitor { + T visitTrue(); + + T visitFalse(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1Dictation.java b/src/main/java/com/deepgram/types/ListenV1Dictation.java new file mode 100644 index 0000000..1fc9bf3 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1Dictation.java @@ -0,0 +1,83 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListenV1Dictation { + public static final ListenV1Dictation FALSE = new ListenV1Dictation(Value.FALSE, "false"); + + public static final ListenV1Dictation TRUE = new ListenV1Dictation(Value.TRUE, "true"); + + private final Value value; + + private final String string; + + ListenV1Dictation(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListenV1Dictation && this.string.equals(((ListenV1Dictation) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FALSE: + return visitor.visitFalse(); + case TRUE: + return visitor.visitTrue(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListenV1Dictation valueOf(String value) { + switch (value) { + case "false": + return FALSE; + case "true": + return TRUE; + default: + return new ListenV1Dictation(Value.UNKNOWN, value); + } + } + + public enum Value { + TRUE, + + FALSE, + + UNKNOWN + } + + public interface Visitor { + T visitTrue(); + + T visitFalse(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1Encoding.java b/src/main/java/com/deepgram/types/ListenV1Encoding.java new file mode 100644 index 0000000..3562611 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1Encoding.java @@ -0,0 +1,173 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListenV1Encoding { + public static final ListenV1Encoding MULAW = new ListenV1Encoding(Value.MULAW, "mulaw"); + + public static final ListenV1Encoding AMR_WB = new ListenV1Encoding(Value.AMR_WB, "amr-wb"); + + public static final ListenV1Encoding LINEAR32 = new ListenV1Encoding(Value.LINEAR32, "linear32"); + + public static final ListenV1Encoding OGG_OPUS = new ListenV1Encoding(Value.OGG_OPUS, "ogg-opus"); + + public static final ListenV1Encoding FLAC = new ListenV1Encoding(Value.FLAC, "flac"); + + public static final ListenV1Encoding SPEEX = new ListenV1Encoding(Value.SPEEX, "speex"); + + public static final ListenV1Encoding LINEAR16 = new ListenV1Encoding(Value.LINEAR16, "linear16"); + + public static final ListenV1Encoding OPUS = new ListenV1Encoding(Value.OPUS, "opus"); + + public static final ListenV1Encoding ALAW = new ListenV1Encoding(Value.ALAW, "alaw"); + + public static final ListenV1Encoding AMR_NB = new ListenV1Encoding(Value.AMR_NB, "amr-nb"); + + public static final ListenV1Encoding G729 = new ListenV1Encoding(Value.G729, "g729"); + + private final Value value; + + private final String string; + + ListenV1Encoding(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListenV1Encoding && this.string.equals(((ListenV1Encoding) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MULAW: + return visitor.visitMulaw(); + case AMR_WB: + return visitor.visitAmrWb(); + case LINEAR32: + return visitor.visitLinear32(); + case OGG_OPUS: + return visitor.visitOggOpus(); + case FLAC: + return visitor.visitFlac(); + case SPEEX: + return visitor.visitSpeex(); + case LINEAR16: + return visitor.visitLinear16(); + case OPUS: + return visitor.visitOpus(); + case ALAW: + return visitor.visitAlaw(); + case AMR_NB: + return visitor.visitAmrNb(); + case G729: + return visitor.visitG729(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListenV1Encoding valueOf(String value) { + switch (value) { + case "mulaw": + return MULAW; + case "amr-wb": + return AMR_WB; + case "linear32": + return LINEAR32; + case "ogg-opus": + return OGG_OPUS; + case "flac": + return FLAC; + case "speex": + return SPEEX; + case "linear16": + return LINEAR16; + case "opus": + return OPUS; + case "alaw": + return ALAW; + case "amr-nb": + return AMR_NB; + case "g729": + return G729; + default: + return new ListenV1Encoding(Value.UNKNOWN, value); + } + } + + public enum Value { + LINEAR16, + + LINEAR32, + + FLAC, + + ALAW, + + MULAW, + + AMR_NB, + + AMR_WB, + + OPUS, + + OGG_OPUS, + + SPEEX, + + G729, + + UNKNOWN + } + + public interface Visitor { + T visitLinear16(); + + T visitLinear32(); + + T visitFlac(); + + T visitAlaw(); + + T visitMulaw(); + + T visitAmrNb(); + + T visitAmrWb(); + + T visitOpus(); + + T visitOggOpus(); + + T visitSpeex(); + + T visitG729(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1Endpointing.java b/src/main/java/com/deepgram/types/ListenV1Endpointing.java new file mode 100644 index 0000000..2f4c350 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1Endpointing.java @@ -0,0 +1,42 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.WrappedAlias; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListenV1Endpointing implements WrappedAlias { + private final Object value; + + private ListenV1Endpointing(Object value) { + this.value = value; + } + + @JsonValue + public Object get() { + return this.value; + } + + @java.lang.Override + public boolean equals(Object other) { + return this == other + || (other instanceof ListenV1Endpointing && this.value.equals(((ListenV1Endpointing) other).value)); + } + + @java.lang.Override + public int hashCode() { + return value.hashCode(); + } + + @java.lang.Override + public String toString() { + return value.toString(); + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListenV1Endpointing of(Object value) { + return new ListenV1Endpointing(value); + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1Extra.java b/src/main/java/com/deepgram/types/ListenV1Extra.java new file mode 100644 index 0000000..8464824 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1Extra.java @@ -0,0 +1,41 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.WrappedAlias; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListenV1Extra implements WrappedAlias { + private final Object value; + + private ListenV1Extra(Object value) { + this.value = value; + } + + @JsonValue + public Object get() { + return this.value; + } + + @java.lang.Override + public boolean equals(Object other) { + return this == other || (other instanceof ListenV1Extra && this.value.equals(((ListenV1Extra) other).value)); + } + + @java.lang.Override + public int hashCode() { + return value.hashCode(); + } + + @java.lang.Override + public String toString() { + return value.toString(); + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListenV1Extra of(Object value) { + return new ListenV1Extra(value); + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1InterimResults.java b/src/main/java/com/deepgram/types/ListenV1InterimResults.java new file mode 100644 index 0000000..285e2d2 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1InterimResults.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListenV1InterimResults { + public static final ListenV1InterimResults FALSE = new ListenV1InterimResults(Value.FALSE, "false"); + + public static final ListenV1InterimResults TRUE = new ListenV1InterimResults(Value.TRUE, "true"); + + private final Value value; + + private final String string; + + ListenV1InterimResults(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListenV1InterimResults + && this.string.equals(((ListenV1InterimResults) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FALSE: + return visitor.visitFalse(); + case TRUE: + return visitor.visitTrue(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListenV1InterimResults valueOf(String value) { + switch (value) { + case "false": + return FALSE; + case "true": + return TRUE; + default: + return new ListenV1InterimResults(Value.UNKNOWN, value); + } + } + + public enum Value { + TRUE, + + FALSE, + + UNKNOWN + } + + public interface Visitor { + T visitTrue(); + + T visitFalse(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1Keyterm.java b/src/main/java/com/deepgram/types/ListenV1Keyterm.java new file mode 100644 index 0000000..208b28b --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1Keyterm.java @@ -0,0 +1,42 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.WrappedAlias; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListenV1Keyterm implements WrappedAlias { + private final Object value; + + private ListenV1Keyterm(Object value) { + this.value = value; + } + + @JsonValue + public Object get() { + return this.value; + } + + @java.lang.Override + public boolean equals(Object other) { + return this == other + || (other instanceof ListenV1Keyterm && this.value.equals(((ListenV1Keyterm) other).value)); + } + + @java.lang.Override + public int hashCode() { + return value.hashCode(); + } + + @java.lang.Override + public String toString() { + return value.toString(); + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListenV1Keyterm of(Object value) { + return new ListenV1Keyterm(value); + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1Keywords.java b/src/main/java/com/deepgram/types/ListenV1Keywords.java new file mode 100644 index 0000000..a0ccfef --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1Keywords.java @@ -0,0 +1,42 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.WrappedAlias; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListenV1Keywords implements WrappedAlias { + private final Object value; + + private ListenV1Keywords(Object value) { + this.value = value; + } + + @JsonValue + public Object get() { + return this.value; + } + + @java.lang.Override + public boolean equals(Object other) { + return this == other + || (other instanceof ListenV1Keywords && this.value.equals(((ListenV1Keywords) other).value)); + } + + @java.lang.Override + public int hashCode() { + return value.hashCode(); + } + + @java.lang.Override + public String toString() { + return value.toString(); + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListenV1Keywords of(Object value) { + return new ListenV1Keywords(value); + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1Language.java b/src/main/java/com/deepgram/types/ListenV1Language.java new file mode 100644 index 0000000..4bf69a3 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1Language.java @@ -0,0 +1,42 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.WrappedAlias; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListenV1Language implements WrappedAlias { + private final Object value; + + private ListenV1Language(Object value) { + this.value = value; + } + + @JsonValue + public Object get() { + return this.value; + } + + @java.lang.Override + public boolean equals(Object other) { + return this == other + || (other instanceof ListenV1Language && this.value.equals(((ListenV1Language) other).value)); + } + + @java.lang.Override + public int hashCode() { + return value.hashCode(); + } + + @java.lang.Override + public String toString() { + return value.toString(); + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListenV1Language of(Object value) { + return new ListenV1Language(value); + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1MipOptOut.java b/src/main/java/com/deepgram/types/ListenV1MipOptOut.java new file mode 100644 index 0000000..871763c --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1MipOptOut.java @@ -0,0 +1,42 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.WrappedAlias; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListenV1MipOptOut implements WrappedAlias { + private final Object value; + + private ListenV1MipOptOut(Object value) { + this.value = value; + } + + @JsonValue + public Object get() { + return this.value; + } + + @java.lang.Override + public boolean equals(Object other) { + return this == other + || (other instanceof ListenV1MipOptOut && this.value.equals(((ListenV1MipOptOut) other).value)); + } + + @java.lang.Override + public int hashCode() { + return value.hashCode(); + } + + @java.lang.Override + public String toString() { + return value.toString(); + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListenV1MipOptOut of(Object value) { + return new ListenV1MipOptOut(value); + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1Model.java b/src/main/java/com/deepgram/types/ListenV1Model.java new file mode 100644 index 0000000..ff5ba06 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1Model.java @@ -0,0 +1,365 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListenV1Model { + public static final ListenV1Model NOVA2VOICEMAIL = new ListenV1Model(Value.NOVA2VOICEMAIL, "nova-2-voicemail"); + + public static final ListenV1Model NOVA3 = new ListenV1Model(Value.NOVA3, "nova-3"); + + public static final ListenV1Model FINANCE = new ListenV1Model(Value.FINANCE, "finance"); + + public static final ListenV1Model NOVA_MEDICAL = new ListenV1Model(Value.NOVA_MEDICAL, "nova-medical"); + + public static final ListenV1Model ENHANCED_GENERAL = new ListenV1Model(Value.ENHANCED_GENERAL, "enhanced-general"); + + public static final ListenV1Model NOVA_GENERAL = new ListenV1Model(Value.NOVA_GENERAL, "nova-general"); + + public static final ListenV1Model NOVA3MEDICAL = new ListenV1Model(Value.NOVA3MEDICAL, "nova-3-medical"); + + public static final ListenV1Model NOVA2 = new ListenV1Model(Value.NOVA2, "nova-2"); + + public static final ListenV1Model VOICEMAIL = new ListenV1Model(Value.VOICEMAIL, "voicemail"); + + public static final ListenV1Model ENHANCED_FINANCE = new ListenV1Model(Value.ENHANCED_FINANCE, "enhanced-finance"); + + public static final ListenV1Model NOVA2FINANCE = new ListenV1Model(Value.NOVA2FINANCE, "nova-2-finance"); + + public static final ListenV1Model MEETING = new ListenV1Model(Value.MEETING, "meeting"); + + public static final ListenV1Model PHONECALL = new ListenV1Model(Value.PHONECALL, "phonecall"); + + public static final ListenV1Model NOVA2CONVERSATIONALAI = + new ListenV1Model(Value.NOVA2CONVERSATIONALAI, "nova-2-conversationalai"); + + public static final ListenV1Model VIDEO = new ListenV1Model(Value.VIDEO, "video"); + + public static final ListenV1Model CONVERSATIONALAI = new ListenV1Model(Value.CONVERSATIONALAI, "conversationalai"); + + public static final ListenV1Model NOVA2VIDEO = new ListenV1Model(Value.NOVA2VIDEO, "nova-2-video"); + + public static final ListenV1Model NOVA2DRIVETHRU = new ListenV1Model(Value.NOVA2DRIVETHRU, "nova-2-drivethru"); + + public static final ListenV1Model BASE = new ListenV1Model(Value.BASE, "base"); + + public static final ListenV1Model NOVA2GENERAL = new ListenV1Model(Value.NOVA2GENERAL, "nova-2-general"); + + public static final ListenV1Model NOVA = new ListenV1Model(Value.NOVA, "nova"); + + public static final ListenV1Model ENHANCED_PHONECALL = + new ListenV1Model(Value.ENHANCED_PHONECALL, "enhanced-phonecall"); + + public static final ListenV1Model NOVA2MEDICAL = new ListenV1Model(Value.NOVA2MEDICAL, "nova-2-medical"); + + public static final ListenV1Model CUSTOM = new ListenV1Model(Value.CUSTOM, "custom"); + + public static final ListenV1Model NOVA3GENERAL = new ListenV1Model(Value.NOVA3GENERAL, "nova-3-general"); + + public static final ListenV1Model ENHANCED = new ListenV1Model(Value.ENHANCED, "enhanced"); + + public static final ListenV1Model NOVA_PHONECALL = new ListenV1Model(Value.NOVA_PHONECALL, "nova-phonecall"); + + public static final ListenV1Model NOVA2MEETING = new ListenV1Model(Value.NOVA2MEETING, "nova-2-meeting"); + + public static final ListenV1Model NOVA2AUTOMOTIVE = new ListenV1Model(Value.NOVA2AUTOMOTIVE, "nova-2-automotive"); + + public static final ListenV1Model ENHANCED_MEETING = new ListenV1Model(Value.ENHANCED_MEETING, "enhanced-meeting"); + + private final Value value; + + private final String string; + + ListenV1Model(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListenV1Model && this.string.equals(((ListenV1Model) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case NOVA2VOICEMAIL: + return visitor.visitNova2Voicemail(); + case NOVA3: + return visitor.visitNova3(); + case FINANCE: + return visitor.visitFinance(); + case NOVA_MEDICAL: + return visitor.visitNovaMedical(); + case ENHANCED_GENERAL: + return visitor.visitEnhancedGeneral(); + case NOVA_GENERAL: + return visitor.visitNovaGeneral(); + case NOVA3MEDICAL: + return visitor.visitNova3Medical(); + case NOVA2: + return visitor.visitNova2(); + case VOICEMAIL: + return visitor.visitVoicemail(); + case ENHANCED_FINANCE: + return visitor.visitEnhancedFinance(); + case NOVA2FINANCE: + return visitor.visitNova2Finance(); + case MEETING: + return visitor.visitMeeting(); + case PHONECALL: + return visitor.visitPhonecall(); + case NOVA2CONVERSATIONALAI: + return visitor.visitNova2Conversationalai(); + case VIDEO: + return visitor.visitVideo(); + case CONVERSATIONALAI: + return visitor.visitConversationalai(); + case NOVA2VIDEO: + return visitor.visitNova2Video(); + case NOVA2DRIVETHRU: + return visitor.visitNova2Drivethru(); + case BASE: + return visitor.visitBase(); + case NOVA2GENERAL: + return visitor.visitNova2General(); + case NOVA: + return visitor.visitNova(); + case ENHANCED_PHONECALL: + return visitor.visitEnhancedPhonecall(); + case NOVA2MEDICAL: + return visitor.visitNova2Medical(); + case CUSTOM: + return visitor.visitCustom(); + case NOVA3GENERAL: + return visitor.visitNova3General(); + case ENHANCED: + return visitor.visitEnhanced(); + case NOVA_PHONECALL: + return visitor.visitNovaPhonecall(); + case NOVA2MEETING: + return visitor.visitNova2Meeting(); + case NOVA2AUTOMOTIVE: + return visitor.visitNova2Automotive(); + case ENHANCED_MEETING: + return visitor.visitEnhancedMeeting(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListenV1Model valueOf(String value) { + switch (value) { + case "nova-2-voicemail": + return NOVA2VOICEMAIL; + case "nova-3": + return NOVA3; + case "finance": + return FINANCE; + case "nova-medical": + return NOVA_MEDICAL; + case "enhanced-general": + return ENHANCED_GENERAL; + case "nova-general": + return NOVA_GENERAL; + case "nova-3-medical": + return NOVA3MEDICAL; + case "nova-2": + return NOVA2; + case "voicemail": + return VOICEMAIL; + case "enhanced-finance": + return ENHANCED_FINANCE; + case "nova-2-finance": + return NOVA2FINANCE; + case "meeting": + return MEETING; + case "phonecall": + return PHONECALL; + case "nova-2-conversationalai": + return NOVA2CONVERSATIONALAI; + case "video": + return VIDEO; + case "conversationalai": + return CONVERSATIONALAI; + case "nova-2-video": + return NOVA2VIDEO; + case "nova-2-drivethru": + return NOVA2DRIVETHRU; + case "base": + return BASE; + case "nova-2-general": + return NOVA2GENERAL; + case "nova": + return NOVA; + case "enhanced-phonecall": + return ENHANCED_PHONECALL; + case "nova-2-medical": + return NOVA2MEDICAL; + case "custom": + return CUSTOM; + case "nova-3-general": + return NOVA3GENERAL; + case "enhanced": + return ENHANCED; + case "nova-phonecall": + return NOVA_PHONECALL; + case "nova-2-meeting": + return NOVA2MEETING; + case "nova-2-automotive": + return NOVA2AUTOMOTIVE; + case "enhanced-meeting": + return ENHANCED_MEETING; + default: + return new ListenV1Model(Value.UNKNOWN, value); + } + } + + public enum Value { + NOVA3, + + NOVA3GENERAL, + + NOVA3MEDICAL, + + NOVA2, + + NOVA2GENERAL, + + NOVA2MEETING, + + NOVA2FINANCE, + + NOVA2CONVERSATIONALAI, + + NOVA2VOICEMAIL, + + NOVA2VIDEO, + + NOVA2MEDICAL, + + NOVA2DRIVETHRU, + + NOVA2AUTOMOTIVE, + + NOVA, + + NOVA_GENERAL, + + NOVA_PHONECALL, + + NOVA_MEDICAL, + + ENHANCED, + + ENHANCED_GENERAL, + + ENHANCED_MEETING, + + ENHANCED_PHONECALL, + + ENHANCED_FINANCE, + + BASE, + + MEETING, + + PHONECALL, + + FINANCE, + + CONVERSATIONALAI, + + VOICEMAIL, + + VIDEO, + + CUSTOM, + + UNKNOWN + } + + public interface Visitor { + T visitNova3(); + + T visitNova3General(); + + T visitNova3Medical(); + + T visitNova2(); + + T visitNova2General(); + + T visitNova2Meeting(); + + T visitNova2Finance(); + + T visitNova2Conversationalai(); + + T visitNova2Voicemail(); + + T visitNova2Video(); + + T visitNova2Medical(); + + T visitNova2Drivethru(); + + T visitNova2Automotive(); + + T visitNova(); + + T visitNovaGeneral(); + + T visitNovaPhonecall(); + + T visitNovaMedical(); + + T visitEnhanced(); + + T visitEnhancedGeneral(); + + T visitEnhancedMeeting(); + + T visitEnhancedPhonecall(); + + T visitEnhancedFinance(); + + T visitBase(); + + T visitMeeting(); + + T visitPhonecall(); + + T visitFinance(); + + T visitConversationalai(); + + T visitVoicemail(); + + T visitVideo(); + + T visitCustom(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1Multichannel.java b/src/main/java/com/deepgram/types/ListenV1Multichannel.java new file mode 100644 index 0000000..07e4142 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1Multichannel.java @@ -0,0 +1,83 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListenV1Multichannel { + public static final ListenV1Multichannel FALSE = new ListenV1Multichannel(Value.FALSE, "false"); + + public static final ListenV1Multichannel TRUE = new ListenV1Multichannel(Value.TRUE, "true"); + + private final Value value; + + private final String string; + + ListenV1Multichannel(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListenV1Multichannel && this.string.equals(((ListenV1Multichannel) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FALSE: + return visitor.visitFalse(); + case TRUE: + return visitor.visitTrue(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListenV1Multichannel valueOf(String value) { + switch (value) { + case "false": + return FALSE; + case "true": + return TRUE; + default: + return new ListenV1Multichannel(Value.UNKNOWN, value); + } + } + + public enum Value { + TRUE, + + FALSE, + + UNKNOWN + } + + public interface Visitor { + T visitTrue(); + + T visitFalse(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1Numerals.java b/src/main/java/com/deepgram/types/ListenV1Numerals.java new file mode 100644 index 0000000..36c2f14 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1Numerals.java @@ -0,0 +1,83 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListenV1Numerals { + public static final ListenV1Numerals FALSE = new ListenV1Numerals(Value.FALSE, "false"); + + public static final ListenV1Numerals TRUE = new ListenV1Numerals(Value.TRUE, "true"); + + private final Value value; + + private final String string; + + ListenV1Numerals(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListenV1Numerals && this.string.equals(((ListenV1Numerals) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FALSE: + return visitor.visitFalse(); + case TRUE: + return visitor.visitTrue(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListenV1Numerals valueOf(String value) { + switch (value) { + case "false": + return FALSE; + case "true": + return TRUE; + default: + return new ListenV1Numerals(Value.UNKNOWN, value); + } + } + + public enum Value { + TRUE, + + FALSE, + + UNKNOWN + } + + public interface Visitor { + T visitTrue(); + + T visitFalse(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1ProfanityFilter.java b/src/main/java/com/deepgram/types/ListenV1ProfanityFilter.java new file mode 100644 index 0000000..190b3a2 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1ProfanityFilter.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListenV1ProfanityFilter { + public static final ListenV1ProfanityFilter FALSE = new ListenV1ProfanityFilter(Value.FALSE, "false"); + + public static final ListenV1ProfanityFilter TRUE = new ListenV1ProfanityFilter(Value.TRUE, "true"); + + private final Value value; + + private final String string; + + ListenV1ProfanityFilter(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListenV1ProfanityFilter + && this.string.equals(((ListenV1ProfanityFilter) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FALSE: + return visitor.visitFalse(); + case TRUE: + return visitor.visitTrue(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListenV1ProfanityFilter valueOf(String value) { + switch (value) { + case "false": + return FALSE; + case "true": + return TRUE; + default: + return new ListenV1ProfanityFilter(Value.UNKNOWN, value); + } + } + + public enum Value { + TRUE, + + FALSE, + + UNKNOWN + } + + public interface Visitor { + T visitTrue(); + + T visitFalse(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1Punctuate.java b/src/main/java/com/deepgram/types/ListenV1Punctuate.java new file mode 100644 index 0000000..3fa6265 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1Punctuate.java @@ -0,0 +1,83 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListenV1Punctuate { + public static final ListenV1Punctuate FALSE = new ListenV1Punctuate(Value.FALSE, "false"); + + public static final ListenV1Punctuate TRUE = new ListenV1Punctuate(Value.TRUE, "true"); + + private final Value value; + + private final String string; + + ListenV1Punctuate(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListenV1Punctuate && this.string.equals(((ListenV1Punctuate) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FALSE: + return visitor.visitFalse(); + case TRUE: + return visitor.visitTrue(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListenV1Punctuate valueOf(String value) { + switch (value) { + case "false": + return FALSE; + case "true": + return TRUE; + default: + return new ListenV1Punctuate(Value.UNKNOWN, value); + } + } + + public enum Value { + TRUE, + + FALSE, + + UNKNOWN + } + + public interface Visitor { + T visitTrue(); + + T visitFalse(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1Redact.java b/src/main/java/com/deepgram/types/ListenV1Redact.java new file mode 100644 index 0000000..353f948 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1Redact.java @@ -0,0 +1,124 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListenV1Redact { + public static final ListenV1Redact FALSE = new ListenV1Redact(Value.FALSE, "false"); + + public static final ListenV1Redact SSN = new ListenV1Redact(Value.SSN, "ssn"); + + public static final ListenV1Redact TRUE = new ListenV1Redact(Value.TRUE, "true"); + + public static final ListenV1Redact NUMBERS = new ListenV1Redact(Value.NUMBERS, "numbers"); + + public static final ListenV1Redact AGGRESSIVE_NUMBERS = + new ListenV1Redact(Value.AGGRESSIVE_NUMBERS, "aggressive_numbers"); + + public static final ListenV1Redact PCI = new ListenV1Redact(Value.PCI, "pci"); + + private final Value value; + + private final String string; + + ListenV1Redact(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListenV1Redact && this.string.equals(((ListenV1Redact) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FALSE: + return visitor.visitFalse(); + case SSN: + return visitor.visitSsn(); + case TRUE: + return visitor.visitTrue(); + case NUMBERS: + return visitor.visitNumbers(); + case AGGRESSIVE_NUMBERS: + return visitor.visitAggressiveNumbers(); + case PCI: + return visitor.visitPci(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListenV1Redact valueOf(String value) { + switch (value) { + case "false": + return FALSE; + case "ssn": + return SSN; + case "true": + return TRUE; + case "numbers": + return NUMBERS; + case "aggressive_numbers": + return AGGRESSIVE_NUMBERS; + case "pci": + return PCI; + default: + return new ListenV1Redact(Value.UNKNOWN, value); + } + } + + public enum Value { + TRUE, + + FALSE, + + PCI, + + NUMBERS, + + AGGRESSIVE_NUMBERS, + + SSN, + + UNKNOWN + } + + public interface Visitor { + T visitTrue(); + + T visitFalse(); + + T visitPci(); + + T visitNumbers(); + + T visitAggressiveNumbers(); + + T visitSsn(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1Replace.java b/src/main/java/com/deepgram/types/ListenV1Replace.java new file mode 100644 index 0000000..18f36c6 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1Replace.java @@ -0,0 +1,42 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.WrappedAlias; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListenV1Replace implements WrappedAlias { + private final Object value; + + private ListenV1Replace(Object value) { + this.value = value; + } + + @JsonValue + public Object get() { + return this.value; + } + + @java.lang.Override + public boolean equals(Object other) { + return this == other + || (other instanceof ListenV1Replace && this.value.equals(((ListenV1Replace) other).value)); + } + + @java.lang.Override + public int hashCode() { + return value.hashCode(); + } + + @java.lang.Override + public String toString() { + return value.toString(); + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListenV1Replace of(Object value) { + return new ListenV1Replace(value); + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1Response.java b/src/main/java/com/deepgram/types/ListenV1Response.java new file mode 100644 index 0000000..b72d774 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1Response.java @@ -0,0 +1,143 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListenV1Response.Builder.class) +public final class ListenV1Response { + private final ListenV1ResponseMetadata metadata; + + private final ListenV1ResponseResults results; + + private final Map additionalProperties; + + private ListenV1Response( + ListenV1ResponseMetadata metadata, + ListenV1ResponseResults results, + Map additionalProperties) { + this.metadata = metadata; + this.results = results; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("metadata") + public ListenV1ResponseMetadata getMetadata() { + return metadata; + } + + @JsonProperty("results") + public ListenV1ResponseResults getResults() { + return results; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListenV1Response && equalTo((ListenV1Response) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListenV1Response other) { + return metadata.equals(other.metadata) && results.equals(other.results); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.metadata, this.results); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static MetadataStage builder() { + return new Builder(); + } + + public interface MetadataStage { + ResultsStage metadata(@NotNull ListenV1ResponseMetadata metadata); + + Builder from(ListenV1Response other); + } + + public interface ResultsStage { + _FinalStage results(@NotNull ListenV1ResponseResults results); + } + + public interface _FinalStage { + ListenV1Response build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements MetadataStage, ResultsStage, _FinalStage { + private ListenV1ResponseMetadata metadata; + + private ListenV1ResponseResults results; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListenV1Response other) { + metadata(other.getMetadata()); + results(other.getResults()); + return this; + } + + @java.lang.Override + @JsonSetter("metadata") + public ResultsStage metadata(@NotNull ListenV1ResponseMetadata metadata) { + this.metadata = Objects.requireNonNull(metadata, "metadata must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("results") + public _FinalStage results(@NotNull ListenV1ResponseResults results) { + this.results = Objects.requireNonNull(results, "results must not be null"); + return this; + } + + @java.lang.Override + public ListenV1Response build() { + return new ListenV1Response(metadata, results, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1ResponseMetadata.java b/src/main/java/com/deepgram/types/ListenV1ResponseMetadata.java new file mode 100644 index 0000000..2be9bdc --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1ResponseMetadata.java @@ -0,0 +1,516 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +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 = ListenV1ResponseMetadata.Builder.class) +public final class ListenV1ResponseMetadata { + private final Optional transactionKey; + + private final String requestId; + + private final String sha256; + + private final OffsetDateTime created; + + private final double duration; + + private final double channels; + + private final List models; + + private final Map modelInfo; + + private final Optional summaryInfo; + + private final Optional sentimentInfo; + + private final Optional topicsInfo; + + private final Optional intentsInfo; + + private final Optional> tags; + + private final Map additionalProperties; + + private ListenV1ResponseMetadata( + Optional transactionKey, + String requestId, + String sha256, + OffsetDateTime created, + double duration, + double channels, + List models, + Map modelInfo, + Optional summaryInfo, + Optional sentimentInfo, + Optional topicsInfo, + Optional intentsInfo, + Optional> tags, + Map additionalProperties) { + this.transactionKey = transactionKey; + this.requestId = requestId; + this.sha256 = sha256; + this.created = created; + this.duration = duration; + this.channels = channels; + this.models = models; + this.modelInfo = modelInfo; + this.summaryInfo = summaryInfo; + this.sentimentInfo = sentimentInfo; + this.topicsInfo = topicsInfo; + this.intentsInfo = intentsInfo; + this.tags = tags; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("transaction_key") + public Optional getTransactionKey() { + return transactionKey; + } + + @JsonProperty("request_id") + public String getRequestId() { + return requestId; + } + + @JsonProperty("sha256") + public String getSha256() { + return sha256; + } + + @JsonProperty("created") + public OffsetDateTime getCreated() { + return created; + } + + @JsonProperty("duration") + public double getDuration() { + return duration; + } + + @JsonProperty("channels") + public double getChannels() { + return channels; + } + + @JsonProperty("models") + public List getModels() { + return models; + } + + @JsonProperty("model_info") + public Map getModelInfo() { + return modelInfo; + } + + @JsonProperty("summary_info") + public Optional getSummaryInfo() { + return summaryInfo; + } + + @JsonProperty("sentiment_info") + public Optional getSentimentInfo() { + return sentimentInfo; + } + + @JsonProperty("topics_info") + public Optional getTopicsInfo() { + return topicsInfo; + } + + @JsonProperty("intents_info") + public Optional getIntentsInfo() { + return intentsInfo; + } + + @JsonProperty("tags") + public Optional> getTags() { + return tags; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListenV1ResponseMetadata && equalTo((ListenV1ResponseMetadata) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListenV1ResponseMetadata other) { + return transactionKey.equals(other.transactionKey) + && requestId.equals(other.requestId) + && sha256.equals(other.sha256) + && created.equals(other.created) + && duration == other.duration + && channels == other.channels + && models.equals(other.models) + && modelInfo.equals(other.modelInfo) + && summaryInfo.equals(other.summaryInfo) + && sentimentInfo.equals(other.sentimentInfo) + && topicsInfo.equals(other.topicsInfo) + && intentsInfo.equals(other.intentsInfo) + && tags.equals(other.tags); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.transactionKey, + this.requestId, + this.sha256, + this.created, + this.duration, + this.channels, + this.models, + this.modelInfo, + this.summaryInfo, + this.sentimentInfo, + this.topicsInfo, + this.intentsInfo, + this.tags); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static RequestIdStage builder() { + return new Builder(); + } + + public interface RequestIdStage { + Sha256Stage requestId(@NotNull String requestId); + + Builder from(ListenV1ResponseMetadata other); + } + + public interface Sha256Stage { + CreatedStage sha256(@NotNull String sha256); + } + + public interface CreatedStage { + DurationStage created(@NotNull OffsetDateTime created); + } + + public interface DurationStage { + ChannelsStage duration(double duration); + } + + public interface ChannelsStage { + _FinalStage channels(double channels); + } + + public interface _FinalStage { + ListenV1ResponseMetadata build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage transactionKey(Optional transactionKey); + + _FinalStage transactionKey(String transactionKey); + + _FinalStage models(List models); + + _FinalStage addModels(String models); + + _FinalStage addAllModels(List models); + + _FinalStage modelInfo(Map modelInfo); + + _FinalStage putAllModelInfo(Map modelInfo); + + _FinalStage modelInfo(String key, Object value); + + _FinalStage summaryInfo(Optional summaryInfo); + + _FinalStage summaryInfo(ListenV1ResponseMetadataSummaryInfo summaryInfo); + + _FinalStage sentimentInfo(Optional sentimentInfo); + + _FinalStage sentimentInfo(ListenV1ResponseMetadataSentimentInfo sentimentInfo); + + _FinalStage topicsInfo(Optional topicsInfo); + + _FinalStage topicsInfo(ListenV1ResponseMetadataTopicsInfo topicsInfo); + + _FinalStage intentsInfo(Optional intentsInfo); + + _FinalStage intentsInfo(ListenV1ResponseMetadataIntentsInfo intentsInfo); + + _FinalStage tags(Optional> tags); + + _FinalStage tags(List tags); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements RequestIdStage, Sha256Stage, CreatedStage, DurationStage, ChannelsStage, _FinalStage { + private String requestId; + + private String sha256; + + private OffsetDateTime created; + + private double duration; + + private double channels; + + private Optional> tags = Optional.empty(); + + private Optional intentsInfo = Optional.empty(); + + private Optional topicsInfo = Optional.empty(); + + private Optional sentimentInfo = Optional.empty(); + + private Optional summaryInfo = Optional.empty(); + + private Map modelInfo = new LinkedHashMap<>(); + + private List models = new ArrayList<>(); + + private Optional transactionKey = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListenV1ResponseMetadata other) { + transactionKey(other.getTransactionKey()); + requestId(other.getRequestId()); + sha256(other.getSha256()); + created(other.getCreated()); + duration(other.getDuration()); + channels(other.getChannels()); + models(other.getModels()); + modelInfo(other.getModelInfo()); + summaryInfo(other.getSummaryInfo()); + sentimentInfo(other.getSentimentInfo()); + topicsInfo(other.getTopicsInfo()); + intentsInfo(other.getIntentsInfo()); + tags(other.getTags()); + return this; + } + + @java.lang.Override + @JsonSetter("request_id") + public Sha256Stage requestId(@NotNull String requestId) { + this.requestId = Objects.requireNonNull(requestId, "requestId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("sha256") + public CreatedStage sha256(@NotNull String sha256) { + this.sha256 = Objects.requireNonNull(sha256, "sha256 must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("created") + public DurationStage created(@NotNull OffsetDateTime created) { + this.created = Objects.requireNonNull(created, "created must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("duration") + public ChannelsStage duration(double duration) { + this.duration = duration; + return this; + } + + @java.lang.Override + @JsonSetter("channels") + public _FinalStage channels(double channels) { + this.channels = channels; + return this; + } + + @java.lang.Override + public _FinalStage tags(List tags) { + this.tags = Optional.ofNullable(tags); + return this; + } + + @java.lang.Override + @JsonSetter(value = "tags", nulls = Nulls.SKIP) + public _FinalStage tags(Optional> tags) { + this.tags = tags; + return this; + } + + @java.lang.Override + public _FinalStage intentsInfo(ListenV1ResponseMetadataIntentsInfo intentsInfo) { + this.intentsInfo = Optional.ofNullable(intentsInfo); + return this; + } + + @java.lang.Override + @JsonSetter(value = "intents_info", nulls = Nulls.SKIP) + public _FinalStage intentsInfo(Optional intentsInfo) { + this.intentsInfo = intentsInfo; + return this; + } + + @java.lang.Override + public _FinalStage topicsInfo(ListenV1ResponseMetadataTopicsInfo topicsInfo) { + this.topicsInfo = Optional.ofNullable(topicsInfo); + return this; + } + + @java.lang.Override + @JsonSetter(value = "topics_info", nulls = Nulls.SKIP) + public _FinalStage topicsInfo(Optional topicsInfo) { + this.topicsInfo = topicsInfo; + return this; + } + + @java.lang.Override + public _FinalStage sentimentInfo(ListenV1ResponseMetadataSentimentInfo sentimentInfo) { + this.sentimentInfo = Optional.ofNullable(sentimentInfo); + return this; + } + + @java.lang.Override + @JsonSetter(value = "sentiment_info", nulls = Nulls.SKIP) + public _FinalStage sentimentInfo(Optional sentimentInfo) { + this.sentimentInfo = sentimentInfo; + return this; + } + + @java.lang.Override + public _FinalStage summaryInfo(ListenV1ResponseMetadataSummaryInfo summaryInfo) { + this.summaryInfo = Optional.ofNullable(summaryInfo); + return this; + } + + @java.lang.Override + @JsonSetter(value = "summary_info", nulls = Nulls.SKIP) + public _FinalStage summaryInfo(Optional summaryInfo) { + this.summaryInfo = summaryInfo; + return this; + } + + @java.lang.Override + public _FinalStage modelInfo(String key, Object value) { + this.modelInfo.put(key, value); + return this; + } + + @java.lang.Override + public _FinalStage putAllModelInfo(Map modelInfo) { + if (modelInfo != null) { + this.modelInfo.putAll(modelInfo); + } + return this; + } + + @java.lang.Override + @JsonSetter(value = "model_info", nulls = Nulls.SKIP) + public _FinalStage modelInfo(Map modelInfo) { + this.modelInfo.clear(); + if (modelInfo != null) { + this.modelInfo.putAll(modelInfo); + } + return this; + } + + @java.lang.Override + public _FinalStage addAllModels(List models) { + if (models != null) { + this.models.addAll(models); + } + return this; + } + + @java.lang.Override + public _FinalStage addModels(String models) { + this.models.add(models); + return this; + } + + @java.lang.Override + @JsonSetter(value = "models", nulls = Nulls.SKIP) + public _FinalStage models(List models) { + this.models.clear(); + if (models != null) { + this.models.addAll(models); + } + return this; + } + + @java.lang.Override + public _FinalStage transactionKey(String transactionKey) { + this.transactionKey = Optional.ofNullable(transactionKey); + return this; + } + + @java.lang.Override + @JsonSetter(value = "transaction_key", nulls = Nulls.SKIP) + public _FinalStage transactionKey(Optional transactionKey) { + this.transactionKey = transactionKey; + return this; + } + + @java.lang.Override + public ListenV1ResponseMetadata build() { + return new ListenV1ResponseMetadata( + transactionKey, + requestId, + sha256, + created, + duration, + channels, + models, + modelInfo, + summaryInfo, + sentimentInfo, + topicsInfo, + intentsInfo, + tags, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1ResponseMetadataIntentsInfo.java b/src/main/java/com/deepgram/types/ListenV1ResponseMetadataIntentsInfo.java new file mode 100644 index 0000000..c65f9c3 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1ResponseMetadataIntentsInfo.java @@ -0,0 +1,156 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListenV1ResponseMetadataIntentsInfo.Builder.class) +public final class ListenV1ResponseMetadataIntentsInfo { + private final Optional modelUuid; + + private final Optional inputTokens; + + private final Optional outputTokens; + + private final Map additionalProperties; + + private ListenV1ResponseMetadataIntentsInfo( + Optional modelUuid, + Optional inputTokens, + Optional outputTokens, + Map additionalProperties) { + this.modelUuid = modelUuid; + this.inputTokens = inputTokens; + this.outputTokens = outputTokens; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("model_uuid") + public Optional getModelUuid() { + return modelUuid; + } + + @JsonProperty("input_tokens") + public Optional getInputTokens() { + return inputTokens; + } + + @JsonProperty("output_tokens") + public Optional getOutputTokens() { + return outputTokens; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListenV1ResponseMetadataIntentsInfo + && equalTo((ListenV1ResponseMetadataIntentsInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListenV1ResponseMetadataIntentsInfo other) { + return modelUuid.equals(other.modelUuid) + && inputTokens.equals(other.inputTokens) + && outputTokens.equals(other.outputTokens); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.modelUuid, this.inputTokens, this.outputTokens); + } + + @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 modelUuid = Optional.empty(); + + private Optional inputTokens = Optional.empty(); + + private Optional outputTokens = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListenV1ResponseMetadataIntentsInfo other) { + modelUuid(other.getModelUuid()); + inputTokens(other.getInputTokens()); + outputTokens(other.getOutputTokens()); + return this; + } + + @JsonSetter(value = "model_uuid", nulls = Nulls.SKIP) + public Builder modelUuid(Optional modelUuid) { + this.modelUuid = modelUuid; + return this; + } + + public Builder modelUuid(String modelUuid) { + this.modelUuid = Optional.ofNullable(modelUuid); + return this; + } + + @JsonSetter(value = "input_tokens", nulls = Nulls.SKIP) + public Builder inputTokens(Optional inputTokens) { + this.inputTokens = inputTokens; + return this; + } + + public Builder inputTokens(Double inputTokens) { + this.inputTokens = Optional.ofNullable(inputTokens); + return this; + } + + @JsonSetter(value = "output_tokens", nulls = Nulls.SKIP) + public Builder outputTokens(Optional outputTokens) { + this.outputTokens = outputTokens; + return this; + } + + public Builder outputTokens(Double outputTokens) { + this.outputTokens = Optional.ofNullable(outputTokens); + return this; + } + + public ListenV1ResponseMetadataIntentsInfo build() { + return new ListenV1ResponseMetadataIntentsInfo(modelUuid, inputTokens, outputTokens, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1ResponseMetadataSentimentInfo.java b/src/main/java/com/deepgram/types/ListenV1ResponseMetadataSentimentInfo.java new file mode 100644 index 0000000..74bc0d3 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1ResponseMetadataSentimentInfo.java @@ -0,0 +1,157 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListenV1ResponseMetadataSentimentInfo.Builder.class) +public final class ListenV1ResponseMetadataSentimentInfo { + private final Optional modelUuid; + + private final Optional inputTokens; + + private final Optional outputTokens; + + private final Map additionalProperties; + + private ListenV1ResponseMetadataSentimentInfo( + Optional modelUuid, + Optional inputTokens, + Optional outputTokens, + Map additionalProperties) { + this.modelUuid = modelUuid; + this.inputTokens = inputTokens; + this.outputTokens = outputTokens; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("model_uuid") + public Optional getModelUuid() { + return modelUuid; + } + + @JsonProperty("input_tokens") + public Optional getInputTokens() { + return inputTokens; + } + + @JsonProperty("output_tokens") + public Optional getOutputTokens() { + return outputTokens; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListenV1ResponseMetadataSentimentInfo + && equalTo((ListenV1ResponseMetadataSentimentInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListenV1ResponseMetadataSentimentInfo other) { + return modelUuid.equals(other.modelUuid) + && inputTokens.equals(other.inputTokens) + && outputTokens.equals(other.outputTokens); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.modelUuid, this.inputTokens, this.outputTokens); + } + + @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 modelUuid = Optional.empty(); + + private Optional inputTokens = Optional.empty(); + + private Optional outputTokens = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListenV1ResponseMetadataSentimentInfo other) { + modelUuid(other.getModelUuid()); + inputTokens(other.getInputTokens()); + outputTokens(other.getOutputTokens()); + return this; + } + + @JsonSetter(value = "model_uuid", nulls = Nulls.SKIP) + public Builder modelUuid(Optional modelUuid) { + this.modelUuid = modelUuid; + return this; + } + + public Builder modelUuid(String modelUuid) { + this.modelUuid = Optional.ofNullable(modelUuid); + return this; + } + + @JsonSetter(value = "input_tokens", nulls = Nulls.SKIP) + public Builder inputTokens(Optional inputTokens) { + this.inputTokens = inputTokens; + return this; + } + + public Builder inputTokens(Double inputTokens) { + this.inputTokens = Optional.ofNullable(inputTokens); + return this; + } + + @JsonSetter(value = "output_tokens", nulls = Nulls.SKIP) + public Builder outputTokens(Optional outputTokens) { + this.outputTokens = outputTokens; + return this; + } + + public Builder outputTokens(Double outputTokens) { + this.outputTokens = Optional.ofNullable(outputTokens); + return this; + } + + public ListenV1ResponseMetadataSentimentInfo build() { + return new ListenV1ResponseMetadataSentimentInfo( + modelUuid, inputTokens, outputTokens, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1ResponseMetadataSummaryInfo.java b/src/main/java/com/deepgram/types/ListenV1ResponseMetadataSummaryInfo.java new file mode 100644 index 0000000..dbe312e --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1ResponseMetadataSummaryInfo.java @@ -0,0 +1,156 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListenV1ResponseMetadataSummaryInfo.Builder.class) +public final class ListenV1ResponseMetadataSummaryInfo { + private final Optional modelUuid; + + private final Optional inputTokens; + + private final Optional outputTokens; + + private final Map additionalProperties; + + private ListenV1ResponseMetadataSummaryInfo( + Optional modelUuid, + Optional inputTokens, + Optional outputTokens, + Map additionalProperties) { + this.modelUuid = modelUuid; + this.inputTokens = inputTokens; + this.outputTokens = outputTokens; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("model_uuid") + public Optional getModelUuid() { + return modelUuid; + } + + @JsonProperty("input_tokens") + public Optional getInputTokens() { + return inputTokens; + } + + @JsonProperty("output_tokens") + public Optional getOutputTokens() { + return outputTokens; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListenV1ResponseMetadataSummaryInfo + && equalTo((ListenV1ResponseMetadataSummaryInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListenV1ResponseMetadataSummaryInfo other) { + return modelUuid.equals(other.modelUuid) + && inputTokens.equals(other.inputTokens) + && outputTokens.equals(other.outputTokens); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.modelUuid, this.inputTokens, this.outputTokens); + } + + @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 modelUuid = Optional.empty(); + + private Optional inputTokens = Optional.empty(); + + private Optional outputTokens = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListenV1ResponseMetadataSummaryInfo other) { + modelUuid(other.getModelUuid()); + inputTokens(other.getInputTokens()); + outputTokens(other.getOutputTokens()); + return this; + } + + @JsonSetter(value = "model_uuid", nulls = Nulls.SKIP) + public Builder modelUuid(Optional modelUuid) { + this.modelUuid = modelUuid; + return this; + } + + public Builder modelUuid(String modelUuid) { + this.modelUuid = Optional.ofNullable(modelUuid); + return this; + } + + @JsonSetter(value = "input_tokens", nulls = Nulls.SKIP) + public Builder inputTokens(Optional inputTokens) { + this.inputTokens = inputTokens; + return this; + } + + public Builder inputTokens(Double inputTokens) { + this.inputTokens = Optional.ofNullable(inputTokens); + return this; + } + + @JsonSetter(value = "output_tokens", nulls = Nulls.SKIP) + public Builder outputTokens(Optional outputTokens) { + this.outputTokens = outputTokens; + return this; + } + + public Builder outputTokens(Double outputTokens) { + this.outputTokens = Optional.ofNullable(outputTokens); + return this; + } + + public ListenV1ResponseMetadataSummaryInfo build() { + return new ListenV1ResponseMetadataSummaryInfo(modelUuid, inputTokens, outputTokens, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1ResponseMetadataTopicsInfo.java b/src/main/java/com/deepgram/types/ListenV1ResponseMetadataTopicsInfo.java new file mode 100644 index 0000000..955cf19 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1ResponseMetadataTopicsInfo.java @@ -0,0 +1,156 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListenV1ResponseMetadataTopicsInfo.Builder.class) +public final class ListenV1ResponseMetadataTopicsInfo { + private final Optional modelUuid; + + private final Optional inputTokens; + + private final Optional outputTokens; + + private final Map additionalProperties; + + private ListenV1ResponseMetadataTopicsInfo( + Optional modelUuid, + Optional inputTokens, + Optional outputTokens, + Map additionalProperties) { + this.modelUuid = modelUuid; + this.inputTokens = inputTokens; + this.outputTokens = outputTokens; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("model_uuid") + public Optional getModelUuid() { + return modelUuid; + } + + @JsonProperty("input_tokens") + public Optional getInputTokens() { + return inputTokens; + } + + @JsonProperty("output_tokens") + public Optional getOutputTokens() { + return outputTokens; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListenV1ResponseMetadataTopicsInfo + && equalTo((ListenV1ResponseMetadataTopicsInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListenV1ResponseMetadataTopicsInfo other) { + return modelUuid.equals(other.modelUuid) + && inputTokens.equals(other.inputTokens) + && outputTokens.equals(other.outputTokens); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.modelUuid, this.inputTokens, this.outputTokens); + } + + @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 modelUuid = Optional.empty(); + + private Optional inputTokens = Optional.empty(); + + private Optional outputTokens = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListenV1ResponseMetadataTopicsInfo other) { + modelUuid(other.getModelUuid()); + inputTokens(other.getInputTokens()); + outputTokens(other.getOutputTokens()); + return this; + } + + @JsonSetter(value = "model_uuid", nulls = Nulls.SKIP) + public Builder modelUuid(Optional modelUuid) { + this.modelUuid = modelUuid; + return this; + } + + public Builder modelUuid(String modelUuid) { + this.modelUuid = Optional.ofNullable(modelUuid); + return this; + } + + @JsonSetter(value = "input_tokens", nulls = Nulls.SKIP) + public Builder inputTokens(Optional inputTokens) { + this.inputTokens = inputTokens; + return this; + } + + public Builder inputTokens(Double inputTokens) { + this.inputTokens = Optional.ofNullable(inputTokens); + return this; + } + + @JsonSetter(value = "output_tokens", nulls = Nulls.SKIP) + public Builder outputTokens(Optional outputTokens) { + this.outputTokens = outputTokens; + return this; + } + + public Builder outputTokens(Double outputTokens) { + this.outputTokens = Optional.ofNullable(outputTokens); + return this; + } + + public ListenV1ResponseMetadataTopicsInfo build() { + return new ListenV1ResponseMetadataTopicsInfo(modelUuid, inputTokens, outputTokens, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1ResponseResults.java b/src/main/java/com/deepgram/types/ListenV1ResponseResults.java new file mode 100644 index 0000000..8606645 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1ResponseResults.java @@ -0,0 +1,240 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = ListenV1ResponseResults.Builder.class) +public final class ListenV1ResponseResults { + private final List channels; + + private final Optional> utterances; + + private final Optional summary; + + private final Optional topics; + + private final Optional intents; + + private final Optional sentiments; + + private final Map additionalProperties; + + private ListenV1ResponseResults( + List channels, + Optional> utterances, + Optional summary, + Optional topics, + Optional intents, + Optional sentiments, + Map additionalProperties) { + this.channels = channels; + this.utterances = utterances; + this.summary = summary; + this.topics = topics; + this.intents = intents; + this.sentiments = sentiments; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("channels") + public List getChannels() { + return channels; + } + + @JsonProperty("utterances") + public Optional> getUtterances() { + return utterances; + } + + @JsonProperty("summary") + public Optional getSummary() { + return summary; + } + + @JsonProperty("topics") + public Optional getTopics() { + return topics; + } + + @JsonProperty("intents") + public Optional getIntents() { + return intents; + } + + @JsonProperty("sentiments") + public Optional getSentiments() { + return sentiments; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListenV1ResponseResults && equalTo((ListenV1ResponseResults) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListenV1ResponseResults other) { + return channels.equals(other.channels) + && utterances.equals(other.utterances) + && summary.equals(other.summary) + && topics.equals(other.topics) + && intents.equals(other.intents) + && sentiments.equals(other.sentiments); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.channels, this.utterances, this.summary, this.topics, this.intents, this.sentiments); + } + + @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 channels = new ArrayList<>(); + + private Optional> utterances = Optional.empty(); + + private Optional summary = Optional.empty(); + + private Optional topics = Optional.empty(); + + private Optional intents = Optional.empty(); + + private Optional sentiments = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListenV1ResponseResults other) { + channels(other.getChannels()); + utterances(other.getUtterances()); + summary(other.getSummary()); + topics(other.getTopics()); + intents(other.getIntents()); + sentiments(other.getSentiments()); + return this; + } + + @JsonSetter(value = "channels", nulls = Nulls.SKIP) + public Builder channels(List channels) { + this.channels.clear(); + if (channels != null) { + this.channels.addAll(channels); + } + return this; + } + + public Builder addChannels(ListenV1ResponseResultsChannelsItem channels) { + this.channels.add(channels); + return this; + } + + public Builder addAllChannels(List channels) { + if (channels != null) { + this.channels.addAll(channels); + } + return this; + } + + @JsonSetter(value = "utterances", nulls = Nulls.SKIP) + public Builder utterances(Optional> utterances) { + this.utterances = utterances; + return this; + } + + public Builder utterances(List utterances) { + this.utterances = Optional.ofNullable(utterances); + return this; + } + + @JsonSetter(value = "summary", nulls = Nulls.SKIP) + public Builder summary(Optional summary) { + this.summary = summary; + return this; + } + + public Builder summary(ListenV1ResponseResultsSummary summary) { + this.summary = Optional.ofNullable(summary); + return this; + } + + @JsonSetter(value = "topics", nulls = Nulls.SKIP) + public Builder topics(Optional topics) { + this.topics = topics; + return this; + } + + public Builder topics(SharedTopics topics) { + this.topics = Optional.ofNullable(topics); + return this; + } + + @JsonSetter(value = "intents", nulls = Nulls.SKIP) + public Builder intents(Optional intents) { + this.intents = intents; + return this; + } + + public Builder intents(SharedIntents intents) { + this.intents = Optional.ofNullable(intents); + return this; + } + + @JsonSetter(value = "sentiments", nulls = Nulls.SKIP) + public Builder sentiments(Optional sentiments) { + this.sentiments = sentiments; + return this; + } + + public Builder sentiments(SharedSentiments sentiments) { + this.sentiments = Optional.ofNullable(sentiments); + return this; + } + + public ListenV1ResponseResults build() { + return new ListenV1ResponseResults( + channels, utterances, summary, topics, intents, sentiments, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1ResponseResultsChannelsItem.java b/src/main/java/com/deepgram/types/ListenV1ResponseResultsChannelsItem.java new file mode 100644 index 0000000..8d1fa2f --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1ResponseResultsChannelsItem.java @@ -0,0 +1,158 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = ListenV1ResponseResultsChannelsItem.Builder.class) +public final class ListenV1ResponseResultsChannelsItem { + private final Optional> search; + + private final Optional> alternatives; + + private final Optional detectedLanguage; + + private final Map additionalProperties; + + private ListenV1ResponseResultsChannelsItem( + Optional> search, + Optional> alternatives, + Optional detectedLanguage, + Map additionalProperties) { + this.search = search; + this.alternatives = alternatives; + this.detectedLanguage = detectedLanguage; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("search") + public Optional> getSearch() { + return search; + } + + @JsonProperty("alternatives") + public Optional> getAlternatives() { + return alternatives; + } + + @JsonProperty("detected_language") + public Optional getDetectedLanguage() { + return detectedLanguage; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListenV1ResponseResultsChannelsItem + && equalTo((ListenV1ResponseResultsChannelsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListenV1ResponseResultsChannelsItem other) { + return search.equals(other.search) + && alternatives.equals(other.alternatives) + && detectedLanguage.equals(other.detectedLanguage); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.search, this.alternatives, this.detectedLanguage); + } + + @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> search = Optional.empty(); + + private Optional> alternatives = Optional.empty(); + + private Optional detectedLanguage = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListenV1ResponseResultsChannelsItem other) { + search(other.getSearch()); + alternatives(other.getAlternatives()); + detectedLanguage(other.getDetectedLanguage()); + return this; + } + + @JsonSetter(value = "search", nulls = Nulls.SKIP) + public Builder search(Optional> search) { + this.search = search; + return this; + } + + public Builder search(List search) { + this.search = Optional.ofNullable(search); + return this; + } + + @JsonSetter(value = "alternatives", nulls = Nulls.SKIP) + public Builder alternatives(Optional> alternatives) { + this.alternatives = alternatives; + return this; + } + + public Builder alternatives(List alternatives) { + this.alternatives = Optional.ofNullable(alternatives); + return this; + } + + @JsonSetter(value = "detected_language", nulls = Nulls.SKIP) + public Builder detectedLanguage(Optional detectedLanguage) { + this.detectedLanguage = detectedLanguage; + return this; + } + + public Builder detectedLanguage(String detectedLanguage) { + this.detectedLanguage = Optional.ofNullable(detectedLanguage); + return this; + } + + public ListenV1ResponseResultsChannelsItem build() { + return new ListenV1ResponseResultsChannelsItem( + search, alternatives, detectedLanguage, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1ResponseResultsChannelsItemAlternativesItem.java b/src/main/java/com/deepgram/types/ListenV1ResponseResultsChannelsItemAlternativesItem.java new file mode 100644 index 0000000..bb197db --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1ResponseResultsChannelsItemAlternativesItem.java @@ -0,0 +1,265 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = ListenV1ResponseResultsChannelsItemAlternativesItem.Builder.class) +public final class ListenV1ResponseResultsChannelsItemAlternativesItem { + private final Optional transcript; + + private final Optional confidence; + + private final Optional> words; + + private final Optional paragraphs; + + private final Optional> entities; + + private final Optional> summaries; + + private final Optional> topics; + + private final Map additionalProperties; + + private ListenV1ResponseResultsChannelsItemAlternativesItem( + Optional transcript, + Optional confidence, + Optional> words, + Optional paragraphs, + Optional> entities, + Optional> summaries, + Optional> topics, + Map additionalProperties) { + this.transcript = transcript; + this.confidence = confidence; + this.words = words; + this.paragraphs = paragraphs; + this.entities = entities; + this.summaries = summaries; + this.topics = topics; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("transcript") + public Optional getTranscript() { + return transcript; + } + + @JsonProperty("confidence") + public Optional getConfidence() { + return confidence; + } + + @JsonProperty("words") + public Optional> getWords() { + return words; + } + + @JsonProperty("paragraphs") + public Optional getParagraphs() { + return paragraphs; + } + + @JsonProperty("entities") + public Optional> getEntities() { + return entities; + } + + @JsonProperty("summaries") + public Optional> getSummaries() { + return summaries; + } + + @JsonProperty("topics") + public Optional> getTopics() { + return topics; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListenV1ResponseResultsChannelsItemAlternativesItem + && equalTo((ListenV1ResponseResultsChannelsItemAlternativesItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListenV1ResponseResultsChannelsItemAlternativesItem other) { + return transcript.equals(other.transcript) + && confidence.equals(other.confidence) + && words.equals(other.words) + && paragraphs.equals(other.paragraphs) + && entities.equals(other.entities) + && summaries.equals(other.summaries) + && topics.equals(other.topics); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.transcript, + this.confidence, + this.words, + this.paragraphs, + this.entities, + this.summaries, + this.topics); + } + + @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 transcript = Optional.empty(); + + private Optional confidence = Optional.empty(); + + private Optional> words = Optional.empty(); + + private Optional paragraphs = Optional.empty(); + + private Optional> entities = + Optional.empty(); + + private Optional> summaries = + Optional.empty(); + + private Optional> topics = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListenV1ResponseResultsChannelsItemAlternativesItem other) { + transcript(other.getTranscript()); + confidence(other.getConfidence()); + words(other.getWords()); + paragraphs(other.getParagraphs()); + entities(other.getEntities()); + summaries(other.getSummaries()); + topics(other.getTopics()); + 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; + } + + @JsonSetter(value = "confidence", nulls = Nulls.SKIP) + public Builder confidence(Optional confidence) { + this.confidence = confidence; + return this; + } + + public Builder confidence(Float confidence) { + this.confidence = Optional.ofNullable(confidence); + return this; + } + + @JsonSetter(value = "words", nulls = Nulls.SKIP) + public Builder words(Optional> words) { + this.words = words; + return this; + } + + public Builder words(List words) { + this.words = Optional.ofNullable(words); + return this; + } + + @JsonSetter(value = "paragraphs", nulls = Nulls.SKIP) + public Builder paragraphs(Optional paragraphs) { + this.paragraphs = paragraphs; + return this; + } + + public Builder paragraphs(ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs paragraphs) { + this.paragraphs = Optional.ofNullable(paragraphs); + return this; + } + + @JsonSetter(value = "entities", nulls = Nulls.SKIP) + public Builder entities( + Optional> entities) { + this.entities = entities; + return this; + } + + public Builder entities(List entities) { + this.entities = Optional.ofNullable(entities); + return this; + } + + @JsonSetter(value = "summaries", nulls = Nulls.SKIP) + public Builder summaries( + Optional> summaries) { + this.summaries = summaries; + return this; + } + + public Builder summaries(List summaries) { + this.summaries = Optional.ofNullable(summaries); + return this; + } + + @JsonSetter(value = "topics", nulls = Nulls.SKIP) + public Builder topics(Optional> topics) { + this.topics = topics; + return this; + } + + public Builder topics(List topics) { + this.topics = Optional.ofNullable(topics); + return this; + } + + public ListenV1ResponseResultsChannelsItemAlternativesItem build() { + return new ListenV1ResponseResultsChannelsItemAlternativesItem( + transcript, confidence, words, paragraphs, entities, summaries, topics, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItem.java b/src/main/java/com/deepgram/types/ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItem.java new file mode 100644 index 0000000..6121c80 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItem.java @@ -0,0 +1,229 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItem.Builder.class) +public final class ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItem { + private final Optional label; + + private final Optional value; + + private final Optional rawValue; + + private final Optional confidence; + + private final Optional startWord; + + private final Optional endWord; + + private final Map additionalProperties; + + private ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItem( + Optional label, + Optional value, + Optional rawValue, + Optional confidence, + Optional startWord, + Optional endWord, + Map additionalProperties) { + this.label = label; + this.value = value; + this.rawValue = rawValue; + this.confidence = confidence; + this.startWord = startWord; + this.endWord = endWord; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("label") + public Optional getLabel() { + return label; + } + + @JsonProperty("value") + public Optional getValue() { + return value; + } + + @JsonProperty("raw_value") + public Optional getRawValue() { + return rawValue; + } + + @JsonProperty("confidence") + public Optional getConfidence() { + return confidence; + } + + @JsonProperty("start_word") + public Optional getStartWord() { + return startWord; + } + + @JsonProperty("end_word") + public Optional getEndWord() { + return endWord; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItem + && equalTo((ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItem other) { + return label.equals(other.label) + && value.equals(other.value) + && rawValue.equals(other.rawValue) + && confidence.equals(other.confidence) + && startWord.equals(other.startWord) + && endWord.equals(other.endWord); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.label, this.value, this.rawValue, this.confidence, this.startWord, this.endWord); + } + + @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 label = Optional.empty(); + + private Optional value = Optional.empty(); + + private Optional rawValue = Optional.empty(); + + private Optional confidence = Optional.empty(); + + private Optional startWord = Optional.empty(); + + private Optional endWord = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItem other) { + label(other.getLabel()); + value(other.getValue()); + rawValue(other.getRawValue()); + confidence(other.getConfidence()); + startWord(other.getStartWord()); + endWord(other.getEndWord()); + return this; + } + + @JsonSetter(value = "label", nulls = Nulls.SKIP) + public Builder label(Optional label) { + this.label = label; + return this; + } + + public Builder label(String label) { + this.label = Optional.ofNullable(label); + return this; + } + + @JsonSetter(value = "value", nulls = Nulls.SKIP) + public Builder value(Optional value) { + this.value = value; + return this; + } + + public Builder value(String value) { + this.value = Optional.ofNullable(value); + return this; + } + + @JsonSetter(value = "raw_value", nulls = Nulls.SKIP) + public Builder rawValue(Optional rawValue) { + this.rawValue = rawValue; + return this; + } + + public Builder rawValue(String rawValue) { + this.rawValue = Optional.ofNullable(rawValue); + return this; + } + + @JsonSetter(value = "confidence", nulls = Nulls.SKIP) + public Builder confidence(Optional confidence) { + this.confidence = confidence; + return this; + } + + public Builder confidence(Float confidence) { + this.confidence = Optional.ofNullable(confidence); + return this; + } + + @JsonSetter(value = "start_word", nulls = Nulls.SKIP) + public Builder startWord(Optional startWord) { + this.startWord = startWord; + return this; + } + + public Builder startWord(Float startWord) { + this.startWord = Optional.ofNullable(startWord); + return this; + } + + @JsonSetter(value = "end_word", nulls = Nulls.SKIP) + public Builder endWord(Optional endWord) { + this.endWord = endWord; + return this; + } + + public Builder endWord(Float endWord) { + this.endWord = Optional.ofNullable(endWord); + return this; + } + + public ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItem build() { + return new ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItem( + label, value, rawValue, confidence, startWord, endWord, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs.java b/src/main/java/com/deepgram/types/ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs.java new file mode 100644 index 0000000..40fbc29 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs.java @@ -0,0 +1,138 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs.Builder.class) +public final class ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs { + private final Optional transcript; + + private final Optional> + paragraphs; + + private final Map additionalProperties; + + private ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs( + Optional transcript, + Optional> paragraphs, + Map additionalProperties) { + this.transcript = transcript; + this.paragraphs = paragraphs; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("transcript") + public Optional getTranscript() { + return transcript; + } + + @JsonProperty("paragraphs") + public Optional> getParagraphs() { + return paragraphs; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs + && equalTo((ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs other) { + return transcript.equals(other.transcript) && paragraphs.equals(other.paragraphs); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.transcript, this.paragraphs); + } + + @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 transcript = Optional.empty(); + + private Optional> paragraphs = + Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs other) { + transcript(other.getTranscript()); + paragraphs(other.getParagraphs()); + 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; + } + + @JsonSetter(value = "paragraphs", nulls = Nulls.SKIP) + public Builder paragraphs( + Optional> + paragraphs) { + this.paragraphs = paragraphs; + return this; + } + + public Builder paragraphs( + List paragraphs) { + this.paragraphs = Optional.ofNullable(paragraphs); + return this; + } + + public ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs build() { + return new ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs( + transcript, paragraphs, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItem.java b/src/main/java/com/deepgram/types/ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItem.java new file mode 100644 index 0000000..51e4c84 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItem.java @@ -0,0 +1,215 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItem.Builder.class) +public final class ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItem { + private final Optional< + List> + sentences; + + private final Optional speaker; + + private final Optional numWords; + + private final Optional start; + + private final Optional end; + + private final Map additionalProperties; + + private ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItem( + Optional> + sentences, + Optional speaker, + Optional numWords, + Optional start, + Optional end, + Map additionalProperties) { + this.sentences = sentences; + this.speaker = speaker; + this.numWords = numWords; + this.start = start; + this.end = end; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("sentences") + public Optional> + getSentences() { + return sentences; + } + + @JsonProperty("speaker") + public Optional getSpeaker() { + return speaker; + } + + @JsonProperty("num_words") + public Optional getNumWords() { + return numWords; + } + + @JsonProperty("start") + public Optional getStart() { + return start; + } + + @JsonProperty("end") + public Optional getEnd() { + return end; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItem + && equalTo((ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItem other) { + return sentences.equals(other.sentences) + && speaker.equals(other.speaker) + && numWords.equals(other.numWords) + && start.equals(other.start) + && end.equals(other.end); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.sentences, this.speaker, this.numWords, this.start, this.end); + } + + @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> + sentences = Optional.empty(); + + private Optional speaker = Optional.empty(); + + private Optional numWords = Optional.empty(); + + private Optional start = Optional.empty(); + + private Optional end = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItem other) { + sentences(other.getSentences()); + speaker(other.getSpeaker()); + numWords(other.getNumWords()); + start(other.getStart()); + end(other.getEnd()); + return this; + } + + @JsonSetter(value = "sentences", nulls = Nulls.SKIP) + public Builder sentences( + Optional> + sentences) { + this.sentences = sentences; + return this; + } + + public Builder sentences( + List + sentences) { + this.sentences = Optional.ofNullable(sentences); + return this; + } + + @JsonSetter(value = "speaker", nulls = Nulls.SKIP) + public Builder speaker(Optional speaker) { + this.speaker = speaker; + return this; + } + + public Builder speaker(Float speaker) { + this.speaker = Optional.ofNullable(speaker); + return this; + } + + @JsonSetter(value = "num_words", nulls = Nulls.SKIP) + public Builder numWords(Optional numWords) { + this.numWords = numWords; + return this; + } + + public Builder numWords(Float numWords) { + this.numWords = Optional.ofNullable(numWords); + return this; + } + + @JsonSetter(value = "start", nulls = Nulls.SKIP) + public Builder start(Optional start) { + this.start = start; + return this; + } + + public Builder start(Float 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(Float end) { + this.end = Optional.ofNullable(end); + return this; + } + + public ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItem build() { + return new ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItem( + sentences, speaker, numWords, start, end, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem.java b/src/main/java/com/deepgram/types/ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem.java new file mode 100644 index 0000000..97fc4a7 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem.java @@ -0,0 +1,160 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize( + builder = + ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem.Builder.class) +public final class ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem { + private final Optional text; + + private final Optional start; + + private final Optional end; + + private final Map additionalProperties; + + private ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem( + Optional text, + Optional start, + Optional end, + Map additionalProperties) { + this.text = text; + this.start = start; + this.end = end; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("text") + public Optional getText() { + return text; + } + + @JsonProperty("start") + public Optional getStart() { + return start; + } + + @JsonProperty("end") + public Optional getEnd() { + return end; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem + && equalTo((ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem) + other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo( + ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem other) { + return text.equals(other.text) && start.equals(other.start) && end.equals(other.end); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.text, this.start, this.end); + } + + @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 text = Optional.empty(); + + private Optional start = Optional.empty(); + + private Optional end = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from( + ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem other) { + text(other.getText()); + start(other.getStart()); + end(other.getEnd()); + return this; + } + + @JsonSetter(value = "text", nulls = Nulls.SKIP) + public Builder text(Optional text) { + this.text = text; + return this; + } + + public Builder text(String text) { + this.text = Optional.ofNullable(text); + return this; + } + + @JsonSetter(value = "start", nulls = Nulls.SKIP) + public Builder start(Optional start) { + this.start = start; + return this; + } + + public Builder start(Float 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(Float end) { + this.end = Optional.ofNullable(end); + return this; + } + + public ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem build() { + return new ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem( + text, start, end, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItem.java b/src/main/java/com/deepgram/types/ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItem.java new file mode 100644 index 0000000..c513786 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItem.java @@ -0,0 +1,155 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItem.Builder.class) +public final class ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItem { + private final Optional summary; + + private final Optional startWord; + + private final Optional endWord; + + private final Map additionalProperties; + + private ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItem( + Optional summary, + Optional startWord, + Optional endWord, + Map additionalProperties) { + this.summary = summary; + this.startWord = startWord; + this.endWord = endWord; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("summary") + public Optional getSummary() { + return summary; + } + + @JsonProperty("start_word") + public Optional getStartWord() { + return startWord; + } + + @JsonProperty("end_word") + public Optional getEndWord() { + return endWord; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItem + && equalTo((ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItem other) { + return summary.equals(other.summary) && startWord.equals(other.startWord) && endWord.equals(other.endWord); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.summary, this.startWord, this.endWord); + } + + @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 startWord = Optional.empty(); + + private Optional endWord = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItem other) { + summary(other.getSummary()); + startWord(other.getStartWord()); + endWord(other.getEndWord()); + 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 = "start_word", nulls = Nulls.SKIP) + public Builder startWord(Optional startWord) { + this.startWord = startWord; + return this; + } + + public Builder startWord(Float startWord) { + this.startWord = Optional.ofNullable(startWord); + return this; + } + + @JsonSetter(value = "end_word", nulls = Nulls.SKIP) + public Builder endWord(Optional endWord) { + this.endWord = endWord; + return this; + } + + public Builder endWord(Float endWord) { + this.endWord = Optional.ofNullable(endWord); + return this; + } + + public ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItem build() { + return new ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItem( + summary, startWord, endWord, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItem.java b/src/main/java/com/deepgram/types/ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItem.java new file mode 100644 index 0000000..18bd5e2 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItem.java @@ -0,0 +1,182 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItem.Builder.class) +public final class ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItem { + private final Optional text; + + private final Optional startWord; + + private final Optional endWord; + + private final Optional> topics; + + private final Map additionalProperties; + + private ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItem( + Optional text, + Optional startWord, + Optional endWord, + Optional> topics, + Map additionalProperties) { + this.text = text; + this.startWord = startWord; + this.endWord = endWord; + this.topics = topics; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("text") + public Optional getText() { + return text; + } + + @JsonProperty("start_word") + public Optional getStartWord() { + return startWord; + } + + @JsonProperty("end_word") + public Optional getEndWord() { + return endWord; + } + + @JsonProperty("topics") + public Optional> getTopics() { + return topics; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItem + && equalTo((ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItem other) { + return text.equals(other.text) + && startWord.equals(other.startWord) + && endWord.equals(other.endWord) + && topics.equals(other.topics); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.text, this.startWord, this.endWord, this.topics); + } + + @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 text = Optional.empty(); + + private Optional startWord = Optional.empty(); + + private Optional endWord = Optional.empty(); + + private Optional> topics = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItem other) { + text(other.getText()); + startWord(other.getStartWord()); + endWord(other.getEndWord()); + topics(other.getTopics()); + return this; + } + + @JsonSetter(value = "text", nulls = Nulls.SKIP) + public Builder text(Optional text) { + this.text = text; + return this; + } + + public Builder text(String text) { + this.text = Optional.ofNullable(text); + return this; + } + + @JsonSetter(value = "start_word", nulls = Nulls.SKIP) + public Builder startWord(Optional startWord) { + this.startWord = startWord; + return this; + } + + public Builder startWord(Float startWord) { + this.startWord = Optional.ofNullable(startWord); + return this; + } + + @JsonSetter(value = "end_word", nulls = Nulls.SKIP) + public Builder endWord(Optional endWord) { + this.endWord = endWord; + return this; + } + + public Builder endWord(Float endWord) { + this.endWord = Optional.ofNullable(endWord); + return this; + } + + @JsonSetter(value = "topics", nulls = Nulls.SKIP) + public Builder topics(Optional> topics) { + this.topics = topics; + return this; + } + + public Builder topics(List topics) { + this.topics = Optional.ofNullable(topics); + return this; + } + + public ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItem build() { + return new ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItem( + text, startWord, endWord, topics, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem.java b/src/main/java/com/deepgram/types/ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem.java new file mode 100644 index 0000000..b54fa41 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem.java @@ -0,0 +1,181 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem.Builder.class) +public final class ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem { + private final Optional word; + + private final Optional start; + + private final Optional end; + + private final Optional confidence; + + private final Map additionalProperties; + + private ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem( + Optional word, + Optional start, + Optional end, + Optional confidence, + Map additionalProperties) { + this.word = word; + this.start = start; + this.end = end; + this.confidence = confidence; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("word") + public Optional getWord() { + return word; + } + + @JsonProperty("start") + public Optional getStart() { + return start; + } + + @JsonProperty("end") + public Optional getEnd() { + return end; + } + + @JsonProperty("confidence") + public Optional getConfidence() { + return confidence; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem + && equalTo((ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem other) { + return word.equals(other.word) + && start.equals(other.start) + && end.equals(other.end) + && confidence.equals(other.confidence); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.word, this.start, this.end, this.confidence); + } + + @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 word = Optional.empty(); + + private Optional start = Optional.empty(); + + private Optional end = Optional.empty(); + + private Optional confidence = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem other) { + word(other.getWord()); + start(other.getStart()); + end(other.getEnd()); + confidence(other.getConfidence()); + return this; + } + + @JsonSetter(value = "word", nulls = Nulls.SKIP) + public Builder word(Optional word) { + this.word = word; + return this; + } + + public Builder word(String word) { + this.word = Optional.ofNullable(word); + return this; + } + + @JsonSetter(value = "start", nulls = Nulls.SKIP) + public Builder start(Optional start) { + this.start = start; + return this; + } + + public Builder start(Float 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(Float end) { + this.end = Optional.ofNullable(end); + return this; + } + + @JsonSetter(value = "confidence", nulls = Nulls.SKIP) + public Builder confidence(Optional confidence) { + this.confidence = confidence; + return this; + } + + public Builder confidence(Float confidence) { + this.confidence = Optional.ofNullable(confidence); + return this; + } + + public ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem build() { + return new ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem( + word, start, end, confidence, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1ResponseResultsChannelsItemSearchItem.java b/src/main/java/com/deepgram/types/ListenV1ResponseResultsChannelsItemSearchItem.java new file mode 100644 index 0000000..2b40c79 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1ResponseResultsChannelsItemSearchItem.java @@ -0,0 +1,132 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = ListenV1ResponseResultsChannelsItemSearchItem.Builder.class) +public final class ListenV1ResponseResultsChannelsItemSearchItem { + private final Optional query; + + private final Optional> hits; + + private final Map additionalProperties; + + private ListenV1ResponseResultsChannelsItemSearchItem( + Optional query, + Optional> hits, + Map additionalProperties) { + this.query = query; + this.hits = hits; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("query") + public Optional getQuery() { + return query; + } + + @JsonProperty("hits") + public Optional> getHits() { + return hits; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListenV1ResponseResultsChannelsItemSearchItem + && equalTo((ListenV1ResponseResultsChannelsItemSearchItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListenV1ResponseResultsChannelsItemSearchItem other) { + return query.equals(other.query) && hits.equals(other.hits); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.query, this.hits); + } + + @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 query = Optional.empty(); + + private Optional> hits = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListenV1ResponseResultsChannelsItemSearchItem other) { + query(other.getQuery()); + hits(other.getHits()); + return this; + } + + @JsonSetter(value = "query", nulls = Nulls.SKIP) + public Builder query(Optional query) { + this.query = query; + return this; + } + + public Builder query(String query) { + this.query = Optional.ofNullable(query); + return this; + } + + @JsonSetter(value = "hits", nulls = Nulls.SKIP) + public Builder hits(Optional> hits) { + this.hits = hits; + return this; + } + + public Builder hits(List hits) { + this.hits = Optional.ofNullable(hits); + return this; + } + + public ListenV1ResponseResultsChannelsItemSearchItem build() { + return new ListenV1ResponseResultsChannelsItemSearchItem(query, hits, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1ResponseResultsChannelsItemSearchItemHitsItem.java b/src/main/java/com/deepgram/types/ListenV1ResponseResultsChannelsItemSearchItemHitsItem.java new file mode 100644 index 0000000..3974f94 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1ResponseResultsChannelsItemSearchItemHitsItem.java @@ -0,0 +1,181 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListenV1ResponseResultsChannelsItemSearchItemHitsItem.Builder.class) +public final class ListenV1ResponseResultsChannelsItemSearchItemHitsItem { + private final Optional confidence; + + private final Optional start; + + private final Optional end; + + private final Optional snippet; + + private final Map additionalProperties; + + private ListenV1ResponseResultsChannelsItemSearchItemHitsItem( + Optional confidence, + Optional start, + Optional end, + Optional snippet, + Map additionalProperties) { + this.confidence = confidence; + this.start = start; + this.end = end; + this.snippet = snippet; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("confidence") + public Optional getConfidence() { + return confidence; + } + + @JsonProperty("start") + public Optional getStart() { + return start; + } + + @JsonProperty("end") + public Optional getEnd() { + return end; + } + + @JsonProperty("snippet") + public Optional getSnippet() { + return snippet; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListenV1ResponseResultsChannelsItemSearchItemHitsItem + && equalTo((ListenV1ResponseResultsChannelsItemSearchItemHitsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListenV1ResponseResultsChannelsItemSearchItemHitsItem other) { + return confidence.equals(other.confidence) + && start.equals(other.start) + && end.equals(other.end) + && snippet.equals(other.snippet); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.confidence, this.start, this.end, this.snippet); + } + + @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 confidence = Optional.empty(); + + private Optional start = Optional.empty(); + + private Optional end = Optional.empty(); + + private Optional snippet = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListenV1ResponseResultsChannelsItemSearchItemHitsItem other) { + confidence(other.getConfidence()); + start(other.getStart()); + end(other.getEnd()); + snippet(other.getSnippet()); + return this; + } + + @JsonSetter(value = "confidence", nulls = Nulls.SKIP) + public Builder confidence(Optional confidence) { + this.confidence = confidence; + return this; + } + + public Builder confidence(Float confidence) { + this.confidence = Optional.ofNullable(confidence); + return this; + } + + @JsonSetter(value = "start", nulls = Nulls.SKIP) + public Builder start(Optional start) { + this.start = start; + return this; + } + + public Builder start(Float 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(Float end) { + this.end = Optional.ofNullable(end); + return this; + } + + @JsonSetter(value = "snippet", nulls = Nulls.SKIP) + public Builder snippet(Optional snippet) { + this.snippet = snippet; + return this; + } + + public Builder snippet(String snippet) { + this.snippet = Optional.ofNullable(snippet); + return this; + } + + public ListenV1ResponseResultsChannelsItemSearchItemHitsItem build() { + return new ListenV1ResponseResultsChannelsItemSearchItemHitsItem( + confidence, start, end, snippet, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1ResponseResultsSummary.java b/src/main/java/com/deepgram/types/ListenV1ResponseResultsSummary.java new file mode 100644 index 0000000..e9ead0d --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1ResponseResultsSummary.java @@ -0,0 +1,128 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListenV1ResponseResultsSummary.Builder.class) +public final class ListenV1ResponseResultsSummary { + private final Optional result; + + private final Optional short_; + + private final Map additionalProperties; + + private ListenV1ResponseResultsSummary( + Optional result, Optional short_, Map additionalProperties) { + this.result = result; + this.short_ = short_; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("result") + public Optional getResult() { + return result; + } + + @JsonProperty("short") + public Optional getShort() { + return short_; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListenV1ResponseResultsSummary && equalTo((ListenV1ResponseResultsSummary) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListenV1ResponseResultsSummary other) { + return result.equals(other.result) && short_.equals(other.short_); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.result, this.short_); + } + + @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 result = Optional.empty(); + + private Optional short_ = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListenV1ResponseResultsSummary other) { + result(other.getResult()); + short_(other.getShort()); + return this; + } + + @JsonSetter(value = "result", nulls = Nulls.SKIP) + public Builder result(Optional result) { + this.result = result; + return this; + } + + public Builder result(String result) { + this.result = Optional.ofNullable(result); + return this; + } + + @JsonSetter(value = "short", nulls = Nulls.SKIP) + public Builder short_(Optional short_) { + this.short_ = short_; + return this; + } + + public Builder short_(String short_) { + this.short_ = Optional.ofNullable(short_); + return this; + } + + public ListenV1ResponseResultsSummary build() { + return new ListenV1ResponseResultsSummary(result, short_, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1ResponseResultsUtterancesItem.java b/src/main/java/com/deepgram/types/ListenV1ResponseResultsUtterancesItem.java new file mode 100644 index 0000000..16115a3 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1ResponseResultsUtterancesItem.java @@ -0,0 +1,286 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = ListenV1ResponseResultsUtterancesItem.Builder.class) +public final class ListenV1ResponseResultsUtterancesItem { + private final Optional start; + + private final Optional end; + + private final Optional confidence; + + private final Optional channel; + + private final Optional transcript; + + private final Optional> words; + + private final Optional speaker; + + private final Optional id; + + private final Map additionalProperties; + + private ListenV1ResponseResultsUtterancesItem( + Optional start, + Optional end, + Optional confidence, + Optional channel, + Optional transcript, + Optional> words, + Optional speaker, + Optional id, + Map additionalProperties) { + this.start = start; + this.end = end; + this.confidence = confidence; + this.channel = channel; + this.transcript = transcript; + this.words = words; + this.speaker = speaker; + this.id = id; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("start") + public Optional getStart() { + return start; + } + + @JsonProperty("end") + public Optional getEnd() { + return end; + } + + @JsonProperty("confidence") + public Optional getConfidence() { + return confidence; + } + + @JsonProperty("channel") + public Optional getChannel() { + return channel; + } + + @JsonProperty("transcript") + public Optional getTranscript() { + return transcript; + } + + @JsonProperty("words") + public Optional> getWords() { + return words; + } + + @JsonProperty("speaker") + public Optional getSpeaker() { + return speaker; + } + + @JsonProperty("id") + public Optional getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListenV1ResponseResultsUtterancesItem + && equalTo((ListenV1ResponseResultsUtterancesItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListenV1ResponseResultsUtterancesItem other) { + return start.equals(other.start) + && end.equals(other.end) + && confidence.equals(other.confidence) + && channel.equals(other.channel) + && transcript.equals(other.transcript) + && words.equals(other.words) + && speaker.equals(other.speaker) + && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.start, + this.end, + this.confidence, + this.channel, + this.transcript, + this.words, + this.speaker, + this.id); + } + + @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 start = Optional.empty(); + + private Optional end = Optional.empty(); + + private Optional confidence = Optional.empty(); + + private Optional channel = Optional.empty(); + + private Optional transcript = Optional.empty(); + + private Optional> words = Optional.empty(); + + private Optional speaker = Optional.empty(); + + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListenV1ResponseResultsUtterancesItem other) { + start(other.getStart()); + end(other.getEnd()); + confidence(other.getConfidence()); + channel(other.getChannel()); + transcript(other.getTranscript()); + words(other.getWords()); + speaker(other.getSpeaker()); + id(other.getId()); + return this; + } + + @JsonSetter(value = "start", nulls = Nulls.SKIP) + public Builder start(Optional start) { + this.start = start; + return this; + } + + public Builder start(Float 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(Float end) { + this.end = Optional.ofNullable(end); + return this; + } + + @JsonSetter(value = "confidence", nulls = Nulls.SKIP) + public Builder confidence(Optional confidence) { + this.confidence = confidence; + return this; + } + + public Builder confidence(Float confidence) { + this.confidence = Optional.ofNullable(confidence); + return this; + } + + @JsonSetter(value = "channel", nulls = Nulls.SKIP) + public Builder channel(Optional channel) { + this.channel = channel; + return this; + } + + public Builder channel(Float channel) { + this.channel = Optional.ofNullable(channel); + 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; + } + + @JsonSetter(value = "words", nulls = Nulls.SKIP) + public Builder words(Optional> words) { + this.words = words; + return this; + } + + public Builder words(List words) { + this.words = Optional.ofNullable(words); + return this; + } + + @JsonSetter(value = "speaker", nulls = Nulls.SKIP) + public Builder speaker(Optional speaker) { + this.speaker = speaker; + return this; + } + + public Builder speaker(Float speaker) { + this.speaker = Optional.ofNullable(speaker); + return this; + } + + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + public ListenV1ResponseResultsUtterancesItem build() { + return new ListenV1ResponseResultsUtterancesItem( + start, end, confidence, channel, transcript, words, speaker, id, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1ResponseResultsUtterancesItemWordsItem.java b/src/main/java/com/deepgram/types/ListenV1ResponseResultsUtterancesItemWordsItem.java new file mode 100644 index 0000000..69f3016 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1ResponseResultsUtterancesItemWordsItem.java @@ -0,0 +1,260 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListenV1ResponseResultsUtterancesItemWordsItem.Builder.class) +public final class ListenV1ResponseResultsUtterancesItemWordsItem { + private final Optional word; + + private final Optional start; + + private final Optional end; + + private final Optional confidence; + + private final Optional speaker; + + private final Optional speakerConfidence; + + private final Optional punctuatedWord; + + private final Map additionalProperties; + + private ListenV1ResponseResultsUtterancesItemWordsItem( + Optional word, + Optional start, + Optional end, + Optional confidence, + Optional speaker, + Optional speakerConfidence, + Optional punctuatedWord, + Map additionalProperties) { + this.word = word; + this.start = start; + this.end = end; + this.confidence = confidence; + this.speaker = speaker; + this.speakerConfidence = speakerConfidence; + this.punctuatedWord = punctuatedWord; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("word") + public Optional getWord() { + return word; + } + + @JsonProperty("start") + public Optional getStart() { + return start; + } + + @JsonProperty("end") + public Optional getEnd() { + return end; + } + + @JsonProperty("confidence") + public Optional getConfidence() { + return confidence; + } + + @JsonProperty("speaker") + public Optional getSpeaker() { + return speaker; + } + + @JsonProperty("speaker_confidence") + public Optional getSpeakerConfidence() { + return speakerConfidence; + } + + @JsonProperty("punctuated_word") + public Optional getPunctuatedWord() { + return punctuatedWord; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListenV1ResponseResultsUtterancesItemWordsItem + && equalTo((ListenV1ResponseResultsUtterancesItemWordsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListenV1ResponseResultsUtterancesItemWordsItem other) { + return word.equals(other.word) + && start.equals(other.start) + && end.equals(other.end) + && confidence.equals(other.confidence) + && speaker.equals(other.speaker) + && speakerConfidence.equals(other.speakerConfidence) + && punctuatedWord.equals(other.punctuatedWord); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.word, + this.start, + this.end, + this.confidence, + this.speaker, + this.speakerConfidence, + this.punctuatedWord); + } + + @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 word = Optional.empty(); + + private Optional start = Optional.empty(); + + private Optional end = Optional.empty(); + + private Optional confidence = Optional.empty(); + + private Optional speaker = Optional.empty(); + + private Optional speakerConfidence = Optional.empty(); + + private Optional punctuatedWord = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ListenV1ResponseResultsUtterancesItemWordsItem other) { + word(other.getWord()); + start(other.getStart()); + end(other.getEnd()); + confidence(other.getConfidence()); + speaker(other.getSpeaker()); + speakerConfidence(other.getSpeakerConfidence()); + punctuatedWord(other.getPunctuatedWord()); + return this; + } + + @JsonSetter(value = "word", nulls = Nulls.SKIP) + public Builder word(Optional word) { + this.word = word; + return this; + } + + public Builder word(String word) { + this.word = Optional.ofNullable(word); + return this; + } + + @JsonSetter(value = "start", nulls = Nulls.SKIP) + public Builder start(Optional start) { + this.start = start; + return this; + } + + public Builder start(Float 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(Float end) { + this.end = Optional.ofNullable(end); + return this; + } + + @JsonSetter(value = "confidence", nulls = Nulls.SKIP) + public Builder confidence(Optional confidence) { + this.confidence = confidence; + return this; + } + + public Builder confidence(Float confidence) { + this.confidence = Optional.ofNullable(confidence); + return this; + } + + @JsonSetter(value = "speaker", nulls = Nulls.SKIP) + public Builder speaker(Optional speaker) { + this.speaker = speaker; + return this; + } + + public Builder speaker(Float speaker) { + this.speaker = Optional.ofNullable(speaker); + return this; + } + + @JsonSetter(value = "speaker_confidence", nulls = Nulls.SKIP) + public Builder speakerConfidence(Optional speakerConfidence) { + this.speakerConfidence = speakerConfidence; + return this; + } + + public Builder speakerConfidence(Float speakerConfidence) { + this.speakerConfidence = Optional.ofNullable(speakerConfidence); + return this; + } + + @JsonSetter(value = "punctuated_word", nulls = Nulls.SKIP) + public Builder punctuatedWord(Optional punctuatedWord) { + this.punctuatedWord = punctuatedWord; + return this; + } + + public Builder punctuatedWord(String punctuatedWord) { + this.punctuatedWord = Optional.ofNullable(punctuatedWord); + return this; + } + + public ListenV1ResponseResultsUtterancesItemWordsItem build() { + return new ListenV1ResponseResultsUtterancesItemWordsItem( + word, start, end, confidence, speaker, speakerConfidence, punctuatedWord, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1SampleRate.java b/src/main/java/com/deepgram/types/ListenV1SampleRate.java new file mode 100644 index 0000000..02b3d50 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1SampleRate.java @@ -0,0 +1,42 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.WrappedAlias; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListenV1SampleRate implements WrappedAlias { + private final Object value; + + private ListenV1SampleRate(Object value) { + this.value = value; + } + + @JsonValue + public Object get() { + return this.value; + } + + @java.lang.Override + public boolean equals(Object other) { + return this == other + || (other instanceof ListenV1SampleRate && this.value.equals(((ListenV1SampleRate) other).value)); + } + + @java.lang.Override + public int hashCode() { + return value.hashCode(); + } + + @java.lang.Override + public String toString() { + return value.toString(); + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListenV1SampleRate of(Object value) { + return new ListenV1SampleRate(value); + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1Search.java b/src/main/java/com/deepgram/types/ListenV1Search.java new file mode 100644 index 0000000..8fa4957 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1Search.java @@ -0,0 +1,41 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.WrappedAlias; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListenV1Search implements WrappedAlias { + private final Object value; + + private ListenV1Search(Object value) { + this.value = value; + } + + @JsonValue + public Object get() { + return this.value; + } + + @java.lang.Override + public boolean equals(Object other) { + return this == other || (other instanceof ListenV1Search && this.value.equals(((ListenV1Search) other).value)); + } + + @java.lang.Override + public int hashCode() { + return value.hashCode(); + } + + @java.lang.Override + public String toString() { + return value.toString(); + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListenV1Search of(Object value) { + return new ListenV1Search(value); + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1SmartFormat.java b/src/main/java/com/deepgram/types/ListenV1SmartFormat.java new file mode 100644 index 0000000..dbf401f --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1SmartFormat.java @@ -0,0 +1,83 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListenV1SmartFormat { + public static final ListenV1SmartFormat FALSE = new ListenV1SmartFormat(Value.FALSE, "false"); + + public static final ListenV1SmartFormat TRUE = new ListenV1SmartFormat(Value.TRUE, "true"); + + private final Value value; + + private final String string; + + ListenV1SmartFormat(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListenV1SmartFormat && this.string.equals(((ListenV1SmartFormat) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FALSE: + return visitor.visitFalse(); + case TRUE: + return visitor.visitTrue(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListenV1SmartFormat valueOf(String value) { + switch (value) { + case "false": + return FALSE; + case "true": + return TRUE; + default: + return new ListenV1SmartFormat(Value.UNKNOWN, value); + } + } + + public enum Value { + TRUE, + + FALSE, + + UNKNOWN + } + + public interface Visitor { + T visitTrue(); + + T visitFalse(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1Tag.java b/src/main/java/com/deepgram/types/ListenV1Tag.java new file mode 100644 index 0000000..bcd902f --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1Tag.java @@ -0,0 +1,41 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.WrappedAlias; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListenV1Tag implements WrappedAlias { + private final Object value; + + private ListenV1Tag(Object value) { + this.value = value; + } + + @JsonValue + public Object get() { + return this.value; + } + + @java.lang.Override + public boolean equals(Object other) { + return this == other || (other instanceof ListenV1Tag && this.value.equals(((ListenV1Tag) other).value)); + } + + @java.lang.Override + public int hashCode() { + return value.hashCode(); + } + + @java.lang.Override + public String toString() { + return value.toString(); + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListenV1Tag of(Object value) { + return new ListenV1Tag(value); + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1UtteranceEndMs.java b/src/main/java/com/deepgram/types/ListenV1UtteranceEndMs.java new file mode 100644 index 0000000..98dd3de --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1UtteranceEndMs.java @@ -0,0 +1,43 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.WrappedAlias; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListenV1UtteranceEndMs implements WrappedAlias { + private final Object value; + + private ListenV1UtteranceEndMs(Object value) { + this.value = value; + } + + @JsonValue + public Object get() { + return this.value; + } + + @java.lang.Override + public boolean equals(Object other) { + return this == other + || (other instanceof ListenV1UtteranceEndMs + && this.value.equals(((ListenV1UtteranceEndMs) other).value)); + } + + @java.lang.Override + public int hashCode() { + return value.hashCode(); + } + + @java.lang.Override + public String toString() { + return value.toString(); + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListenV1UtteranceEndMs of(Object value) { + return new ListenV1UtteranceEndMs(value); + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1VadEvents.java b/src/main/java/com/deepgram/types/ListenV1VadEvents.java new file mode 100644 index 0000000..7c613e0 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1VadEvents.java @@ -0,0 +1,83 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListenV1VadEvents { + public static final ListenV1VadEvents FALSE = new ListenV1VadEvents(Value.FALSE, "false"); + + public static final ListenV1VadEvents TRUE = new ListenV1VadEvents(Value.TRUE, "true"); + + private final Value value; + + private final String string; + + ListenV1VadEvents(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListenV1VadEvents && this.string.equals(((ListenV1VadEvents) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case FALSE: + return visitor.visitFalse(); + case TRUE: + return visitor.visitTrue(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListenV1VadEvents valueOf(String value) { + switch (value) { + case "false": + return FALSE; + case "true": + return TRUE; + default: + return new ListenV1VadEvents(Value.UNKNOWN, value); + } + } + + public enum Value { + TRUE, + + FALSE, + + UNKNOWN + } + + public interface Visitor { + T visitTrue(); + + T visitFalse(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/types/ListenV1Version.java b/src/main/java/com/deepgram/types/ListenV1Version.java new file mode 100644 index 0000000..5cf1887 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV1Version.java @@ -0,0 +1,42 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.WrappedAlias; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListenV1Version implements WrappedAlias { + private final Object value; + + private ListenV1Version(Object value) { + this.value = value; + } + + @JsonValue + public Object get() { + return this.value; + } + + @java.lang.Override + public boolean equals(Object other) { + return this == other + || (other instanceof ListenV1Version && this.value.equals(((ListenV1Version) other).value)); + } + + @java.lang.Override + public int hashCode() { + return value.hashCode(); + } + + @java.lang.Override + public String toString() { + return value.toString(); + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListenV1Version of(Object value) { + return new ListenV1Version(value); + } +} diff --git a/src/main/java/com/deepgram/types/ListenV2EagerEotThreshold.java b/src/main/java/com/deepgram/types/ListenV2EagerEotThreshold.java new file mode 100644 index 0000000..97b7ca3 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV2EagerEotThreshold.java @@ -0,0 +1,43 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.WrappedAlias; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListenV2EagerEotThreshold implements WrappedAlias { + private final Object value; + + private ListenV2EagerEotThreshold(Object value) { + this.value = value; + } + + @JsonValue + public Object get() { + return this.value; + } + + @java.lang.Override + public boolean equals(Object other) { + return this == other + || (other instanceof ListenV2EagerEotThreshold + && this.value.equals(((ListenV2EagerEotThreshold) other).value)); + } + + @java.lang.Override + public int hashCode() { + return value.hashCode(); + } + + @java.lang.Override + public String toString() { + return value.toString(); + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListenV2EagerEotThreshold of(Object value) { + return new ListenV2EagerEotThreshold(value); + } +} diff --git a/src/main/java/com/deepgram/types/ListenV2Encoding.java b/src/main/java/com/deepgram/types/ListenV2Encoding.java new file mode 100644 index 0000000..a732477 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV2Encoding.java @@ -0,0 +1,123 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListenV2Encoding { + public static final ListenV2Encoding MULAW = new ListenV2Encoding(Value.MULAW, "mulaw"); + + public static final ListenV2Encoding LINEAR32 = new ListenV2Encoding(Value.LINEAR32, "linear32"); + + public static final ListenV2Encoding OGG_OPUS = new ListenV2Encoding(Value.OGG_OPUS, "ogg-opus"); + + public static final ListenV2Encoding LINEAR16 = new ListenV2Encoding(Value.LINEAR16, "linear16"); + + public static final ListenV2Encoding OPUS = new ListenV2Encoding(Value.OPUS, "opus"); + + public static final ListenV2Encoding ALAW = new ListenV2Encoding(Value.ALAW, "alaw"); + + private final Value value; + + private final String string; + + ListenV2Encoding(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof ListenV2Encoding && this.string.equals(((ListenV2Encoding) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MULAW: + return visitor.visitMulaw(); + case LINEAR32: + return visitor.visitLinear32(); + case OGG_OPUS: + return visitor.visitOggOpus(); + case LINEAR16: + return visitor.visitLinear16(); + case OPUS: + return visitor.visitOpus(); + case ALAW: + return visitor.visitAlaw(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListenV2Encoding valueOf(String value) { + switch (value) { + case "mulaw": + return MULAW; + case "linear32": + return LINEAR32; + case "ogg-opus": + return OGG_OPUS; + case "linear16": + return LINEAR16; + case "opus": + return OPUS; + case "alaw": + return ALAW; + default: + return new ListenV2Encoding(Value.UNKNOWN, value); + } + } + + public enum Value { + LINEAR16, + + LINEAR32, + + MULAW, + + ALAW, + + OPUS, + + OGG_OPUS, + + UNKNOWN + } + + public interface Visitor { + T visitLinear16(); + + T visitLinear32(); + + T visitMulaw(); + + T visitAlaw(); + + T visitOpus(); + + T visitOggOpus(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/types/ListenV2EotThreshold.java b/src/main/java/com/deepgram/types/ListenV2EotThreshold.java new file mode 100644 index 0000000..494b540 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV2EotThreshold.java @@ -0,0 +1,42 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.WrappedAlias; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListenV2EotThreshold implements WrappedAlias { + private final Object value; + + private ListenV2EotThreshold(Object value) { + this.value = value; + } + + @JsonValue + public Object get() { + return this.value; + } + + @java.lang.Override + public boolean equals(Object other) { + return this == other + || (other instanceof ListenV2EotThreshold && this.value.equals(((ListenV2EotThreshold) other).value)); + } + + @java.lang.Override + public int hashCode() { + return value.hashCode(); + } + + @java.lang.Override + public String toString() { + return value.toString(); + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListenV2EotThreshold of(Object value) { + return new ListenV2EotThreshold(value); + } +} diff --git a/src/main/java/com/deepgram/types/ListenV2EotTimeoutMs.java b/src/main/java/com/deepgram/types/ListenV2EotTimeoutMs.java new file mode 100644 index 0000000..0ca5d82 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV2EotTimeoutMs.java @@ -0,0 +1,42 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.WrappedAlias; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListenV2EotTimeoutMs implements WrappedAlias { + private final Object value; + + private ListenV2EotTimeoutMs(Object value) { + this.value = value; + } + + @JsonValue + public Object get() { + return this.value; + } + + @java.lang.Override + public boolean equals(Object other) { + return this == other + || (other instanceof ListenV2EotTimeoutMs && this.value.equals(((ListenV2EotTimeoutMs) other).value)); + } + + @java.lang.Override + public int hashCode() { + return value.hashCode(); + } + + @java.lang.Override + public String toString() { + return value.toString(); + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListenV2EotTimeoutMs of(Object value) { + return new ListenV2EotTimeoutMs(value); + } +} diff --git a/src/main/java/com/deepgram/types/ListenV2Keyterm.java b/src/main/java/com/deepgram/types/ListenV2Keyterm.java new file mode 100644 index 0000000..30aae83 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV2Keyterm.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import java.io.IOException; +import java.util.List; +import java.util.Objects; + +@JsonDeserialize(using = ListenV2Keyterm.Deserializer.class) +public final class ListenV2Keyterm { + private final Object value; + + private final int type; + + private ListenV2Keyterm(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + @SuppressWarnings("unchecked") + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((String) this.value); + } else if (this.type == 1) { + return visitor.visit((List) 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 ListenV2Keyterm && equalTo((ListenV2Keyterm) other); + } + + private boolean equalTo(ListenV2Keyterm 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 ListenV2Keyterm of(String value) { + return new ListenV2Keyterm(value, 0); + } + + public static ListenV2Keyterm of(List value) { + return new ListenV2Keyterm(value, 1); + } + + public interface Visitor { + T visit(String value); + + T visit(List value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(ListenV2Keyterm.class); + } + + @java.lang.Override + public ListenV2Keyterm deserialize(JsonParser p, DeserializationContext context) throws IOException { + Object value = p.readValueAs(Object.class); + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, String.class)); + } catch (RuntimeException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, new TypeReference>() {})); + } catch (RuntimeException e) { + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/deepgram/types/ListenV2MipOptOut.java b/src/main/java/com/deepgram/types/ListenV2MipOptOut.java new file mode 100644 index 0000000..ddbd502 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV2MipOptOut.java @@ -0,0 +1,42 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.WrappedAlias; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListenV2MipOptOut implements WrappedAlias { + private final Object value; + + private ListenV2MipOptOut(Object value) { + this.value = value; + } + + @JsonValue + public Object get() { + return this.value; + } + + @java.lang.Override + public boolean equals(Object other) { + return this == other + || (other instanceof ListenV2MipOptOut && this.value.equals(((ListenV2MipOptOut) other).value)); + } + + @java.lang.Override + public int hashCode() { + return value.hashCode(); + } + + @java.lang.Override + public String toString() { + return value.toString(); + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListenV2MipOptOut of(Object value) { + return new ListenV2MipOptOut(value); + } +} diff --git a/src/main/java/com/deepgram/types/ListenV2SampleRate.java b/src/main/java/com/deepgram/types/ListenV2SampleRate.java new file mode 100644 index 0000000..dd32215 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV2SampleRate.java @@ -0,0 +1,42 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.WrappedAlias; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListenV2SampleRate implements WrappedAlias { + private final Object value; + + private ListenV2SampleRate(Object value) { + this.value = value; + } + + @JsonValue + public Object get() { + return this.value; + } + + @java.lang.Override + public boolean equals(Object other) { + return this == other + || (other instanceof ListenV2SampleRate && this.value.equals(((ListenV2SampleRate) other).value)); + } + + @java.lang.Override + public int hashCode() { + return value.hashCode(); + } + + @java.lang.Override + public String toString() { + return value.toString(); + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListenV2SampleRate of(Object value) { + return new ListenV2SampleRate(value); + } +} diff --git a/src/main/java/com/deepgram/types/ListenV2Tag.java b/src/main/java/com/deepgram/types/ListenV2Tag.java new file mode 100644 index 0000000..798e685 --- /dev/null +++ b/src/main/java/com/deepgram/types/ListenV2Tag.java @@ -0,0 +1,41 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.WrappedAlias; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class ListenV2Tag implements WrappedAlias { + private final Object value; + + private ListenV2Tag(Object value) { + this.value = value; + } + + @JsonValue + public Object get() { + return this.value; + } + + @java.lang.Override + public boolean equals(Object other) { + return this == other || (other instanceof ListenV2Tag && this.value.equals(((ListenV2Tag) other).value)); + } + + @java.lang.Override + public int hashCode() { + return value.hashCode(); + } + + @java.lang.Override + public String toString() { + return value.toString(); + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static ListenV2Tag of(Object value) { + return new ListenV2Tag(value); + } +} diff --git a/src/main/java/com/deepgram/types/OpenAiSpeakProvider.java b/src/main/java/com/deepgram/types/OpenAiSpeakProvider.java new file mode 100644 index 0000000..9a6b9e1 --- /dev/null +++ b/src/main/java/com/deepgram/types/OpenAiSpeakProvider.java @@ -0,0 +1,42 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.WrappedAlias; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class OpenAiSpeakProvider implements WrappedAlias { + private final Object value; + + private OpenAiSpeakProvider(Object value) { + this.value = value; + } + + @JsonValue + public Object get() { + return this.value; + } + + @java.lang.Override + public boolean equals(Object other) { + return this == other + || (other instanceof OpenAiSpeakProvider && this.value.equals(((OpenAiSpeakProvider) other).value)); + } + + @java.lang.Override + public int hashCode() { + return value.hashCode(); + } + + @java.lang.Override + public String toString() { + return value.toString(); + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static OpenAiSpeakProvider of(Object value) { + return new OpenAiSpeakProvider(value); + } +} diff --git a/src/main/java/com/deepgram/types/OpenAiThinkProvider.java b/src/main/java/com/deepgram/types/OpenAiThinkProvider.java new file mode 100644 index 0000000..2d8dce1 --- /dev/null +++ b/src/main/java/com/deepgram/types/OpenAiThinkProvider.java @@ -0,0 +1,42 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.WrappedAlias; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class OpenAiThinkProvider implements WrappedAlias { + private final Object value; + + private OpenAiThinkProvider(Object value) { + this.value = value; + } + + @JsonValue + public Object get() { + return this.value; + } + + @java.lang.Override + public boolean equals(Object other) { + return this == other + || (other instanceof OpenAiThinkProvider && this.value.equals(((OpenAiThinkProvider) other).value)); + } + + @java.lang.Override + public int hashCode() { + return value.hashCode(); + } + + @java.lang.Override + public String toString() { + return value.toString(); + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static OpenAiThinkProvider of(Object value) { + return new OpenAiThinkProvider(value); + } +} diff --git a/src/main/java/com/deepgram/types/ProjectRequestResponse.java b/src/main/java/com/deepgram/types/ProjectRequestResponse.java new file mode 100644 index 0000000..af3367e --- /dev/null +++ b/src/main/java/com/deepgram/types/ProjectRequestResponse.java @@ -0,0 +1,373 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = ProjectRequestResponse.Builder.class) +public final class ProjectRequestResponse { + private final Optional requestId; + + private final Optional projectUuid; + + private final Optional created; + + private final Optional path; + + private final Optional apiKeyId; + + private final Optional> response; + + private final Optional code; + + private final Optional deployment; + + private final Optional callback; + + private final Map additionalProperties; + + private ProjectRequestResponse( + Optional requestId, + Optional projectUuid, + Optional created, + Optional path, + Optional apiKeyId, + Optional> response, + Optional code, + Optional deployment, + Optional callback, + Map additionalProperties) { + this.requestId = requestId; + this.projectUuid = projectUuid; + this.created = created; + this.path = path; + this.apiKeyId = apiKeyId; + this.response = response; + this.code = code; + this.deployment = deployment; + this.callback = callback; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique identifier of the request + */ + @JsonProperty("request_id") + public Optional getRequestId() { + return requestId; + } + + /** + * @return The unique identifier of the project + */ + @JsonProperty("project_uuid") + public Optional getProjectUuid() { + return projectUuid; + } + + /** + * @return The date and time the request was created + */ + @JsonProperty("created") + public Optional getCreated() { + return created; + } + + /** + * @return The API path of the request + */ + @JsonProperty("path") + public Optional getPath() { + return path; + } + + /** + * @return The unique identifier of the API key + */ + @JsonProperty("api_key_id") + public Optional getApiKeyId() { + return apiKeyId; + } + + /** + * @return The response of the request + */ + @JsonProperty("response") + public Optional> getResponse() { + return response; + } + + /** + * @return The response code of the request + */ + @JsonProperty("code") + public Optional getCode() { + return code; + } + + /** + * @return The deployment type + */ + @JsonProperty("deployment") + public Optional getDeployment() { + return deployment; + } + + /** + * @return The callback URL for the request + */ + @JsonProperty("callback") + public Optional getCallback() { + return callback; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ProjectRequestResponse && equalTo((ProjectRequestResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ProjectRequestResponse other) { + return requestId.equals(other.requestId) + && projectUuid.equals(other.projectUuid) + && created.equals(other.created) + && path.equals(other.path) + && apiKeyId.equals(other.apiKeyId) + && response.equals(other.response) + && code.equals(other.code) + && deployment.equals(other.deployment) + && callback.equals(other.callback); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.requestId, + this.projectUuid, + this.created, + this.path, + this.apiKeyId, + this.response, + this.code, + this.deployment, + this.callback); + } + + @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 requestId = Optional.empty(); + + private Optional projectUuid = Optional.empty(); + + private Optional created = Optional.empty(); + + private Optional path = Optional.empty(); + + private Optional apiKeyId = Optional.empty(); + + private Optional> response = Optional.empty(); + + private Optional code = Optional.empty(); + + private Optional deployment = Optional.empty(); + + private Optional callback = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ProjectRequestResponse other) { + requestId(other.getRequestId()); + projectUuid(other.getProjectUuid()); + created(other.getCreated()); + path(other.getPath()); + apiKeyId(other.getApiKeyId()); + response(other.getResponse()); + code(other.getCode()); + deployment(other.getDeployment()); + callback(other.getCallback()); + return this; + } + + /** + *

The unique identifier of the request

+ */ + @JsonSetter(value = "request_id", nulls = Nulls.SKIP) + public Builder requestId(Optional requestId) { + this.requestId = requestId; + return this; + } + + public Builder requestId(String requestId) { + this.requestId = Optional.ofNullable(requestId); + return this; + } + + /** + *

The unique identifier of the project

+ */ + @JsonSetter(value = "project_uuid", nulls = Nulls.SKIP) + public Builder projectUuid(Optional projectUuid) { + this.projectUuid = projectUuid; + return this; + } + + public Builder projectUuid(String projectUuid) { + this.projectUuid = Optional.ofNullable(projectUuid); + return this; + } + + /** + *

The date and time the request was created

+ */ + @JsonSetter(value = "created", nulls = Nulls.SKIP) + public Builder created(Optional created) { + this.created = created; + return this; + } + + public Builder created(OffsetDateTime created) { + this.created = Optional.ofNullable(created); + return this; + } + + /** + *

The API path of the request

+ */ + @JsonSetter(value = "path", nulls = Nulls.SKIP) + public Builder path(Optional path) { + this.path = path; + return this; + } + + public Builder path(String path) { + this.path = Optional.ofNullable(path); + return this; + } + + /** + *

The unique identifier of the API key

+ */ + @JsonSetter(value = "api_key_id", nulls = Nulls.SKIP) + public Builder apiKeyId(Optional apiKeyId) { + this.apiKeyId = apiKeyId; + return this; + } + + public Builder apiKeyId(String apiKeyId) { + this.apiKeyId = Optional.ofNullable(apiKeyId); + return this; + } + + /** + *

The response of the request

+ */ + @JsonSetter(value = "response", nulls = Nulls.SKIP) + public Builder response(Optional> response) { + this.response = response; + return this; + } + + public Builder response(Map response) { + this.response = Optional.ofNullable(response); + return this; + } + + /** + *

The response code of the request

+ */ + @JsonSetter(value = "code", nulls = Nulls.SKIP) + public Builder code(Optional code) { + this.code = code; + return this; + } + + public Builder code(Double code) { + this.code = Optional.ofNullable(code); + return this; + } + + /** + *

The deployment type

+ */ + @JsonSetter(value = "deployment", nulls = Nulls.SKIP) + public Builder deployment(Optional deployment) { + this.deployment = deployment; + return this; + } + + public Builder deployment(String deployment) { + this.deployment = Optional.ofNullable(deployment); + return this; + } + + /** + *

The callback URL for the request

+ */ + @JsonSetter(value = "callback", nulls = Nulls.SKIP) + public Builder callback(Optional callback) { + this.callback = callback; + return this; + } + + public Builder callback(String callback) { + this.callback = Optional.ofNullable(callback); + return this; + } + + public ProjectRequestResponse build() { + return new ProjectRequestResponse( + requestId, + projectUuid, + created, + path, + apiKeyId, + response, + code, + deployment, + callback, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ReadV1Request.java b/src/main/java/com/deepgram/types/ReadV1Request.java new file mode 100644 index 0000000..0c4a763 --- /dev/null +++ b/src/main/java/com/deepgram/types/ReadV1Request.java @@ -0,0 +1,95 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +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 java.io.IOException; +import java.util.Objects; + +@JsonDeserialize(using = ReadV1Request.Deserializer.class) +public final class ReadV1Request { + private final Object value; + + private final int type; + + private ReadV1Request(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + @SuppressWarnings("unchecked") + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((ReadV1RequestUrl) this.value); + } else if (this.type == 1) { + return visitor.visit((ReadV1RequestText) 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 ReadV1Request && equalTo((ReadV1Request) other); + } + + private boolean equalTo(ReadV1Request 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 ReadV1Request of(ReadV1RequestUrl value) { + return new ReadV1Request(value, 0); + } + + public static ReadV1Request of(ReadV1RequestText value) { + return new ReadV1Request(value, 1); + } + + public interface Visitor { + T visit(ReadV1RequestUrl value); + + T visit(ReadV1RequestText value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(ReadV1Request.class); + } + + @java.lang.Override + public ReadV1Request deserialize(JsonParser p, DeserializationContext context) throws IOException { + Object value = p.readValueAs(Object.class); + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, ReadV1RequestUrl.class)); + } catch (RuntimeException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, ReadV1RequestText.class)); + } catch (RuntimeException e) { + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/deepgram/types/ReadV1RequestText.java b/src/main/java/com/deepgram/types/ReadV1RequestText.java new file mode 100644 index 0000000..326f080 --- /dev/null +++ b/src/main/java/com/deepgram/types/ReadV1RequestText.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ReadV1RequestText.Builder.class) +public final class ReadV1RequestText { + private final String text; + + private final Map additionalProperties; + + private ReadV1RequestText(String text, Map additionalProperties) { + this.text = text; + this.additionalProperties = additionalProperties; + } + + /** + * @return The plain text to analyze + */ + @JsonProperty("text") + public String getText() { + return text; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReadV1RequestText && equalTo((ReadV1RequestText) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReadV1RequestText other) { + return text.equals(other.text); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.text); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TextStage builder() { + return new Builder(); + } + + public interface TextStage { + /** + *

The plain text to analyze

+ */ + _FinalStage text(@NotNull String text); + + Builder from(ReadV1RequestText other); + } + + public interface _FinalStage { + ReadV1RequestText build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TextStage, _FinalStage { + private String text; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ReadV1RequestText other) { + text(other.getText()); + return this; + } + + /** + *

The plain text to analyze

+ *

The plain text to analyze

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("text") + public _FinalStage text(@NotNull String text) { + this.text = Objects.requireNonNull(text, "text must not be null"); + return this; + } + + @java.lang.Override + public ReadV1RequestText build() { + return new ReadV1RequestText(text, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ReadV1RequestUrl.java b/src/main/java/com/deepgram/types/ReadV1RequestUrl.java new file mode 100644 index 0000000..c2825b3 --- /dev/null +++ b/src/main/java/com/deepgram/types/ReadV1RequestUrl.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ReadV1RequestUrl.Builder.class) +public final class ReadV1RequestUrl { + private final String url; + + private final Map additionalProperties; + + private ReadV1RequestUrl(String url, Map additionalProperties) { + this.url = url; + this.additionalProperties = additionalProperties; + } + + /** + * @return A URL pointing to the text source + */ + @JsonProperty("url") + public String getUrl() { + return url; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReadV1RequestUrl && equalTo((ReadV1RequestUrl) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReadV1RequestUrl other) { + return url.equals(other.url); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.url); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static UrlStage builder() { + return new Builder(); + } + + public interface UrlStage { + /** + *

A URL pointing to the text source

+ */ + _FinalStage url(@NotNull String url); + + Builder from(ReadV1RequestUrl other); + } + + public interface _FinalStage { + ReadV1RequestUrl build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements UrlStage, _FinalStage { + private String url; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ReadV1RequestUrl other) { + url(other.getUrl()); + return this; + } + + /** + *

A URL pointing to the text source

+ *

A URL pointing to the text source

+ * @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; + } + + @java.lang.Override + public ReadV1RequestUrl build() { + return new ReadV1RequestUrl(url, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ReadV1Response.java b/src/main/java/com/deepgram/types/ReadV1Response.java new file mode 100644 index 0000000..3237053 --- /dev/null +++ b/src/main/java/com/deepgram/types/ReadV1Response.java @@ -0,0 +1,141 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ReadV1Response.Builder.class) +public final class ReadV1Response { + private final ReadV1ResponseMetadata metadata; + + private final ReadV1ResponseResults results; + + private final Map additionalProperties; + + private ReadV1Response( + ReadV1ResponseMetadata metadata, ReadV1ResponseResults results, Map additionalProperties) { + this.metadata = metadata; + this.results = results; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("metadata") + public ReadV1ResponseMetadata getMetadata() { + return metadata; + } + + @JsonProperty("results") + public ReadV1ResponseResults getResults() { + return results; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReadV1Response && equalTo((ReadV1Response) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReadV1Response other) { + return metadata.equals(other.metadata) && results.equals(other.results); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.metadata, this.results); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static MetadataStage builder() { + return new Builder(); + } + + public interface MetadataStage { + ResultsStage metadata(@NotNull ReadV1ResponseMetadata metadata); + + Builder from(ReadV1Response other); + } + + public interface ResultsStage { + _FinalStage results(@NotNull ReadV1ResponseResults results); + } + + public interface _FinalStage { + ReadV1Response build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements MetadataStage, ResultsStage, _FinalStage { + private ReadV1ResponseMetadata metadata; + + private ReadV1ResponseResults results; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ReadV1Response other) { + metadata(other.getMetadata()); + results(other.getResults()); + return this; + } + + @java.lang.Override + @JsonSetter("metadata") + public ResultsStage metadata(@NotNull ReadV1ResponseMetadata metadata) { + this.metadata = Objects.requireNonNull(metadata, "metadata must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("results") + public _FinalStage results(@NotNull ReadV1ResponseResults results) { + this.results = Objects.requireNonNull(results, "results must not be null"); + return this; + } + + @java.lang.Override + public ReadV1Response build() { + return new ReadV1Response(metadata, results, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ReadV1ResponseMetadata.java b/src/main/java/com/deepgram/types/ReadV1ResponseMetadata.java new file mode 100644 index 0000000..e74c9c2 --- /dev/null +++ b/src/main/java/com/deepgram/types/ReadV1ResponseMetadata.java @@ -0,0 +1,106 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ReadV1ResponseMetadata.Builder.class) +public final class ReadV1ResponseMetadata { + private final Optional metadata; + + private final Map additionalProperties; + + private ReadV1ResponseMetadata( + Optional metadata, Map additionalProperties) { + this.metadata = metadata; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("metadata") + public Optional getMetadata() { + return metadata; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReadV1ResponseMetadata && equalTo((ReadV1ResponseMetadata) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReadV1ResponseMetadata 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 Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional metadata = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ReadV1ResponseMetadata other) { + metadata(other.getMetadata()); + return this; + } + + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public Builder metadata(Optional metadata) { + this.metadata = metadata; + return this; + } + + public Builder metadata(ReadV1ResponseMetadataMetadata metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + public ReadV1ResponseMetadata build() { + return new ReadV1ResponseMetadata(metadata, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ReadV1ResponseMetadataMetadata.java b/src/main/java/com/deepgram/types/ReadV1ResponseMetadataMetadata.java new file mode 100644 index 0000000..c485e84 --- /dev/null +++ b/src/main/java/com/deepgram/types/ReadV1ResponseMetadataMetadata.java @@ -0,0 +1,267 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = ReadV1ResponseMetadataMetadata.Builder.class) +public final class ReadV1ResponseMetadataMetadata { + private final Optional requestId; + + private final Optional created; + + private final Optional language; + + private final Optional summaryInfo; + + private final Optional sentimentInfo; + + private final Optional topicsInfo; + + private final Optional intentsInfo; + + private final Map additionalProperties; + + private ReadV1ResponseMetadataMetadata( + Optional requestId, + Optional created, + Optional language, + Optional summaryInfo, + Optional sentimentInfo, + Optional topicsInfo, + Optional intentsInfo, + Map additionalProperties) { + this.requestId = requestId; + this.created = created; + this.language = language; + this.summaryInfo = summaryInfo; + this.sentimentInfo = sentimentInfo; + this.topicsInfo = topicsInfo; + this.intentsInfo = intentsInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("request_id") + public Optional getRequestId() { + return requestId; + } + + @JsonProperty("created") + public Optional getCreated() { + return created; + } + + @JsonProperty("language") + public Optional getLanguage() { + return language; + } + + @JsonProperty("summary_info") + public Optional getSummaryInfo() { + return summaryInfo; + } + + @JsonProperty("sentiment_info") + public Optional getSentimentInfo() { + return sentimentInfo; + } + + @JsonProperty("topics_info") + public Optional getTopicsInfo() { + return topicsInfo; + } + + @JsonProperty("intents_info") + public Optional getIntentsInfo() { + return intentsInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReadV1ResponseMetadataMetadata && equalTo((ReadV1ResponseMetadataMetadata) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReadV1ResponseMetadataMetadata other) { + return requestId.equals(other.requestId) + && created.equals(other.created) + && language.equals(other.language) + && summaryInfo.equals(other.summaryInfo) + && sentimentInfo.equals(other.sentimentInfo) + && topicsInfo.equals(other.topicsInfo) + && intentsInfo.equals(other.intentsInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.requestId, + this.created, + this.language, + this.summaryInfo, + this.sentimentInfo, + this.topicsInfo, + this.intentsInfo); + } + + @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 requestId = Optional.empty(); + + private Optional created = Optional.empty(); + + private Optional language = Optional.empty(); + + private Optional summaryInfo = Optional.empty(); + + private Optional sentimentInfo = Optional.empty(); + + private Optional topicsInfo = Optional.empty(); + + private Optional intentsInfo = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ReadV1ResponseMetadataMetadata other) { + requestId(other.getRequestId()); + created(other.getCreated()); + language(other.getLanguage()); + summaryInfo(other.getSummaryInfo()); + sentimentInfo(other.getSentimentInfo()); + topicsInfo(other.getTopicsInfo()); + intentsInfo(other.getIntentsInfo()); + return this; + } + + @JsonSetter(value = "request_id", nulls = Nulls.SKIP) + public Builder requestId(Optional requestId) { + this.requestId = requestId; + return this; + } + + public Builder requestId(String requestId) { + this.requestId = Optional.ofNullable(requestId); + return this; + } + + @JsonSetter(value = "created", nulls = Nulls.SKIP) + public Builder created(Optional created) { + this.created = created; + return this; + } + + public Builder created(OffsetDateTime created) { + this.created = Optional.ofNullable(created); + return this; + } + + @JsonSetter(value = "language", nulls = Nulls.SKIP) + public Builder language(Optional language) { + this.language = language; + return this; + } + + public Builder language(String language) { + this.language = Optional.ofNullable(language); + return this; + } + + @JsonSetter(value = "summary_info", nulls = Nulls.SKIP) + public Builder summaryInfo(Optional summaryInfo) { + this.summaryInfo = summaryInfo; + return this; + } + + public Builder summaryInfo(ReadV1ResponseMetadataMetadataSummaryInfo summaryInfo) { + this.summaryInfo = Optional.ofNullable(summaryInfo); + return this; + } + + @JsonSetter(value = "sentiment_info", nulls = Nulls.SKIP) + public Builder sentimentInfo(Optional sentimentInfo) { + this.sentimentInfo = sentimentInfo; + return this; + } + + public Builder sentimentInfo(ReadV1ResponseMetadataMetadataSentimentInfo sentimentInfo) { + this.sentimentInfo = Optional.ofNullable(sentimentInfo); + return this; + } + + @JsonSetter(value = "topics_info", nulls = Nulls.SKIP) + public Builder topicsInfo(Optional topicsInfo) { + this.topicsInfo = topicsInfo; + return this; + } + + public Builder topicsInfo(ReadV1ResponseMetadataMetadataTopicsInfo topicsInfo) { + this.topicsInfo = Optional.ofNullable(topicsInfo); + return this; + } + + @JsonSetter(value = "intents_info", nulls = Nulls.SKIP) + public Builder intentsInfo(Optional intentsInfo) { + this.intentsInfo = intentsInfo; + return this; + } + + public Builder intentsInfo(ReadV1ResponseMetadataMetadataIntentsInfo intentsInfo) { + this.intentsInfo = Optional.ofNullable(intentsInfo); + return this; + } + + public ReadV1ResponseMetadataMetadata build() { + return new ReadV1ResponseMetadataMetadata( + requestId, + created, + language, + summaryInfo, + sentimentInfo, + topicsInfo, + intentsInfo, + additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ReadV1ResponseMetadataMetadataIntentsInfo.java b/src/main/java/com/deepgram/types/ReadV1ResponseMetadataMetadataIntentsInfo.java new file mode 100644 index 0000000..2906fbd --- /dev/null +++ b/src/main/java/com/deepgram/types/ReadV1ResponseMetadataMetadataIntentsInfo.java @@ -0,0 +1,157 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ReadV1ResponseMetadataMetadataIntentsInfo.Builder.class) +public final class ReadV1ResponseMetadataMetadataIntentsInfo { + private final Optional modelUuid; + + private final Optional inputTokens; + + private final Optional outputTokens; + + private final Map additionalProperties; + + private ReadV1ResponseMetadataMetadataIntentsInfo( + Optional modelUuid, + Optional inputTokens, + Optional outputTokens, + Map additionalProperties) { + this.modelUuid = modelUuid; + this.inputTokens = inputTokens; + this.outputTokens = outputTokens; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("model_uuid") + public Optional getModelUuid() { + return modelUuid; + } + + @JsonProperty("input_tokens") + public Optional getInputTokens() { + return inputTokens; + } + + @JsonProperty("output_tokens") + public Optional getOutputTokens() { + return outputTokens; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReadV1ResponseMetadataMetadataIntentsInfo + && equalTo((ReadV1ResponseMetadataMetadataIntentsInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReadV1ResponseMetadataMetadataIntentsInfo other) { + return modelUuid.equals(other.modelUuid) + && inputTokens.equals(other.inputTokens) + && outputTokens.equals(other.outputTokens); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.modelUuid, this.inputTokens, this.outputTokens); + } + + @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 modelUuid = Optional.empty(); + + private Optional inputTokens = Optional.empty(); + + private Optional outputTokens = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ReadV1ResponseMetadataMetadataIntentsInfo other) { + modelUuid(other.getModelUuid()); + inputTokens(other.getInputTokens()); + outputTokens(other.getOutputTokens()); + return this; + } + + @JsonSetter(value = "model_uuid", nulls = Nulls.SKIP) + public Builder modelUuid(Optional modelUuid) { + this.modelUuid = modelUuid; + return this; + } + + public Builder modelUuid(String modelUuid) { + this.modelUuid = Optional.ofNullable(modelUuid); + return this; + } + + @JsonSetter(value = "input_tokens", nulls = Nulls.SKIP) + public Builder inputTokens(Optional inputTokens) { + this.inputTokens = inputTokens; + return this; + } + + public Builder inputTokens(Double inputTokens) { + this.inputTokens = Optional.ofNullable(inputTokens); + return this; + } + + @JsonSetter(value = "output_tokens", nulls = Nulls.SKIP) + public Builder outputTokens(Optional outputTokens) { + this.outputTokens = outputTokens; + return this; + } + + public Builder outputTokens(Double outputTokens) { + this.outputTokens = Optional.ofNullable(outputTokens); + return this; + } + + public ReadV1ResponseMetadataMetadataIntentsInfo build() { + return new ReadV1ResponseMetadataMetadataIntentsInfo( + modelUuid, inputTokens, outputTokens, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ReadV1ResponseMetadataMetadataSentimentInfo.java b/src/main/java/com/deepgram/types/ReadV1ResponseMetadataMetadataSentimentInfo.java new file mode 100644 index 0000000..d836764 --- /dev/null +++ b/src/main/java/com/deepgram/types/ReadV1ResponseMetadataMetadataSentimentInfo.java @@ -0,0 +1,157 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ReadV1ResponseMetadataMetadataSentimentInfo.Builder.class) +public final class ReadV1ResponseMetadataMetadataSentimentInfo { + private final Optional modelUuid; + + private final Optional inputTokens; + + private final Optional outputTokens; + + private final Map additionalProperties; + + private ReadV1ResponseMetadataMetadataSentimentInfo( + Optional modelUuid, + Optional inputTokens, + Optional outputTokens, + Map additionalProperties) { + this.modelUuid = modelUuid; + this.inputTokens = inputTokens; + this.outputTokens = outputTokens; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("model_uuid") + public Optional getModelUuid() { + return modelUuid; + } + + @JsonProperty("input_tokens") + public Optional getInputTokens() { + return inputTokens; + } + + @JsonProperty("output_tokens") + public Optional getOutputTokens() { + return outputTokens; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReadV1ResponseMetadataMetadataSentimentInfo + && equalTo((ReadV1ResponseMetadataMetadataSentimentInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReadV1ResponseMetadataMetadataSentimentInfo other) { + return modelUuid.equals(other.modelUuid) + && inputTokens.equals(other.inputTokens) + && outputTokens.equals(other.outputTokens); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.modelUuid, this.inputTokens, this.outputTokens); + } + + @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 modelUuid = Optional.empty(); + + private Optional inputTokens = Optional.empty(); + + private Optional outputTokens = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ReadV1ResponseMetadataMetadataSentimentInfo other) { + modelUuid(other.getModelUuid()); + inputTokens(other.getInputTokens()); + outputTokens(other.getOutputTokens()); + return this; + } + + @JsonSetter(value = "model_uuid", nulls = Nulls.SKIP) + public Builder modelUuid(Optional modelUuid) { + this.modelUuid = modelUuid; + return this; + } + + public Builder modelUuid(String modelUuid) { + this.modelUuid = Optional.ofNullable(modelUuid); + return this; + } + + @JsonSetter(value = "input_tokens", nulls = Nulls.SKIP) + public Builder inputTokens(Optional inputTokens) { + this.inputTokens = inputTokens; + return this; + } + + public Builder inputTokens(Double inputTokens) { + this.inputTokens = Optional.ofNullable(inputTokens); + return this; + } + + @JsonSetter(value = "output_tokens", nulls = Nulls.SKIP) + public Builder outputTokens(Optional outputTokens) { + this.outputTokens = outputTokens; + return this; + } + + public Builder outputTokens(Double outputTokens) { + this.outputTokens = Optional.ofNullable(outputTokens); + return this; + } + + public ReadV1ResponseMetadataMetadataSentimentInfo build() { + return new ReadV1ResponseMetadataMetadataSentimentInfo( + modelUuid, inputTokens, outputTokens, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ReadV1ResponseMetadataMetadataSummaryInfo.java b/src/main/java/com/deepgram/types/ReadV1ResponseMetadataMetadataSummaryInfo.java new file mode 100644 index 0000000..2377444 --- /dev/null +++ b/src/main/java/com/deepgram/types/ReadV1ResponseMetadataMetadataSummaryInfo.java @@ -0,0 +1,157 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ReadV1ResponseMetadataMetadataSummaryInfo.Builder.class) +public final class ReadV1ResponseMetadataMetadataSummaryInfo { + private final Optional modelUuid; + + private final Optional inputTokens; + + private final Optional outputTokens; + + private final Map additionalProperties; + + private ReadV1ResponseMetadataMetadataSummaryInfo( + Optional modelUuid, + Optional inputTokens, + Optional outputTokens, + Map additionalProperties) { + this.modelUuid = modelUuid; + this.inputTokens = inputTokens; + this.outputTokens = outputTokens; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("model_uuid") + public Optional getModelUuid() { + return modelUuid; + } + + @JsonProperty("input_tokens") + public Optional getInputTokens() { + return inputTokens; + } + + @JsonProperty("output_tokens") + public Optional getOutputTokens() { + return outputTokens; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReadV1ResponseMetadataMetadataSummaryInfo + && equalTo((ReadV1ResponseMetadataMetadataSummaryInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReadV1ResponseMetadataMetadataSummaryInfo other) { + return modelUuid.equals(other.modelUuid) + && inputTokens.equals(other.inputTokens) + && outputTokens.equals(other.outputTokens); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.modelUuid, this.inputTokens, this.outputTokens); + } + + @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 modelUuid = Optional.empty(); + + private Optional inputTokens = Optional.empty(); + + private Optional outputTokens = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ReadV1ResponseMetadataMetadataSummaryInfo other) { + modelUuid(other.getModelUuid()); + inputTokens(other.getInputTokens()); + outputTokens(other.getOutputTokens()); + return this; + } + + @JsonSetter(value = "model_uuid", nulls = Nulls.SKIP) + public Builder modelUuid(Optional modelUuid) { + this.modelUuid = modelUuid; + return this; + } + + public Builder modelUuid(String modelUuid) { + this.modelUuid = Optional.ofNullable(modelUuid); + return this; + } + + @JsonSetter(value = "input_tokens", nulls = Nulls.SKIP) + public Builder inputTokens(Optional inputTokens) { + this.inputTokens = inputTokens; + return this; + } + + public Builder inputTokens(Double inputTokens) { + this.inputTokens = Optional.ofNullable(inputTokens); + return this; + } + + @JsonSetter(value = "output_tokens", nulls = Nulls.SKIP) + public Builder outputTokens(Optional outputTokens) { + this.outputTokens = outputTokens; + return this; + } + + public Builder outputTokens(Double outputTokens) { + this.outputTokens = Optional.ofNullable(outputTokens); + return this; + } + + public ReadV1ResponseMetadataMetadataSummaryInfo build() { + return new ReadV1ResponseMetadataMetadataSummaryInfo( + modelUuid, inputTokens, outputTokens, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ReadV1ResponseMetadataMetadataTopicsInfo.java b/src/main/java/com/deepgram/types/ReadV1ResponseMetadataMetadataTopicsInfo.java new file mode 100644 index 0000000..1882f3d --- /dev/null +++ b/src/main/java/com/deepgram/types/ReadV1ResponseMetadataMetadataTopicsInfo.java @@ -0,0 +1,157 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ReadV1ResponseMetadataMetadataTopicsInfo.Builder.class) +public final class ReadV1ResponseMetadataMetadataTopicsInfo { + private final Optional modelUuid; + + private final Optional inputTokens; + + private final Optional outputTokens; + + private final Map additionalProperties; + + private ReadV1ResponseMetadataMetadataTopicsInfo( + Optional modelUuid, + Optional inputTokens, + Optional outputTokens, + Map additionalProperties) { + this.modelUuid = modelUuid; + this.inputTokens = inputTokens; + this.outputTokens = outputTokens; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("model_uuid") + public Optional getModelUuid() { + return modelUuid; + } + + @JsonProperty("input_tokens") + public Optional getInputTokens() { + return inputTokens; + } + + @JsonProperty("output_tokens") + public Optional getOutputTokens() { + return outputTokens; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReadV1ResponseMetadataMetadataTopicsInfo + && equalTo((ReadV1ResponseMetadataMetadataTopicsInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReadV1ResponseMetadataMetadataTopicsInfo other) { + return modelUuid.equals(other.modelUuid) + && inputTokens.equals(other.inputTokens) + && outputTokens.equals(other.outputTokens); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.modelUuid, this.inputTokens, this.outputTokens); + } + + @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 modelUuid = Optional.empty(); + + private Optional inputTokens = Optional.empty(); + + private Optional outputTokens = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ReadV1ResponseMetadataMetadataTopicsInfo other) { + modelUuid(other.getModelUuid()); + inputTokens(other.getInputTokens()); + outputTokens(other.getOutputTokens()); + return this; + } + + @JsonSetter(value = "model_uuid", nulls = Nulls.SKIP) + public Builder modelUuid(Optional modelUuid) { + this.modelUuid = modelUuid; + return this; + } + + public Builder modelUuid(String modelUuid) { + this.modelUuid = Optional.ofNullable(modelUuid); + return this; + } + + @JsonSetter(value = "input_tokens", nulls = Nulls.SKIP) + public Builder inputTokens(Optional inputTokens) { + this.inputTokens = inputTokens; + return this; + } + + public Builder inputTokens(Double inputTokens) { + this.inputTokens = Optional.ofNullable(inputTokens); + return this; + } + + @JsonSetter(value = "output_tokens", nulls = Nulls.SKIP) + public Builder outputTokens(Optional outputTokens) { + this.outputTokens = outputTokens; + return this; + } + + public Builder outputTokens(Double outputTokens) { + this.outputTokens = Optional.ofNullable(outputTokens); + return this; + } + + public ReadV1ResponseMetadataMetadataTopicsInfo build() { + return new ReadV1ResponseMetadataMetadataTopicsInfo( + modelUuid, inputTokens, outputTokens, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ReadV1ResponseResults.java b/src/main/java/com/deepgram/types/ReadV1ResponseResults.java new file mode 100644 index 0000000..910241c --- /dev/null +++ b/src/main/java/com/deepgram/types/ReadV1ResponseResults.java @@ -0,0 +1,179 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ReadV1ResponseResults.Builder.class) +public final class ReadV1ResponseResults { + private final Optional summary; + + private final Optional topics; + + private final Optional intents; + + private final Optional sentiments; + + private final Map additionalProperties; + + private ReadV1ResponseResults( + Optional summary, + Optional topics, + Optional intents, + Optional sentiments, + Map additionalProperties) { + this.summary = summary; + this.topics = topics; + this.intents = intents; + this.sentiments = sentiments; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("summary") + public Optional getSummary() { + return summary; + } + + @JsonProperty("topics") + public Optional getTopics() { + return topics; + } + + @JsonProperty("intents") + public Optional getIntents() { + return intents; + } + + @JsonProperty("sentiments") + public Optional getSentiments() { + return sentiments; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReadV1ResponseResults && equalTo((ReadV1ResponseResults) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReadV1ResponseResults other) { + return summary.equals(other.summary) + && topics.equals(other.topics) + && intents.equals(other.intents) + && sentiments.equals(other.sentiments); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.summary, this.topics, this.intents, this.sentiments); + } + + @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 topics = Optional.empty(); + + private Optional intents = Optional.empty(); + + private Optional sentiments = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ReadV1ResponseResults other) { + summary(other.getSummary()); + topics(other.getTopics()); + intents(other.getIntents()); + sentiments(other.getSentiments()); + return this; + } + + @JsonSetter(value = "summary", nulls = Nulls.SKIP) + public Builder summary(Optional summary) { + this.summary = summary; + return this; + } + + public Builder summary(ReadV1ResponseResultsSummary summary) { + this.summary = Optional.ofNullable(summary); + return this; + } + + @JsonSetter(value = "topics", nulls = Nulls.SKIP) + public Builder topics(Optional topics) { + this.topics = topics; + return this; + } + + public Builder topics(SharedTopics topics) { + this.topics = Optional.ofNullable(topics); + return this; + } + + @JsonSetter(value = "intents", nulls = Nulls.SKIP) + public Builder intents(Optional intents) { + this.intents = intents; + return this; + } + + public Builder intents(SharedIntents intents) { + this.intents = Optional.ofNullable(intents); + return this; + } + + @JsonSetter(value = "sentiments", nulls = Nulls.SKIP) + public Builder sentiments(Optional sentiments) { + this.sentiments = sentiments; + return this; + } + + public Builder sentiments(SharedSentiments sentiments) { + this.sentiments = Optional.ofNullable(sentiments); + return this; + } + + public ReadV1ResponseResults build() { + return new ReadV1ResponseResults(summary, topics, intents, sentiments, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ReadV1ResponseResultsSummary.java b/src/main/java/com/deepgram/types/ReadV1ResponseResultsSummary.java new file mode 100644 index 0000000..7c7d72d --- /dev/null +++ b/src/main/java/com/deepgram/types/ReadV1ResponseResultsSummary.java @@ -0,0 +1,106 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ReadV1ResponseResultsSummary.Builder.class) +public final class ReadV1ResponseResultsSummary { + private final Optional results; + + private final Map additionalProperties; + + private ReadV1ResponseResultsSummary( + Optional results, Map additionalProperties) { + this.results = results; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("results") + public Optional getResults() { + return results; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReadV1ResponseResultsSummary && equalTo((ReadV1ResponseResultsSummary) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReadV1ResponseResultsSummary other) { + return results.equals(other.results); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.results); + } + + @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(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ReadV1ResponseResultsSummary other) { + results(other.getResults()); + return this; + } + + @JsonSetter(value = "results", nulls = Nulls.SKIP) + public Builder results(Optional results) { + this.results = results; + return this; + } + + public Builder results(ReadV1ResponseResultsSummaryResults results) { + this.results = Optional.ofNullable(results); + return this; + } + + public ReadV1ResponseResultsSummary build() { + return new ReadV1ResponseResultsSummary(results, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ReadV1ResponseResultsSummaryResults.java b/src/main/java/com/deepgram/types/ReadV1ResponseResultsSummaryResults.java new file mode 100644 index 0000000..9578b08 --- /dev/null +++ b/src/main/java/com/deepgram/types/ReadV1ResponseResultsSummaryResults.java @@ -0,0 +1,107 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ReadV1ResponseResultsSummaryResults.Builder.class) +public final class ReadV1ResponseResultsSummaryResults { + private final Optional summary; + + private final Map additionalProperties; + + private ReadV1ResponseResultsSummaryResults( + Optional summary, Map additionalProperties) { + this.summary = summary; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("summary") + public Optional getSummary() { + return summary; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReadV1ResponseResultsSummaryResults + && equalTo((ReadV1ResponseResultsSummaryResults) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReadV1ResponseResultsSummaryResults other) { + return summary.equals(other.summary); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.summary); + } + + @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(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ReadV1ResponseResultsSummaryResults other) { + summary(other.getSummary()); + return this; + } + + @JsonSetter(value = "summary", nulls = Nulls.SKIP) + public Builder summary(Optional summary) { + this.summary = summary; + return this; + } + + public Builder summary(ReadV1ResponseResultsSummaryResultsSummary summary) { + this.summary = Optional.ofNullable(summary); + return this; + } + + public ReadV1ResponseResultsSummaryResults build() { + return new ReadV1ResponseResultsSummaryResults(summary, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/ReadV1ResponseResultsSummaryResultsSummary.java b/src/main/java/com/deepgram/types/ReadV1ResponseResultsSummaryResultsSummary.java new file mode 100644 index 0000000..526e4ba --- /dev/null +++ b/src/main/java/com/deepgram/types/ReadV1ResponseResultsSummaryResultsSummary.java @@ -0,0 +1,107 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ReadV1ResponseResultsSummaryResultsSummary.Builder.class) +public final class ReadV1ResponseResultsSummaryResultsSummary { + private final Optional text; + + private final Map additionalProperties; + + private ReadV1ResponseResultsSummaryResultsSummary( + Optional text, Map additionalProperties) { + this.text = text; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("text") + public Optional getText() { + return text; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReadV1ResponseResultsSummaryResultsSummary + && equalTo((ReadV1ResponseResultsSummaryResultsSummary) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReadV1ResponseResultsSummaryResultsSummary other) { + return text.equals(other.text); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.text); + } + + @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 text = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ReadV1ResponseResultsSummaryResultsSummary other) { + text(other.getText()); + return this; + } + + @JsonSetter(value = "text", nulls = Nulls.SKIP) + public Builder text(Optional text) { + this.text = text; + return this; + } + + public Builder text(String text) { + this.text = Optional.ofNullable(text); + return this; + } + + public ReadV1ResponseResultsSummaryResultsSummary build() { + return new ReadV1ResponseResultsSummaryResultsSummary(text, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/SharedIntents.java b/src/main/java/com/deepgram/types/SharedIntents.java new file mode 100644 index 0000000..c689861 --- /dev/null +++ b/src/main/java/com/deepgram/types/SharedIntents.java @@ -0,0 +1,105 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SharedIntents.Builder.class) +public final class SharedIntents { + private final Optional results; + + private final Map additionalProperties; + + private SharedIntents(Optional results, Map additionalProperties) { + this.results = results; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("results") + public Optional getResults() { + return results; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SharedIntents && equalTo((SharedIntents) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SharedIntents other) { + return results.equals(other.results); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.results); + } + + @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(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(SharedIntents other) { + results(other.getResults()); + return this; + } + + @JsonSetter(value = "results", nulls = Nulls.SKIP) + public Builder results(Optional results) { + this.results = results; + return this; + } + + public Builder results(SharedIntentsResults results) { + this.results = Optional.ofNullable(results); + return this; + } + + public SharedIntents build() { + return new SharedIntents(results, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/SharedIntentsResults.java b/src/main/java/com/deepgram/types/SharedIntentsResults.java new file mode 100644 index 0000000..44bfe37 --- /dev/null +++ b/src/main/java/com/deepgram/types/SharedIntentsResults.java @@ -0,0 +1,106 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SharedIntentsResults.Builder.class) +public final class SharedIntentsResults { + private final Optional intents; + + private final Map additionalProperties; + + private SharedIntentsResults( + Optional intents, Map additionalProperties) { + this.intents = intents; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("intents") + public Optional getIntents() { + return intents; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SharedIntentsResults && equalTo((SharedIntentsResults) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SharedIntentsResults other) { + return intents.equals(other.intents); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.intents); + } + + @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 intents = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(SharedIntentsResults other) { + intents(other.getIntents()); + return this; + } + + @JsonSetter(value = "intents", nulls = Nulls.SKIP) + public Builder intents(Optional intents) { + this.intents = intents; + return this; + } + + public Builder intents(SharedIntentsResultsIntents intents) { + this.intents = Optional.ofNullable(intents); + return this; + } + + public SharedIntentsResults build() { + return new SharedIntentsResults(intents, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/SharedIntentsResultsIntents.java b/src/main/java/com/deepgram/types/SharedIntentsResultsIntents.java new file mode 100644 index 0000000..a5fe89b --- /dev/null +++ b/src/main/java/com/deepgram/types/SharedIntentsResultsIntents.java @@ -0,0 +1,108 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = SharedIntentsResultsIntents.Builder.class) +public final class SharedIntentsResultsIntents { + private final Optional> segments; + + private final Map additionalProperties; + + private SharedIntentsResultsIntents( + Optional> segments, + Map additionalProperties) { + this.segments = segments; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("segments") + public Optional> getSegments() { + return segments; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SharedIntentsResultsIntents && equalTo((SharedIntentsResultsIntents) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SharedIntentsResultsIntents other) { + return segments.equals(other.segments); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.segments); + } + + @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> segments = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(SharedIntentsResultsIntents other) { + segments(other.getSegments()); + return this; + } + + @JsonSetter(value = "segments", nulls = Nulls.SKIP) + public Builder segments(Optional> segments) { + this.segments = segments; + return this; + } + + public Builder segments(List segments) { + this.segments = Optional.ofNullable(segments); + return this; + } + + public SharedIntentsResultsIntents build() { + return new SharedIntentsResultsIntents(segments, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/SharedIntentsResultsIntentsSegmentsItem.java b/src/main/java/com/deepgram/types/SharedIntentsResultsIntentsSegmentsItem.java new file mode 100644 index 0000000..694be4f --- /dev/null +++ b/src/main/java/com/deepgram/types/SharedIntentsResultsIntentsSegmentsItem.java @@ -0,0 +1,181 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = SharedIntentsResultsIntentsSegmentsItem.Builder.class) +public final class SharedIntentsResultsIntentsSegmentsItem { + private final Optional text; + + private final Optional startWord; + + private final Optional endWord; + + private final Optional> intents; + + private final Map additionalProperties; + + private SharedIntentsResultsIntentsSegmentsItem( + Optional text, + Optional startWord, + Optional endWord, + Optional> intents, + Map additionalProperties) { + this.text = text; + this.startWord = startWord; + this.endWord = endWord; + this.intents = intents; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("text") + public Optional getText() { + return text; + } + + @JsonProperty("start_word") + public Optional getStartWord() { + return startWord; + } + + @JsonProperty("end_word") + public Optional getEndWord() { + return endWord; + } + + @JsonProperty("intents") + public Optional> getIntents() { + return intents; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SharedIntentsResultsIntentsSegmentsItem + && equalTo((SharedIntentsResultsIntentsSegmentsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SharedIntentsResultsIntentsSegmentsItem other) { + return text.equals(other.text) + && startWord.equals(other.startWord) + && endWord.equals(other.endWord) + && intents.equals(other.intents); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.text, this.startWord, this.endWord, this.intents); + } + + @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 text = Optional.empty(); + + private Optional startWord = Optional.empty(); + + private Optional endWord = Optional.empty(); + + private Optional> intents = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(SharedIntentsResultsIntentsSegmentsItem other) { + text(other.getText()); + startWord(other.getStartWord()); + endWord(other.getEndWord()); + intents(other.getIntents()); + return this; + } + + @JsonSetter(value = "text", nulls = Nulls.SKIP) + public Builder text(Optional text) { + this.text = text; + return this; + } + + public Builder text(String text) { + this.text = Optional.ofNullable(text); + return this; + } + + @JsonSetter(value = "start_word", nulls = Nulls.SKIP) + public Builder startWord(Optional startWord) { + this.startWord = startWord; + return this; + } + + public Builder startWord(Double startWord) { + this.startWord = Optional.ofNullable(startWord); + return this; + } + + @JsonSetter(value = "end_word", nulls = Nulls.SKIP) + public Builder endWord(Optional endWord) { + this.endWord = endWord; + return this; + } + + public Builder endWord(Double endWord) { + this.endWord = Optional.ofNullable(endWord); + return this; + } + + @JsonSetter(value = "intents", nulls = Nulls.SKIP) + public Builder intents(Optional> intents) { + this.intents = intents; + return this; + } + + public Builder intents(List intents) { + this.intents = Optional.ofNullable(intents); + return this; + } + + public SharedIntentsResultsIntentsSegmentsItem build() { + return new SharedIntentsResultsIntentsSegmentsItem(text, startWord, endWord, intents, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/SharedIntentsResultsIntentsSegmentsItemIntentsItem.java b/src/main/java/com/deepgram/types/SharedIntentsResultsIntentsSegmentsItemIntentsItem.java new file mode 100644 index 0000000..d6554e2 --- /dev/null +++ b/src/main/java/com/deepgram/types/SharedIntentsResultsIntentsSegmentsItemIntentsItem.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SharedIntentsResultsIntentsSegmentsItemIntentsItem.Builder.class) +public final class SharedIntentsResultsIntentsSegmentsItemIntentsItem { + private final Optional intent; + + private final Optional confidenceScore; + + private final Map additionalProperties; + + private SharedIntentsResultsIntentsSegmentsItemIntentsItem( + Optional intent, Optional confidenceScore, Map additionalProperties) { + this.intent = intent; + this.confidenceScore = confidenceScore; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("intent") + public Optional getIntent() { + return intent; + } + + @JsonProperty("confidence_score") + public Optional getConfidenceScore() { + return confidenceScore; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SharedIntentsResultsIntentsSegmentsItemIntentsItem + && equalTo((SharedIntentsResultsIntentsSegmentsItemIntentsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SharedIntentsResultsIntentsSegmentsItemIntentsItem other) { + return intent.equals(other.intent) && confidenceScore.equals(other.confidenceScore); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.intent, this.confidenceScore); + } + + @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 intent = Optional.empty(); + + private Optional confidenceScore = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(SharedIntentsResultsIntentsSegmentsItemIntentsItem other) { + intent(other.getIntent()); + confidenceScore(other.getConfidenceScore()); + return this; + } + + @JsonSetter(value = "intent", nulls = Nulls.SKIP) + public Builder intent(Optional intent) { + this.intent = intent; + return this; + } + + public Builder intent(String intent) { + this.intent = Optional.ofNullable(intent); + return this; + } + + @JsonSetter(value = "confidence_score", nulls = Nulls.SKIP) + public Builder confidenceScore(Optional confidenceScore) { + this.confidenceScore = confidenceScore; + return this; + } + + public Builder confidenceScore(Float confidenceScore) { + this.confidenceScore = Optional.ofNullable(confidenceScore); + return this; + } + + public SharedIntentsResultsIntentsSegmentsItemIntentsItem build() { + return new SharedIntentsResultsIntentsSegmentsItemIntentsItem( + intent, confidenceScore, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/SharedSentiments.java b/src/main/java/com/deepgram/types/SharedSentiments.java new file mode 100644 index 0000000..5d3897d --- /dev/null +++ b/src/main/java/com/deepgram/types/SharedSentiments.java @@ -0,0 +1,131 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = SharedSentiments.Builder.class) +public final class SharedSentiments { + private final Optional> segments; + + private final Optional average; + + private final Map additionalProperties; + + private SharedSentiments( + Optional> segments, + Optional average, + Map additionalProperties) { + this.segments = segments; + this.average = average; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("segments") + public Optional> getSegments() { + return segments; + } + + @JsonProperty("average") + public Optional getAverage() { + return average; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SharedSentiments && equalTo((SharedSentiments) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SharedSentiments other) { + return segments.equals(other.segments) && average.equals(other.average); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.segments, this.average); + } + + @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> segments = Optional.empty(); + + private Optional average = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(SharedSentiments other) { + segments(other.getSegments()); + average(other.getAverage()); + return this; + } + + @JsonSetter(value = "segments", nulls = Nulls.SKIP) + public Builder segments(Optional> segments) { + this.segments = segments; + return this; + } + + public Builder segments(List segments) { + this.segments = Optional.ofNullable(segments); + return this; + } + + @JsonSetter(value = "average", nulls = Nulls.SKIP) + public Builder average(Optional average) { + this.average = average; + return this; + } + + public Builder average(SharedSentimentsAverage average) { + this.average = Optional.ofNullable(average); + return this; + } + + public SharedSentiments build() { + return new SharedSentiments(segments, average, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/SharedSentimentsAverage.java b/src/main/java/com/deepgram/types/SharedSentimentsAverage.java new file mode 100644 index 0000000..9e61a96 --- /dev/null +++ b/src/main/java/com/deepgram/types/SharedSentimentsAverage.java @@ -0,0 +1,128 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SharedSentimentsAverage.Builder.class) +public final class SharedSentimentsAverage { + private final Optional sentiment; + + private final Optional sentimentScore; + + private final Map additionalProperties; + + private SharedSentimentsAverage( + Optional sentiment, Optional sentimentScore, Map additionalProperties) { + this.sentiment = sentiment; + this.sentimentScore = sentimentScore; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("sentiment") + public Optional getSentiment() { + return sentiment; + } + + @JsonProperty("sentiment_score") + public Optional getSentimentScore() { + return sentimentScore; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SharedSentimentsAverage && equalTo((SharedSentimentsAverage) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SharedSentimentsAverage other) { + return sentiment.equals(other.sentiment) && sentimentScore.equals(other.sentimentScore); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.sentiment, this.sentimentScore); + } + + @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 sentiment = Optional.empty(); + + private Optional sentimentScore = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(SharedSentimentsAverage other) { + sentiment(other.getSentiment()); + sentimentScore(other.getSentimentScore()); + return this; + } + + @JsonSetter(value = "sentiment", nulls = Nulls.SKIP) + public Builder sentiment(Optional sentiment) { + this.sentiment = sentiment; + return this; + } + + public Builder sentiment(String sentiment) { + this.sentiment = Optional.ofNullable(sentiment); + return this; + } + + @JsonSetter(value = "sentiment_score", nulls = Nulls.SKIP) + public Builder sentimentScore(Optional sentimentScore) { + this.sentimentScore = sentimentScore; + return this; + } + + public Builder sentimentScore(Double sentimentScore) { + this.sentimentScore = Optional.ofNullable(sentimentScore); + return this; + } + + public SharedSentimentsAverage build() { + return new SharedSentimentsAverage(sentiment, sentimentScore, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/SharedSentimentsSegmentsItem.java b/src/main/java/com/deepgram/types/SharedSentimentsSegmentsItem.java new file mode 100644 index 0000000..d9eebda --- /dev/null +++ b/src/main/java/com/deepgram/types/SharedSentimentsSegmentsItem.java @@ -0,0 +1,204 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SharedSentimentsSegmentsItem.Builder.class) +public final class SharedSentimentsSegmentsItem { + private final Optional text; + + private final Optional startWord; + + private final Optional endWord; + + private final Optional sentiment; + + private final Optional sentimentScore; + + private final Map additionalProperties; + + private SharedSentimentsSegmentsItem( + Optional text, + Optional startWord, + Optional endWord, + Optional sentiment, + Optional sentimentScore, + Map additionalProperties) { + this.text = text; + this.startWord = startWord; + this.endWord = endWord; + this.sentiment = sentiment; + this.sentimentScore = sentimentScore; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("text") + public Optional getText() { + return text; + } + + @JsonProperty("start_word") + public Optional getStartWord() { + return startWord; + } + + @JsonProperty("end_word") + public Optional getEndWord() { + return endWord; + } + + @JsonProperty("sentiment") + public Optional getSentiment() { + return sentiment; + } + + @JsonProperty("sentiment_score") + public Optional getSentimentScore() { + return sentimentScore; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SharedSentimentsSegmentsItem && equalTo((SharedSentimentsSegmentsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SharedSentimentsSegmentsItem other) { + return text.equals(other.text) + && startWord.equals(other.startWord) + && endWord.equals(other.endWord) + && sentiment.equals(other.sentiment) + && sentimentScore.equals(other.sentimentScore); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.text, this.startWord, this.endWord, this.sentiment, this.sentimentScore); + } + + @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 text = Optional.empty(); + + private Optional startWord = Optional.empty(); + + private Optional endWord = Optional.empty(); + + private Optional sentiment = Optional.empty(); + + private Optional sentimentScore = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(SharedSentimentsSegmentsItem other) { + text(other.getText()); + startWord(other.getStartWord()); + endWord(other.getEndWord()); + sentiment(other.getSentiment()); + sentimentScore(other.getSentimentScore()); + return this; + } + + @JsonSetter(value = "text", nulls = Nulls.SKIP) + public Builder text(Optional text) { + this.text = text; + return this; + } + + public Builder text(String text) { + this.text = Optional.ofNullable(text); + return this; + } + + @JsonSetter(value = "start_word", nulls = Nulls.SKIP) + public Builder startWord(Optional startWord) { + this.startWord = startWord; + return this; + } + + public Builder startWord(Double startWord) { + this.startWord = Optional.ofNullable(startWord); + return this; + } + + @JsonSetter(value = "end_word", nulls = Nulls.SKIP) + public Builder endWord(Optional endWord) { + this.endWord = endWord; + return this; + } + + public Builder endWord(Double endWord) { + this.endWord = Optional.ofNullable(endWord); + return this; + } + + @JsonSetter(value = "sentiment", nulls = Nulls.SKIP) + public Builder sentiment(Optional sentiment) { + this.sentiment = sentiment; + return this; + } + + public Builder sentiment(String sentiment) { + this.sentiment = Optional.ofNullable(sentiment); + return this; + } + + @JsonSetter(value = "sentiment_score", nulls = Nulls.SKIP) + public Builder sentimentScore(Optional sentimentScore) { + this.sentimentScore = sentimentScore; + return this; + } + + public Builder sentimentScore(Double sentimentScore) { + this.sentimentScore = Optional.ofNullable(sentimentScore); + return this; + } + + public SharedSentimentsSegmentsItem build() { + return new SharedSentimentsSegmentsItem( + text, startWord, endWord, sentiment, sentimentScore, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/SharedTopics.java b/src/main/java/com/deepgram/types/SharedTopics.java new file mode 100644 index 0000000..463e84c --- /dev/null +++ b/src/main/java/com/deepgram/types/SharedTopics.java @@ -0,0 +1,105 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SharedTopics.Builder.class) +public final class SharedTopics { + private final Optional results; + + private final Map additionalProperties; + + private SharedTopics(Optional results, Map additionalProperties) { + this.results = results; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("results") + public Optional getResults() { + return results; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SharedTopics && equalTo((SharedTopics) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SharedTopics other) { + return results.equals(other.results); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.results); + } + + @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(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(SharedTopics other) { + results(other.getResults()); + return this; + } + + @JsonSetter(value = "results", nulls = Nulls.SKIP) + public Builder results(Optional results) { + this.results = results; + return this; + } + + public Builder results(SharedTopicsResults results) { + this.results = Optional.ofNullable(results); + return this; + } + + public SharedTopics build() { + return new SharedTopics(results, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/SharedTopicsResults.java b/src/main/java/com/deepgram/types/SharedTopicsResults.java new file mode 100644 index 0000000..d25c8cc --- /dev/null +++ b/src/main/java/com/deepgram/types/SharedTopicsResults.java @@ -0,0 +1,105 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SharedTopicsResults.Builder.class) +public final class SharedTopicsResults { + private final Optional topics; + + private final Map additionalProperties; + + private SharedTopicsResults(Optional topics, Map additionalProperties) { + this.topics = topics; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("topics") + public Optional getTopics() { + return topics; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SharedTopicsResults && equalTo((SharedTopicsResults) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SharedTopicsResults other) { + return topics.equals(other.topics); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.topics); + } + + @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 topics = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(SharedTopicsResults other) { + topics(other.getTopics()); + return this; + } + + @JsonSetter(value = "topics", nulls = Nulls.SKIP) + public Builder topics(Optional topics) { + this.topics = topics; + return this; + } + + public Builder topics(SharedTopicsResultsTopics topics) { + this.topics = Optional.ofNullable(topics); + return this; + } + + public SharedTopicsResults build() { + return new SharedTopicsResults(topics, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/SharedTopicsResultsTopics.java b/src/main/java/com/deepgram/types/SharedTopicsResultsTopics.java new file mode 100644 index 0000000..e3a1cbb --- /dev/null +++ b/src/main/java/com/deepgram/types/SharedTopicsResultsTopics.java @@ -0,0 +1,107 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = SharedTopicsResultsTopics.Builder.class) +public final class SharedTopicsResultsTopics { + private final Optional> segments; + + private final Map additionalProperties; + + private SharedTopicsResultsTopics( + Optional> segments, Map additionalProperties) { + this.segments = segments; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("segments") + public Optional> getSegments() { + return segments; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SharedTopicsResultsTopics && equalTo((SharedTopicsResultsTopics) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SharedTopicsResultsTopics other) { + return segments.equals(other.segments); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.segments); + } + + @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> segments = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(SharedTopicsResultsTopics other) { + segments(other.getSegments()); + return this; + } + + @JsonSetter(value = "segments", nulls = Nulls.SKIP) + public Builder segments(Optional> segments) { + this.segments = segments; + return this; + } + + public Builder segments(List segments) { + this.segments = Optional.ofNullable(segments); + return this; + } + + public SharedTopicsResultsTopics build() { + return new SharedTopicsResultsTopics(segments, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/SharedTopicsResultsTopicsSegmentsItem.java b/src/main/java/com/deepgram/types/SharedTopicsResultsTopicsSegmentsItem.java new file mode 100644 index 0000000..19cd942 --- /dev/null +++ b/src/main/java/com/deepgram/types/SharedTopicsResultsTopicsSegmentsItem.java @@ -0,0 +1,181 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = SharedTopicsResultsTopicsSegmentsItem.Builder.class) +public final class SharedTopicsResultsTopicsSegmentsItem { + private final Optional text; + + private final Optional startWord; + + private final Optional endWord; + + private final Optional> topics; + + private final Map additionalProperties; + + private SharedTopicsResultsTopicsSegmentsItem( + Optional text, + Optional startWord, + Optional endWord, + Optional> topics, + Map additionalProperties) { + this.text = text; + this.startWord = startWord; + this.endWord = endWord; + this.topics = topics; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("text") + public Optional getText() { + return text; + } + + @JsonProperty("start_word") + public Optional getStartWord() { + return startWord; + } + + @JsonProperty("end_word") + public Optional getEndWord() { + return endWord; + } + + @JsonProperty("topics") + public Optional> getTopics() { + return topics; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SharedTopicsResultsTopicsSegmentsItem + && equalTo((SharedTopicsResultsTopicsSegmentsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SharedTopicsResultsTopicsSegmentsItem other) { + return text.equals(other.text) + && startWord.equals(other.startWord) + && endWord.equals(other.endWord) + && topics.equals(other.topics); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.text, this.startWord, this.endWord, this.topics); + } + + @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 text = Optional.empty(); + + private Optional startWord = Optional.empty(); + + private Optional endWord = Optional.empty(); + + private Optional> topics = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(SharedTopicsResultsTopicsSegmentsItem other) { + text(other.getText()); + startWord(other.getStartWord()); + endWord(other.getEndWord()); + topics(other.getTopics()); + return this; + } + + @JsonSetter(value = "text", nulls = Nulls.SKIP) + public Builder text(Optional text) { + this.text = text; + return this; + } + + public Builder text(String text) { + this.text = Optional.ofNullable(text); + return this; + } + + @JsonSetter(value = "start_word", nulls = Nulls.SKIP) + public Builder startWord(Optional startWord) { + this.startWord = startWord; + return this; + } + + public Builder startWord(Double startWord) { + this.startWord = Optional.ofNullable(startWord); + return this; + } + + @JsonSetter(value = "end_word", nulls = Nulls.SKIP) + public Builder endWord(Optional endWord) { + this.endWord = endWord; + return this; + } + + public Builder endWord(Double endWord) { + this.endWord = Optional.ofNullable(endWord); + return this; + } + + @JsonSetter(value = "topics", nulls = Nulls.SKIP) + public Builder topics(Optional> topics) { + this.topics = topics; + return this; + } + + public Builder topics(List topics) { + this.topics = Optional.ofNullable(topics); + return this; + } + + public SharedTopicsResultsTopicsSegmentsItem build() { + return new SharedTopicsResultsTopicsSegmentsItem(text, startWord, endWord, topics, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/SharedTopicsResultsTopicsSegmentsItemTopicsItem.java b/src/main/java/com/deepgram/types/SharedTopicsResultsTopicsSegmentsItemTopicsItem.java new file mode 100644 index 0000000..3721cd8 --- /dev/null +++ b/src/main/java/com/deepgram/types/SharedTopicsResultsTopicsSegmentsItemTopicsItem.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SharedTopicsResultsTopicsSegmentsItemTopicsItem.Builder.class) +public final class SharedTopicsResultsTopicsSegmentsItemTopicsItem { + private final Optional topic; + + private final Optional confidenceScore; + + private final Map additionalProperties; + + private SharedTopicsResultsTopicsSegmentsItemTopicsItem( + Optional topic, Optional confidenceScore, Map additionalProperties) { + this.topic = topic; + this.confidenceScore = confidenceScore; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("topic") + public Optional getTopic() { + return topic; + } + + @JsonProperty("confidence_score") + public Optional getConfidenceScore() { + return confidenceScore; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SharedTopicsResultsTopicsSegmentsItemTopicsItem + && equalTo((SharedTopicsResultsTopicsSegmentsItemTopicsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SharedTopicsResultsTopicsSegmentsItemTopicsItem other) { + return topic.equals(other.topic) && confidenceScore.equals(other.confidenceScore); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.topic, this.confidenceScore); + } + + @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 topic = Optional.empty(); + + private Optional confidenceScore = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(SharedTopicsResultsTopicsSegmentsItemTopicsItem other) { + topic(other.getTopic()); + confidenceScore(other.getConfidenceScore()); + return this; + } + + @JsonSetter(value = "topic", nulls = Nulls.SKIP) + public Builder topic(Optional topic) { + this.topic = topic; + return this; + } + + public Builder topic(String topic) { + this.topic = Optional.ofNullable(topic); + return this; + } + + @JsonSetter(value = "confidence_score", nulls = Nulls.SKIP) + public Builder confidenceScore(Optional confidenceScore) { + this.confidenceScore = confidenceScore; + return this; + } + + public Builder confidenceScore(Float confidenceScore) { + this.confidenceScore = Optional.ofNullable(confidenceScore); + return this; + } + + public SharedTopicsResultsTopicsSegmentsItemTopicsItem build() { + return new SharedTopicsResultsTopicsSegmentsItemTopicsItem(topic, confidenceScore, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/SpeakSettingsV1.java b/src/main/java/com/deepgram/types/SpeakSettingsV1.java new file mode 100644 index 0000000..b2d411c --- /dev/null +++ b/src/main/java/com/deepgram/types/SpeakSettingsV1.java @@ -0,0 +1,42 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.WrappedAlias; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class SpeakSettingsV1 implements WrappedAlias { + private final Object value; + + private SpeakSettingsV1(Object value) { + this.value = value; + } + + @JsonValue + public Object get() { + return this.value; + } + + @java.lang.Override + public boolean equals(Object other) { + return this == other + || (other instanceof SpeakSettingsV1 && this.value.equals(((SpeakSettingsV1) other).value)); + } + + @java.lang.Override + public int hashCode() { + return value.hashCode(); + } + + @java.lang.Override + public String toString() { + return value.toString(); + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static SpeakSettingsV1 of(Object value) { + return new SpeakSettingsV1(value); + } +} diff --git a/src/main/java/com/deepgram/types/SpeakV1Encoding.java b/src/main/java/com/deepgram/types/SpeakV1Encoding.java new file mode 100644 index 0000000..5be8cd7 --- /dev/null +++ b/src/main/java/com/deepgram/types/SpeakV1Encoding.java @@ -0,0 +1,93 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class SpeakV1Encoding { + public static final SpeakV1Encoding MULAW = new SpeakV1Encoding(Value.MULAW, "mulaw"); + + public static final SpeakV1Encoding LINEAR16 = new SpeakV1Encoding(Value.LINEAR16, "linear16"); + + public static final SpeakV1Encoding ALAW = new SpeakV1Encoding(Value.ALAW, "alaw"); + + private final Value value; + + private final String string; + + SpeakV1Encoding(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof SpeakV1Encoding && this.string.equals(((SpeakV1Encoding) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case MULAW: + return visitor.visitMulaw(); + case LINEAR16: + return visitor.visitLinear16(); + case ALAW: + return visitor.visitAlaw(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static SpeakV1Encoding valueOf(String value) { + switch (value) { + case "mulaw": + return MULAW; + case "linear16": + return LINEAR16; + case "alaw": + return ALAW; + default: + return new SpeakV1Encoding(Value.UNKNOWN, value); + } + } + + public enum Value { + LINEAR16, + + MULAW, + + ALAW, + + UNKNOWN + } + + public interface Visitor { + T visitLinear16(); + + T visitMulaw(); + + T visitAlaw(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/types/SpeakV1MipOptOut.java b/src/main/java/com/deepgram/types/SpeakV1MipOptOut.java new file mode 100644 index 0000000..6d5455c --- /dev/null +++ b/src/main/java/com/deepgram/types/SpeakV1MipOptOut.java @@ -0,0 +1,42 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.WrappedAlias; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class SpeakV1MipOptOut implements WrappedAlias { + private final Object value; + + private SpeakV1MipOptOut(Object value) { + this.value = value; + } + + @JsonValue + public Object get() { + return this.value; + } + + @java.lang.Override + public boolean equals(Object other) { + return this == other + || (other instanceof SpeakV1MipOptOut && this.value.equals(((SpeakV1MipOptOut) other).value)); + } + + @java.lang.Override + public int hashCode() { + return value.hashCode(); + } + + @java.lang.Override + public String toString() { + return value.toString(); + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static SpeakV1MipOptOut of(Object value) { + return new SpeakV1MipOptOut(value); + } +} diff --git a/src/main/java/com/deepgram/types/SpeakV1Model.java b/src/main/java/com/deepgram/types/SpeakV1Model.java new file mode 100644 index 0000000..8e6bca7 --- /dev/null +++ b/src/main/java/com/deepgram/types/SpeakV1Model.java @@ -0,0 +1,693 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class SpeakV1Model { + public static final SpeakV1Model AURA_ANGUS_EN = new SpeakV1Model(Value.AURA_ANGUS_EN, "aura-angus-en"); + + public static final SpeakV1Model AURA2JUPITER_EN = new SpeakV1Model(Value.AURA2JUPITER_EN, "aura-2-jupiter-en"); + + public static final SpeakV1Model AURA2CORA_EN = new SpeakV1Model(Value.AURA2CORA_EN, "aura-2-cora-en"); + + public static final SpeakV1Model AURA_STELLA_EN = new SpeakV1Model(Value.AURA_STELLA_EN, "aura-stella-en"); + + public static final SpeakV1Model AURA2HELENA_EN = new SpeakV1Model(Value.AURA2HELENA_EN, "aura-2-helena-en"); + + public static final SpeakV1Model AURA2AQUILA_ES = new SpeakV1Model(Value.AURA2AQUILA_ES, "aura-2-aquila-es"); + + public static final SpeakV1Model AURA2ATLAS_EN = new SpeakV1Model(Value.AURA2ATLAS_EN, "aura-2-atlas-en"); + + public static final SpeakV1Model AURA2ORION_EN = new SpeakV1Model(Value.AURA2ORION_EN, "aura-2-orion-en"); + + public static final SpeakV1Model AURA2DRACO_EN = new SpeakV1Model(Value.AURA2DRACO_EN, "aura-2-draco-en"); + + public static final SpeakV1Model AURA2HYPERION_EN = new SpeakV1Model(Value.AURA2HYPERION_EN, "aura-2-hyperion-en"); + + public static final SpeakV1Model AURA2JANUS_EN = new SpeakV1Model(Value.AURA2JANUS_EN, "aura-2-janus-en"); + + public static final SpeakV1Model AURA_HELIOS_EN = new SpeakV1Model(Value.AURA_HELIOS_EN, "aura-helios-en"); + + public static final SpeakV1Model AURA2PLUTO_EN = new SpeakV1Model(Value.AURA2PLUTO_EN, "aura-2-pluto-en"); + + public static final SpeakV1Model AURA2ARCAS_EN = new SpeakV1Model(Value.AURA2ARCAS_EN, "aura-2-arcas-en"); + + public static final SpeakV1Model AURA2NESTOR_ES = new SpeakV1Model(Value.AURA2NESTOR_ES, "aura-2-nestor-es"); + + public static final SpeakV1Model AURA2NEPTUNE_EN = new SpeakV1Model(Value.AURA2NEPTUNE_EN, "aura-2-neptune-en"); + + public static final SpeakV1Model AURA2MINERVA_EN = new SpeakV1Model(Value.AURA2MINERVA_EN, "aura-2-minerva-en"); + + public static final SpeakV1Model AURA2ALVARO_ES = new SpeakV1Model(Value.AURA2ALVARO_ES, "aura-2-alvaro-es"); + + public static final SpeakV1Model AURA_ATHENA_EN = new SpeakV1Model(Value.AURA_ATHENA_EN, "aura-athena-en"); + + public static final SpeakV1Model AURA_PERSEUS_EN = new SpeakV1Model(Value.AURA_PERSEUS_EN, "aura-perseus-en"); + + public static final SpeakV1Model AURA2ODYSSEUS_EN = new SpeakV1Model(Value.AURA2ODYSSEUS_EN, "aura-2-odysseus-en"); + + public static final SpeakV1Model AURA2PANDORA_EN = new SpeakV1Model(Value.AURA2PANDORA_EN, "aura-2-pandora-en"); + + public static final SpeakV1Model AURA2ZEUS_EN = new SpeakV1Model(Value.AURA2ZEUS_EN, "aura-2-zeus-en"); + + public static final SpeakV1Model AURA2ELECTRA_EN = new SpeakV1Model(Value.AURA2ELECTRA_EN, "aura-2-electra-en"); + + public static final SpeakV1Model AURA2ORPHEUS_EN = new SpeakV1Model(Value.AURA2ORPHEUS_EN, "aura-2-orpheus-en"); + + public static final SpeakV1Model AURA2THALIA_EN = new SpeakV1Model(Value.AURA2THALIA_EN, "aura-2-thalia-en"); + + public static final SpeakV1Model AURA2CELESTE_ES = new SpeakV1Model(Value.AURA2CELESTE_ES, "aura-2-celeste-es"); + + public static final SpeakV1Model AURA_ASTERIA_EN = new SpeakV1Model(Value.AURA_ASTERIA_EN, "aura-asteria-en"); + + public static final SpeakV1Model AURA2ESTRELLA_ES = new SpeakV1Model(Value.AURA2ESTRELLA_ES, "aura-2-estrella-es"); + + public static final SpeakV1Model AURA2HERA_EN = new SpeakV1Model(Value.AURA2HERA_EN, "aura-2-hera-en"); + + public static final SpeakV1Model AURA2MARS_EN = new SpeakV1Model(Value.AURA2MARS_EN, "aura-2-mars-en"); + + public static final SpeakV1Model AURA2SIRIO_ES = new SpeakV1Model(Value.AURA2SIRIO_ES, "aura-2-sirio-es"); + + public static final SpeakV1Model AURA2ASTERIA_EN = new SpeakV1Model(Value.AURA2ASTERIA_EN, "aura-2-asteria-en"); + + public static final SpeakV1Model AURA2HERMES_EN = new SpeakV1Model(Value.AURA2HERMES_EN, "aura-2-hermes-en"); + + public static final SpeakV1Model AURA2VESTA_EN = new SpeakV1Model(Value.AURA2VESTA_EN, "aura-2-vesta-en"); + + public static final SpeakV1Model AURA2CARINA_ES = new SpeakV1Model(Value.AURA2CARINA_ES, "aura-2-carina-es"); + + public static final SpeakV1Model AURA2CALLISTA_EN = new SpeakV1Model(Value.AURA2CALLISTA_EN, "aura-2-callista-en"); + + public static final SpeakV1Model AURA2HARMONIA_EN = new SpeakV1Model(Value.AURA2HARMONIA_EN, "aura-2-harmonia-en"); + + public static final SpeakV1Model AURA2SELENA_ES = new SpeakV1Model(Value.AURA2SELENA_ES, "aura-2-selena-es"); + + public static final SpeakV1Model AURA2AURORA_EN = new SpeakV1Model(Value.AURA2AURORA_EN, "aura-2-aurora-en"); + + public static final SpeakV1Model AURA_ZEUS_EN = new SpeakV1Model(Value.AURA_ZEUS_EN, "aura-zeus-en"); + + public static final SpeakV1Model AURA2OPHELIA_EN = new SpeakV1Model(Value.AURA2OPHELIA_EN, "aura-2-ophelia-en"); + + public static final SpeakV1Model AURA2AMALTHEA_EN = new SpeakV1Model(Value.AURA2AMALTHEA_EN, "aura-2-amalthea-en"); + + public static final SpeakV1Model AURA_ORPHEUS_EN = new SpeakV1Model(Value.AURA_ORPHEUS_EN, "aura-orpheus-en"); + + public static final SpeakV1Model AURA2DELIA_EN = new SpeakV1Model(Value.AURA2DELIA_EN, "aura-2-delia-en"); + + public static final SpeakV1Model AURA_LUNA_EN = new SpeakV1Model(Value.AURA_LUNA_EN, "aura-luna-en"); + + public static final SpeakV1Model AURA2APOLLO_EN = new SpeakV1Model(Value.AURA2APOLLO_EN, "aura-2-apollo-en"); + + public static final SpeakV1Model AURA2SELENE_EN = new SpeakV1Model(Value.AURA2SELENE_EN, "aura-2-selene-en"); + + public static final SpeakV1Model AURA2THEIA_EN = new SpeakV1Model(Value.AURA2THEIA_EN, "aura-2-theia-en"); + + public static final SpeakV1Model AURA_HERA_EN = new SpeakV1Model(Value.AURA_HERA_EN, "aura-hera-en"); + + public static final SpeakV1Model AURA2CORDELIA_EN = new SpeakV1Model(Value.AURA2CORDELIA_EN, "aura-2-cordelia-en"); + + public static final SpeakV1Model AURA2ANDROMEDA_EN = + new SpeakV1Model(Value.AURA2ANDROMEDA_EN, "aura-2-andromeda-en"); + + public static final SpeakV1Model AURA2ARIES_EN = new SpeakV1Model(Value.AURA2ARIES_EN, "aura-2-aries-en"); + + public static final SpeakV1Model AURA2JUNO_EN = new SpeakV1Model(Value.AURA2JUNO_EN, "aura-2-juno-en"); + + public static final SpeakV1Model AURA2LUNA_EN = new SpeakV1Model(Value.AURA2LUNA_EN, "aura-2-luna-en"); + + public static final SpeakV1Model AURA2DIANA_ES = new SpeakV1Model(Value.AURA2DIANA_ES, "aura-2-diana-es"); + + public static final SpeakV1Model AURA2JAVIER_ES = new SpeakV1Model(Value.AURA2JAVIER_ES, "aura-2-javier-es"); + + public static final SpeakV1Model AURA_ORION_EN = new SpeakV1Model(Value.AURA_ORION_EN, "aura-orion-en"); + + public static final SpeakV1Model AURA_ARCAS_EN = new SpeakV1Model(Value.AURA_ARCAS_EN, "aura-arcas-en"); + + public static final SpeakV1Model AURA2IRIS_EN = new SpeakV1Model(Value.AURA2IRIS_EN, "aura-2-iris-en"); + + public static final SpeakV1Model AURA2ATHENA_EN = new SpeakV1Model(Value.AURA2ATHENA_EN, "aura-2-athena-en"); + + public static final SpeakV1Model AURA2SATURN_EN = new SpeakV1Model(Value.AURA2SATURN_EN, "aura-2-saturn-en"); + + public static final SpeakV1Model AURA2PHOEBE_EN = new SpeakV1Model(Value.AURA2PHOEBE_EN, "aura-2-phoebe-en"); + + private final Value value; + + private final String string; + + SpeakV1Model(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) || (other instanceof SpeakV1Model && this.string.equals(((SpeakV1Model) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case AURA_ANGUS_EN: + return visitor.visitAuraAngusEn(); + case AURA2JUPITER_EN: + return visitor.visitAura2JupiterEn(); + case AURA2CORA_EN: + return visitor.visitAura2CoraEn(); + case AURA_STELLA_EN: + return visitor.visitAuraStellaEn(); + case AURA2HELENA_EN: + return visitor.visitAura2HelenaEn(); + case AURA2AQUILA_ES: + return visitor.visitAura2AquilaEs(); + case AURA2ATLAS_EN: + return visitor.visitAura2AtlasEn(); + case AURA2ORION_EN: + return visitor.visitAura2OrionEn(); + case AURA2DRACO_EN: + return visitor.visitAura2DracoEn(); + case AURA2HYPERION_EN: + return visitor.visitAura2HyperionEn(); + case AURA2JANUS_EN: + return visitor.visitAura2JanusEn(); + case AURA_HELIOS_EN: + return visitor.visitAuraHeliosEn(); + case AURA2PLUTO_EN: + return visitor.visitAura2PlutoEn(); + case AURA2ARCAS_EN: + return visitor.visitAura2ArcasEn(); + case AURA2NESTOR_ES: + return visitor.visitAura2NestorEs(); + case AURA2NEPTUNE_EN: + return visitor.visitAura2NeptuneEn(); + case AURA2MINERVA_EN: + return visitor.visitAura2MinervaEn(); + case AURA2ALVARO_ES: + return visitor.visitAura2AlvaroEs(); + case AURA_ATHENA_EN: + return visitor.visitAuraAthenaEn(); + case AURA_PERSEUS_EN: + return visitor.visitAuraPerseusEn(); + case AURA2ODYSSEUS_EN: + return visitor.visitAura2OdysseusEn(); + case AURA2PANDORA_EN: + return visitor.visitAura2PandoraEn(); + case AURA2ZEUS_EN: + return visitor.visitAura2ZeusEn(); + case AURA2ELECTRA_EN: + return visitor.visitAura2ElectraEn(); + case AURA2ORPHEUS_EN: + return visitor.visitAura2OrpheusEn(); + case AURA2THALIA_EN: + return visitor.visitAura2ThaliaEn(); + case AURA2CELESTE_ES: + return visitor.visitAura2CelesteEs(); + case AURA_ASTERIA_EN: + return visitor.visitAuraAsteriaEn(); + case AURA2ESTRELLA_ES: + return visitor.visitAura2EstrellaEs(); + case AURA2HERA_EN: + return visitor.visitAura2HeraEn(); + case AURA2MARS_EN: + return visitor.visitAura2MarsEn(); + case AURA2SIRIO_ES: + return visitor.visitAura2SirioEs(); + case AURA2ASTERIA_EN: + return visitor.visitAura2AsteriaEn(); + case AURA2HERMES_EN: + return visitor.visitAura2HermesEn(); + case AURA2VESTA_EN: + return visitor.visitAura2VestaEn(); + case AURA2CARINA_ES: + return visitor.visitAura2CarinaEs(); + case AURA2CALLISTA_EN: + return visitor.visitAura2CallistaEn(); + case AURA2HARMONIA_EN: + return visitor.visitAura2HarmoniaEn(); + case AURA2SELENA_ES: + return visitor.visitAura2SelenaEs(); + case AURA2AURORA_EN: + return visitor.visitAura2AuroraEn(); + case AURA_ZEUS_EN: + return visitor.visitAuraZeusEn(); + case AURA2OPHELIA_EN: + return visitor.visitAura2OpheliaEn(); + case AURA2AMALTHEA_EN: + return visitor.visitAura2AmaltheaEn(); + case AURA_ORPHEUS_EN: + return visitor.visitAuraOrpheusEn(); + case AURA2DELIA_EN: + return visitor.visitAura2DeliaEn(); + case AURA_LUNA_EN: + return visitor.visitAuraLunaEn(); + case AURA2APOLLO_EN: + return visitor.visitAura2ApolloEn(); + case AURA2SELENE_EN: + return visitor.visitAura2SeleneEn(); + case AURA2THEIA_EN: + return visitor.visitAura2TheiaEn(); + case AURA_HERA_EN: + return visitor.visitAuraHeraEn(); + case AURA2CORDELIA_EN: + return visitor.visitAura2CordeliaEn(); + case AURA2ANDROMEDA_EN: + return visitor.visitAura2AndromedaEn(); + case AURA2ARIES_EN: + return visitor.visitAura2AriesEn(); + case AURA2JUNO_EN: + return visitor.visitAura2JunoEn(); + case AURA2LUNA_EN: + return visitor.visitAura2LunaEn(); + case AURA2DIANA_ES: + return visitor.visitAura2DianaEs(); + case AURA2JAVIER_ES: + return visitor.visitAura2JavierEs(); + case AURA_ORION_EN: + return visitor.visitAuraOrionEn(); + case AURA_ARCAS_EN: + return visitor.visitAuraArcasEn(); + case AURA2IRIS_EN: + return visitor.visitAura2IrisEn(); + case AURA2ATHENA_EN: + return visitor.visitAura2AthenaEn(); + case AURA2SATURN_EN: + return visitor.visitAura2SaturnEn(); + case AURA2PHOEBE_EN: + return visitor.visitAura2PhoebeEn(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static SpeakV1Model valueOf(String value) { + switch (value) { + case "aura-angus-en": + return AURA_ANGUS_EN; + case "aura-2-jupiter-en": + return AURA2JUPITER_EN; + case "aura-2-cora-en": + return AURA2CORA_EN; + case "aura-stella-en": + return AURA_STELLA_EN; + case "aura-2-helena-en": + return AURA2HELENA_EN; + case "aura-2-aquila-es": + return AURA2AQUILA_ES; + case "aura-2-atlas-en": + return AURA2ATLAS_EN; + case "aura-2-orion-en": + return AURA2ORION_EN; + case "aura-2-draco-en": + return AURA2DRACO_EN; + case "aura-2-hyperion-en": + return AURA2HYPERION_EN; + case "aura-2-janus-en": + return AURA2JANUS_EN; + case "aura-helios-en": + return AURA_HELIOS_EN; + case "aura-2-pluto-en": + return AURA2PLUTO_EN; + case "aura-2-arcas-en": + return AURA2ARCAS_EN; + case "aura-2-nestor-es": + return AURA2NESTOR_ES; + case "aura-2-neptune-en": + return AURA2NEPTUNE_EN; + case "aura-2-minerva-en": + return AURA2MINERVA_EN; + case "aura-2-alvaro-es": + return AURA2ALVARO_ES; + case "aura-athena-en": + return AURA_ATHENA_EN; + case "aura-perseus-en": + return AURA_PERSEUS_EN; + case "aura-2-odysseus-en": + return AURA2ODYSSEUS_EN; + case "aura-2-pandora-en": + return AURA2PANDORA_EN; + case "aura-2-zeus-en": + return AURA2ZEUS_EN; + case "aura-2-electra-en": + return AURA2ELECTRA_EN; + case "aura-2-orpheus-en": + return AURA2ORPHEUS_EN; + case "aura-2-thalia-en": + return AURA2THALIA_EN; + case "aura-2-celeste-es": + return AURA2CELESTE_ES; + case "aura-asteria-en": + return AURA_ASTERIA_EN; + case "aura-2-estrella-es": + return AURA2ESTRELLA_ES; + case "aura-2-hera-en": + return AURA2HERA_EN; + case "aura-2-mars-en": + return AURA2MARS_EN; + case "aura-2-sirio-es": + return AURA2SIRIO_ES; + case "aura-2-asteria-en": + return AURA2ASTERIA_EN; + case "aura-2-hermes-en": + return AURA2HERMES_EN; + case "aura-2-vesta-en": + return AURA2VESTA_EN; + case "aura-2-carina-es": + return AURA2CARINA_ES; + case "aura-2-callista-en": + return AURA2CALLISTA_EN; + case "aura-2-harmonia-en": + return AURA2HARMONIA_EN; + case "aura-2-selena-es": + return AURA2SELENA_ES; + case "aura-2-aurora-en": + return AURA2AURORA_EN; + case "aura-zeus-en": + return AURA_ZEUS_EN; + case "aura-2-ophelia-en": + return AURA2OPHELIA_EN; + case "aura-2-amalthea-en": + return AURA2AMALTHEA_EN; + case "aura-orpheus-en": + return AURA_ORPHEUS_EN; + case "aura-2-delia-en": + return AURA2DELIA_EN; + case "aura-luna-en": + return AURA_LUNA_EN; + case "aura-2-apollo-en": + return AURA2APOLLO_EN; + case "aura-2-selene-en": + return AURA2SELENE_EN; + case "aura-2-theia-en": + return AURA2THEIA_EN; + case "aura-hera-en": + return AURA_HERA_EN; + case "aura-2-cordelia-en": + return AURA2CORDELIA_EN; + case "aura-2-andromeda-en": + return AURA2ANDROMEDA_EN; + case "aura-2-aries-en": + return AURA2ARIES_EN; + case "aura-2-juno-en": + return AURA2JUNO_EN; + case "aura-2-luna-en": + return AURA2LUNA_EN; + case "aura-2-diana-es": + return AURA2DIANA_ES; + case "aura-2-javier-es": + return AURA2JAVIER_ES; + case "aura-orion-en": + return AURA_ORION_EN; + case "aura-arcas-en": + return AURA_ARCAS_EN; + case "aura-2-iris-en": + return AURA2IRIS_EN; + case "aura-2-athena-en": + return AURA2ATHENA_EN; + case "aura-2-saturn-en": + return AURA2SATURN_EN; + case "aura-2-phoebe-en": + return AURA2PHOEBE_EN; + default: + return new SpeakV1Model(Value.UNKNOWN, value); + } + } + + public enum Value { + AURA_ASTERIA_EN, + + AURA_LUNA_EN, + + AURA_STELLA_EN, + + AURA_ATHENA_EN, + + AURA_HERA_EN, + + AURA_ORION_EN, + + AURA_ARCAS_EN, + + AURA_PERSEUS_EN, + + AURA_ANGUS_EN, + + AURA_ORPHEUS_EN, + + AURA_HELIOS_EN, + + AURA_ZEUS_EN, + + AURA2AMALTHEA_EN, + + AURA2ANDROMEDA_EN, + + AURA2APOLLO_EN, + + AURA2ARCAS_EN, + + AURA2ARIES_EN, + + AURA2ASTERIA_EN, + + AURA2ATHENA_EN, + + AURA2ATLAS_EN, + + AURA2AURORA_EN, + + AURA2CALLISTA_EN, + + AURA2CORDELIA_EN, + + AURA2CORA_EN, + + AURA2DELIA_EN, + + AURA2DRACO_EN, + + AURA2ELECTRA_EN, + + AURA2HARMONIA_EN, + + AURA2HELENA_EN, + + AURA2HERA_EN, + + AURA2HERMES_EN, + + AURA2HYPERION_EN, + + AURA2IRIS_EN, + + AURA2JANUS_EN, + + AURA2JUNO_EN, + + AURA2JUPITER_EN, + + AURA2LUNA_EN, + + AURA2MARS_EN, + + AURA2MINERVA_EN, + + AURA2NEPTUNE_EN, + + AURA2ODYSSEUS_EN, + + AURA2OPHELIA_EN, + + AURA2ORION_EN, + + AURA2ORPHEUS_EN, + + AURA2PANDORA_EN, + + AURA2PHOEBE_EN, + + AURA2PLUTO_EN, + + AURA2SATURN_EN, + + AURA2SELENE_EN, + + AURA2THALIA_EN, + + AURA2THEIA_EN, + + AURA2VESTA_EN, + + AURA2ZEUS_EN, + + AURA2SIRIO_ES, + + AURA2NESTOR_ES, + + AURA2CARINA_ES, + + AURA2CELESTE_ES, + + AURA2ALVARO_ES, + + AURA2DIANA_ES, + + AURA2AQUILA_ES, + + AURA2SELENA_ES, + + AURA2ESTRELLA_ES, + + AURA2JAVIER_ES, + + UNKNOWN + } + + public interface Visitor { + T visitAuraAsteriaEn(); + + T visitAuraLunaEn(); + + T visitAuraStellaEn(); + + T visitAuraAthenaEn(); + + T visitAuraHeraEn(); + + T visitAuraOrionEn(); + + T visitAuraArcasEn(); + + T visitAuraPerseusEn(); + + T visitAuraAngusEn(); + + T visitAuraOrpheusEn(); + + T visitAuraHeliosEn(); + + T visitAuraZeusEn(); + + T visitAura2AmaltheaEn(); + + T visitAura2AndromedaEn(); + + T visitAura2ApolloEn(); + + T visitAura2ArcasEn(); + + T visitAura2AriesEn(); + + T visitAura2AsteriaEn(); + + T visitAura2AthenaEn(); + + T visitAura2AtlasEn(); + + T visitAura2AuroraEn(); + + T visitAura2CallistaEn(); + + T visitAura2CordeliaEn(); + + T visitAura2CoraEn(); + + T visitAura2DeliaEn(); + + T visitAura2DracoEn(); + + T visitAura2ElectraEn(); + + T visitAura2HarmoniaEn(); + + T visitAura2HelenaEn(); + + T visitAura2HeraEn(); + + T visitAura2HermesEn(); + + T visitAura2HyperionEn(); + + T visitAura2IrisEn(); + + T visitAura2JanusEn(); + + T visitAura2JunoEn(); + + T visitAura2JupiterEn(); + + T visitAura2LunaEn(); + + T visitAura2MarsEn(); + + T visitAura2MinervaEn(); + + T visitAura2NeptuneEn(); + + T visitAura2OdysseusEn(); + + T visitAura2OpheliaEn(); + + T visitAura2OrionEn(); + + T visitAura2OrpheusEn(); + + T visitAura2PandoraEn(); + + T visitAura2PhoebeEn(); + + T visitAura2PlutoEn(); + + T visitAura2SaturnEn(); + + T visitAura2SeleneEn(); + + T visitAura2ThaliaEn(); + + T visitAura2TheiaEn(); + + T visitAura2VestaEn(); + + T visitAura2ZeusEn(); + + T visitAura2SirioEs(); + + T visitAura2NestorEs(); + + T visitAura2CarinaEs(); + + T visitAura2CelesteEs(); + + T visitAura2AlvaroEs(); + + T visitAura2DianaEs(); + + T visitAura2AquilaEs(); + + T visitAura2SelenaEs(); + + T visitAura2EstrellaEs(); + + T visitAura2JavierEs(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/types/SpeakV1SampleRate.java b/src/main/java/com/deepgram/types/SpeakV1SampleRate.java new file mode 100644 index 0000000..bfb4bdf --- /dev/null +++ b/src/main/java/com/deepgram/types/SpeakV1SampleRate.java @@ -0,0 +1,116 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public final class SpeakV1SampleRate { + public static final SpeakV1SampleRate EIGHT_THOUSAND = new SpeakV1SampleRate(Value.EIGHT_THOUSAND, "8000"); + + public static final SpeakV1SampleRate SIXTEEN_THOUSAND = new SpeakV1SampleRate(Value.SIXTEEN_THOUSAND, "16000"); + + public static final SpeakV1SampleRate FORTY_EIGHT_THOUSAND = + new SpeakV1SampleRate(Value.FORTY_EIGHT_THOUSAND, "48000"); + + public static final SpeakV1SampleRate TWENTY_FOUR_THOUSAND = + new SpeakV1SampleRate(Value.TWENTY_FOUR_THOUSAND, "24000"); + + public static final SpeakV1SampleRate THIRTY_TWO_THOUSAND = + new SpeakV1SampleRate(Value.THIRTY_TWO_THOUSAND, "32000"); + + private final Value value; + + private final String string; + + SpeakV1SampleRate(Value value, String string) { + this.value = value; + this.string = string; + } + + public Value getEnumValue() { + return value; + } + + @java.lang.Override + @JsonValue + public String toString() { + return this.string; + } + + @java.lang.Override + public boolean equals(Object other) { + return (this == other) + || (other instanceof SpeakV1SampleRate && this.string.equals(((SpeakV1SampleRate) other).string)); + } + + @java.lang.Override + public int hashCode() { + return this.string.hashCode(); + } + + public T visit(Visitor visitor) { + switch (value) { + case EIGHT_THOUSAND: + return visitor.visitEightThousand(); + case SIXTEEN_THOUSAND: + return visitor.visitSixteenThousand(); + case FORTY_EIGHT_THOUSAND: + return visitor.visitFortyEightThousand(); + case TWENTY_FOUR_THOUSAND: + return visitor.visitTwentyFourThousand(); + case THIRTY_TWO_THOUSAND: + return visitor.visitThirtyTwoThousand(); + case UNKNOWN: + default: + return visitor.visitUnknown(string); + } + } + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + public static SpeakV1SampleRate valueOf(String value) { + switch (value) { + case "8000": + return EIGHT_THOUSAND; + case "16000": + return SIXTEEN_THOUSAND; + case "48000": + return FORTY_EIGHT_THOUSAND; + case "24000": + return TWENTY_FOUR_THOUSAND; + case "32000": + return THIRTY_TWO_THOUSAND; + default: + return new SpeakV1SampleRate(Value.UNKNOWN, value); + } + } + + public enum Value { + EIGHT_THOUSAND, + + SIXTEEN_THOUSAND, + + TWENTY_FOUR_THOUSAND, + + THIRTY_TWO_THOUSAND, + + FORTY_EIGHT_THOUSAND, + + UNKNOWN + } + + public interface Visitor { + T visitEightThousand(); + + T visitSixteenThousand(); + + T visitTwentyFourThousand(); + + T visitThirtyTwoThousand(); + + T visitFortyEightThousand(); + + T visitUnknown(String unknownType); + } +} diff --git a/src/main/java/com/deepgram/types/ThinkSettingsV1.java b/src/main/java/com/deepgram/types/ThinkSettingsV1.java new file mode 100644 index 0000000..fcc4e16 --- /dev/null +++ b/src/main/java/com/deepgram/types/ThinkSettingsV1.java @@ -0,0 +1,105 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ThinkSettingsV1.Builder.class) +public final class ThinkSettingsV1 { + private final Optional contextLength; + + private final Map additionalProperties; + + private ThinkSettingsV1(Optional contextLength, Map additionalProperties) { + this.contextLength = contextLength; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("context_length") + public Optional getContextLength() { + return contextLength; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ThinkSettingsV1 && equalTo((ThinkSettingsV1) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ThinkSettingsV1 other) { + return contextLength.equals(other.contextLength); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.contextLength); + } + + @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 contextLength = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ThinkSettingsV1 other) { + contextLength(other.getContextLength()); + return this; + } + + @JsonSetter(value = "context_length", nulls = Nulls.SKIP) + public Builder contextLength(Optional contextLength) { + this.contextLength = contextLength; + return this; + } + + public Builder contextLength(Object contextLength) { + this.contextLength = Optional.ofNullable(contextLength); + return this; + } + + public ThinkSettingsV1 build() { + return new ThinkSettingsV1(contextLength, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/UpdateProjectMemberScopesV1Response.java b/src/main/java/com/deepgram/types/UpdateProjectMemberScopesV1Response.java new file mode 100644 index 0000000..1f24d9d --- /dev/null +++ b/src/main/java/com/deepgram/types/UpdateProjectMemberScopesV1Response.java @@ -0,0 +1,112 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateProjectMemberScopesV1Response.Builder.class) +public final class UpdateProjectMemberScopesV1Response { + private final Optional message; + + private final Map additionalProperties; + + private UpdateProjectMemberScopesV1Response(Optional message, Map additionalProperties) { + this.message = message; + this.additionalProperties = additionalProperties; + } + + /** + * @return confirmation message + */ + @JsonProperty("message") + public Optional getMessage() { + return message; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateProjectMemberScopesV1Response + && equalTo((UpdateProjectMemberScopesV1Response) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateProjectMemberScopesV1Response 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 Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional message = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateProjectMemberScopesV1Response other) { + message(other.getMessage()); + return this; + } + + /** + *

confirmation message

+ */ + @JsonSetter(value = "message", nulls = Nulls.SKIP) + public Builder message(Optional message) { + this.message = message; + return this; + } + + public Builder message(String message) { + this.message = Optional.ofNullable(message); + return this; + } + + public UpdateProjectMemberScopesV1Response build() { + return new UpdateProjectMemberScopesV1Response(message, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/UpdateProjectV1Response.java b/src/main/java/com/deepgram/types/UpdateProjectV1Response.java new file mode 100644 index 0000000..2c1a789 --- /dev/null +++ b/src/main/java/com/deepgram/types/UpdateProjectV1Response.java @@ -0,0 +1,111 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateProjectV1Response.Builder.class) +public final class UpdateProjectV1Response { + private final Optional message; + + private final Map additionalProperties; + + private UpdateProjectV1Response(Optional message, Map additionalProperties) { + this.message = message; + this.additionalProperties = additionalProperties; + } + + /** + * @return confirmation message + */ + @JsonProperty("message") + public Optional getMessage() { + return message; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateProjectV1Response && equalTo((UpdateProjectV1Response) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateProjectV1Response 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 Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional message = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateProjectV1Response other) { + message(other.getMessage()); + return this; + } + + /** + *

confirmation message

+ */ + @JsonSetter(value = "message", nulls = Nulls.SKIP) + public Builder message(Optional message) { + this.message = message; + return this; + } + + public Builder message(String message) { + this.message = Optional.ofNullable(message); + return this; + } + + public UpdateProjectV1Response build() { + return new UpdateProjectV1Response(message, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/UsageBreakdownV1Response.java b/src/main/java/com/deepgram/types/UsageBreakdownV1Response.java new file mode 100644 index 0000000..2dec51d --- /dev/null +++ b/src/main/java/com/deepgram/types/UsageBreakdownV1Response.java @@ -0,0 +1,236 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = UsageBreakdownV1Response.Builder.class) +public final class UsageBreakdownV1Response { + private final String start; + + private final String end; + + private final UsageBreakdownV1ResponseResolution resolution; + + private final List results; + + private final Map additionalProperties; + + private UsageBreakdownV1Response( + String start, + String end, + UsageBreakdownV1ResponseResolution resolution, + List results, + Map additionalProperties) { + this.start = start; + this.end = end; + this.resolution = resolution; + this.results = results; + this.additionalProperties = additionalProperties; + } + + /** + * @return Start date of the usage period + */ + @JsonProperty("start") + public String getStart() { + return start; + } + + /** + * @return End date of the usage period + */ + @JsonProperty("end") + public String getEnd() { + return end; + } + + @JsonProperty("resolution") + public UsageBreakdownV1ResponseResolution getResolution() { + return resolution; + } + + @JsonProperty("results") + public List getResults() { + return results; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UsageBreakdownV1Response && equalTo((UsageBreakdownV1Response) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UsageBreakdownV1Response other) { + return start.equals(other.start) + && end.equals(other.end) + && resolution.equals(other.resolution) + && results.equals(other.results); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.start, this.end, this.resolution, this.results); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static StartStage builder() { + return new Builder(); + } + + public interface StartStage { + /** + *

Start date of the usage period

+ */ + EndStage start(@NotNull String start); + + Builder from(UsageBreakdownV1Response other); + } + + public interface EndStage { + /** + *

End date of the usage period

+ */ + ResolutionStage end(@NotNull String end); + } + + public interface ResolutionStage { + _FinalStage resolution(@NotNull UsageBreakdownV1ResponseResolution resolution); + } + + public interface _FinalStage { + UsageBreakdownV1Response build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + + _FinalStage results(List results); + + _FinalStage addResults(UsageBreakdownV1ResponseResultsItem results); + + _FinalStage addAllResults(List results); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements StartStage, EndStage, ResolutionStage, _FinalStage { + private String start; + + private String end; + + private UsageBreakdownV1ResponseResolution resolution; + + private List results = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UsageBreakdownV1Response other) { + start(other.getStart()); + end(other.getEnd()); + resolution(other.getResolution()); + results(other.getResults()); + return this; + } + + /** + *

Start date of the usage period

+ *

Start date of the usage period

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

End date of the usage period

+ *

End date of the usage period

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("end") + public ResolutionStage end(@NotNull String end) { + this.end = Objects.requireNonNull(end, "end must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("resolution") + public _FinalStage resolution(@NotNull UsageBreakdownV1ResponseResolution resolution) { + this.resolution = Objects.requireNonNull(resolution, "resolution must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllResults(List results) { + if (results != null) { + this.results.addAll(results); + } + return this; + } + + @java.lang.Override + public _FinalStage addResults(UsageBreakdownV1ResponseResultsItem results) { + this.results.add(results); + return this; + } + + @java.lang.Override + @JsonSetter(value = "results", nulls = Nulls.SKIP) + public _FinalStage results(List results) { + this.results.clear(); + if (results != null) { + this.results.addAll(results); + } + return this; + } + + @java.lang.Override + public UsageBreakdownV1Response build() { + return new UsageBreakdownV1Response(start, end, resolution, results, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/UsageBreakdownV1ResponseResolution.java b/src/main/java/com/deepgram/types/UsageBreakdownV1ResponseResolution.java new file mode 100644 index 0000000..5372f22 --- /dev/null +++ b/src/main/java/com/deepgram/types/UsageBreakdownV1ResponseResolution.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UsageBreakdownV1ResponseResolution.Builder.class) +public final class UsageBreakdownV1ResponseResolution { + private final String units; + + private final double amount; + + private final Map additionalProperties; + + private UsageBreakdownV1ResponseResolution(String units, double amount, Map additionalProperties) { + this.units = units; + this.amount = amount; + this.additionalProperties = additionalProperties; + } + + /** + * @return Time unit for the resolution + */ + @JsonProperty("units") + public String getUnits() { + return units; + } + + /** + * @return Amount of units + */ + @JsonProperty("amount") + public double getAmount() { + return amount; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UsageBreakdownV1ResponseResolution + && equalTo((UsageBreakdownV1ResponseResolution) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UsageBreakdownV1ResponseResolution other) { + return units.equals(other.units) && amount == other.amount; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.units, this.amount); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static UnitsStage builder() { + return new Builder(); + } + + public interface UnitsStage { + /** + *

Time unit for the resolution

+ */ + AmountStage units(@NotNull String units); + + Builder from(UsageBreakdownV1ResponseResolution other); + } + + public interface AmountStage { + /** + *

Amount of units

+ */ + _FinalStage amount(double amount); + } + + public interface _FinalStage { + UsageBreakdownV1ResponseResolution build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements UnitsStage, AmountStage, _FinalStage { + private String units; + + private double amount; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UsageBreakdownV1ResponseResolution other) { + units(other.getUnits()); + amount(other.getAmount()); + return this; + } + + /** + *

Time unit for the resolution

+ *

Time unit for the resolution

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

Amount of units

+ *

Amount of units

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("amount") + public _FinalStage amount(double amount) { + this.amount = amount; + return this; + } + + @java.lang.Override + public UsageBreakdownV1ResponseResolution build() { + return new UsageBreakdownV1ResponseResolution(units, amount, additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/UsageBreakdownV1ResponseResultsItem.java b/src/main/java/com/deepgram/types/UsageBreakdownV1ResponseResultsItem.java new file mode 100644 index 0000000..e9e9495 --- /dev/null +++ b/src/main/java/com/deepgram/types/UsageBreakdownV1ResponseResultsItem.java @@ -0,0 +1,392 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UsageBreakdownV1ResponseResultsItem.Builder.class) +public final class UsageBreakdownV1ResponseResultsItem { + private final float hours; + + private final float totalHours; + + private final float agentHours; + + private final double tokensIn; + + private final double tokensOut; + + private final double ttsCharacters; + + private final double requests; + + private final UsageBreakdownV1ResponseResultsItemGrouping grouping; + + private final Map additionalProperties; + + private UsageBreakdownV1ResponseResultsItem( + float hours, + float totalHours, + float agentHours, + double tokensIn, + double tokensOut, + double ttsCharacters, + double requests, + UsageBreakdownV1ResponseResultsItemGrouping grouping, + Map additionalProperties) { + this.hours = hours; + this.totalHours = totalHours; + this.agentHours = agentHours; + this.tokensIn = tokensIn; + this.tokensOut = tokensOut; + this.ttsCharacters = ttsCharacters; + this.requests = requests; + this.grouping = grouping; + this.additionalProperties = additionalProperties; + } + + /** + * @return Audio hours processed + */ + @JsonProperty("hours") + public float getHours() { + return hours; + } + + /** + * @return Total hours including all processing + */ + @JsonProperty("total_hours") + public float getTotalHours() { + return totalHours; + } + + /** + * @return Agent hours used + */ + @JsonProperty("agent_hours") + public float getAgentHours() { + return agentHours; + } + + /** + * @return Number of input tokens + */ + @JsonProperty("tokens_in") + public double getTokensIn() { + return tokensIn; + } + + /** + * @return Number of output tokens + */ + @JsonProperty("tokens_out") + public double getTokensOut() { + return tokensOut; + } + + /** + * @return Number of text-to-speech characters processed + */ + @JsonProperty("tts_characters") + public double getTtsCharacters() { + return ttsCharacters; + } + + /** + * @return Number of requests + */ + @JsonProperty("requests") + public double getRequests() { + return requests; + } + + @JsonProperty("grouping") + public UsageBreakdownV1ResponseResultsItemGrouping getGrouping() { + return grouping; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UsageBreakdownV1ResponseResultsItem + && equalTo((UsageBreakdownV1ResponseResultsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UsageBreakdownV1ResponseResultsItem other) { + return hours == other.hours + && totalHours == other.totalHours + && agentHours == other.agentHours + && tokensIn == other.tokensIn + && tokensOut == other.tokensOut + && ttsCharacters == other.ttsCharacters + && requests == other.requests + && grouping.equals(other.grouping); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.hours, + this.totalHours, + this.agentHours, + this.tokensIn, + this.tokensOut, + this.ttsCharacters, + this.requests, + this.grouping); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static HoursStage builder() { + return new Builder(); + } + + public interface HoursStage { + /** + *

Audio hours processed

+ */ + TotalHoursStage hours(float hours); + + Builder from(UsageBreakdownV1ResponseResultsItem other); + } + + public interface TotalHoursStage { + /** + *

Total hours including all processing

+ */ + AgentHoursStage totalHours(float totalHours); + } + + public interface AgentHoursStage { + /** + *

Agent hours used

+ */ + TokensInStage agentHours(float agentHours); + } + + public interface TokensInStage { + /** + *

Number of input tokens

+ */ + TokensOutStage tokensIn(double tokensIn); + } + + public interface TokensOutStage { + /** + *

Number of output tokens

+ */ + TtsCharactersStage tokensOut(double tokensOut); + } + + public interface TtsCharactersStage { + /** + *

Number of text-to-speech characters processed

+ */ + RequestsStage ttsCharacters(double ttsCharacters); + } + + public interface RequestsStage { + /** + *

Number of requests

+ */ + GroupingStage requests(double requests); + } + + public interface GroupingStage { + _FinalStage grouping(@NotNull UsageBreakdownV1ResponseResultsItemGrouping grouping); + } + + public interface _FinalStage { + UsageBreakdownV1ResponseResultsItem build(); + + _FinalStage additionalProperty(String key, Object value); + + _FinalStage additionalProperties(Map additionalProperties); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements HoursStage, + TotalHoursStage, + AgentHoursStage, + TokensInStage, + TokensOutStage, + TtsCharactersStage, + RequestsStage, + GroupingStage, + _FinalStage { + private float hours; + + private float totalHours; + + private float agentHours; + + private double tokensIn; + + private double tokensOut; + + private double ttsCharacters; + + private double requests; + + private UsageBreakdownV1ResponseResultsItemGrouping grouping; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UsageBreakdownV1ResponseResultsItem other) { + hours(other.getHours()); + totalHours(other.getTotalHours()); + agentHours(other.getAgentHours()); + tokensIn(other.getTokensIn()); + tokensOut(other.getTokensOut()); + ttsCharacters(other.getTtsCharacters()); + requests(other.getRequests()); + grouping(other.getGrouping()); + return this; + } + + /** + *

Audio hours processed

+ *

Audio hours processed

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

Total hours including all processing

+ *

Total hours including all processing

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

Agent hours used

+ *

Agent hours used

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

Number of input tokens

+ *

Number of input tokens

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

Number of output tokens

+ *

Number of output tokens

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

Number of text-to-speech characters processed

+ *

Number of text-to-speech characters processed

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

Number of requests

+ *

Number of requests

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("requests") + public GroupingStage requests(double requests) { + this.requests = requests; + return this; + } + + @java.lang.Override + @JsonSetter("grouping") + public _FinalStage grouping(@NotNull UsageBreakdownV1ResponseResultsItemGrouping grouping) { + this.grouping = Objects.requireNonNull(grouping, "grouping must not be null"); + return this; + } + + @java.lang.Override + public UsageBreakdownV1ResponseResultsItem build() { + return new UsageBreakdownV1ResponseResultsItem( + hours, + totalHours, + agentHours, + tokensIn, + tokensOut, + ttsCharacters, + requests, + grouping, + additionalProperties); + } + + @java.lang.Override + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + @java.lang.Override + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/UsageBreakdownV1ResponseResultsItemGrouping.java b/src/main/java/com/deepgram/types/UsageBreakdownV1ResponseResultsItemGrouping.java new file mode 100644 index 0000000..033058b --- /dev/null +++ b/src/main/java/com/deepgram/types/UsageBreakdownV1ResponseResultsItemGrouping.java @@ -0,0 +1,359 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = UsageBreakdownV1ResponseResultsItemGrouping.Builder.class) +public final class UsageBreakdownV1ResponseResultsItemGrouping { + private final Optional start; + + private final Optional end; + + private final Optional accessor; + + private final Optional endpoint; + + private final Optional featureSet; + + private final Optional>> models; + + private final Optional method; + + private final Optional tags; + + private final Optional deployment; + + private final Map additionalProperties; + + private UsageBreakdownV1ResponseResultsItemGrouping( + Optional start, + Optional end, + Optional accessor, + Optional endpoint, + Optional featureSet, + Optional>> models, + Optional method, + Optional tags, + Optional deployment, + Map additionalProperties) { + this.start = start; + this.end = end; + this.accessor = accessor; + this.endpoint = endpoint; + this.featureSet = featureSet; + this.models = models; + this.method = method; + this.tags = tags; + this.deployment = deployment; + this.additionalProperties = additionalProperties; + } + + /** + * @return Start date for this group + */ + @JsonProperty("start") + public Optional getStart() { + return start; + } + + /** + * @return End date for this group + */ + @JsonProperty("end") + public Optional getEnd() { + return end; + } + + /** + * @return Optional accessor identifier + */ + @JsonProperty("accessor") + public Optional getAccessor() { + return accessor; + } + + /** + * @return Optional endpoint identifier + */ + @JsonProperty("endpoint") + public Optional getEndpoint() { + return endpoint; + } + + /** + * @return Optional feature set identifier + */ + @JsonProperty("feature_set") + public Optional getFeatureSet() { + return featureSet; + } + + @JsonProperty("models") + public Optional>> getModels() { + return models; + } + + /** + * @return Optional method identifier + */ + @JsonProperty("method") + public Optional getMethod() { + return method; + } + + /** + * @return Optional tags + */ + @JsonProperty("tags") + public Optional getTags() { + return tags; + } + + /** + * @return Optional deployment identifier + */ + @JsonProperty("deployment") + public Optional getDeployment() { + return deployment; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UsageBreakdownV1ResponseResultsItemGrouping + && equalTo((UsageBreakdownV1ResponseResultsItemGrouping) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UsageBreakdownV1ResponseResultsItemGrouping other) { + return start.equals(other.start) + && end.equals(other.end) + && accessor.equals(other.accessor) + && endpoint.equals(other.endpoint) + && featureSet.equals(other.featureSet) + && models.equals(other.models) + && method.equals(other.method) + && tags.equals(other.tags) + && deployment.equals(other.deployment); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.start, + this.end, + this.accessor, + this.endpoint, + this.featureSet, + this.models, + this.method, + this.tags, + this.deployment); + } + + @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 start = Optional.empty(); + + private Optional end = Optional.empty(); + + private Optional accessor = Optional.empty(); + + private Optional endpoint = Optional.empty(); + + private Optional featureSet = Optional.empty(); + + private Optional>> models = Optional.empty(); + + private Optional method = Optional.empty(); + + private Optional tags = Optional.empty(); + + private Optional deployment = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UsageBreakdownV1ResponseResultsItemGrouping other) { + start(other.getStart()); + end(other.getEnd()); + accessor(other.getAccessor()); + endpoint(other.getEndpoint()); + featureSet(other.getFeatureSet()); + models(other.getModels()); + method(other.getMethod()); + tags(other.getTags()); + deployment(other.getDeployment()); + return this; + } + + /** + *

Start date for this group

+ */ + @JsonSetter(value = "start", nulls = Nulls.SKIP) + public Builder start(Optional start) { + this.start = start; + return this; + } + + public Builder start(String start) { + this.start = Optional.ofNullable(start); + return this; + } + + /** + *

End date for this group

+ */ + @JsonSetter(value = "end", nulls = Nulls.SKIP) + public Builder end(Optional end) { + this.end = end; + return this; + } + + public Builder end(String end) { + this.end = Optional.ofNullable(end); + return this; + } + + /** + *

Optional accessor identifier

+ */ + @JsonSetter(value = "accessor", nulls = Nulls.SKIP) + public Builder accessor(Optional accessor) { + this.accessor = accessor; + return this; + } + + public Builder accessor(String accessor) { + this.accessor = Optional.ofNullable(accessor); + return this; + } + + /** + *

Optional endpoint identifier

+ */ + @JsonSetter(value = "endpoint", nulls = Nulls.SKIP) + public Builder endpoint(Optional endpoint) { + this.endpoint = endpoint; + return this; + } + + public Builder endpoint(String endpoint) { + this.endpoint = Optional.ofNullable(endpoint); + return this; + } + + /** + *

Optional feature set identifier

+ */ + @JsonSetter(value = "feature_set", nulls = Nulls.SKIP) + public Builder featureSet(Optional featureSet) { + this.featureSet = featureSet; + return this; + } + + public Builder featureSet(String featureSet) { + this.featureSet = Optional.ofNullable(featureSet); + return this; + } + + @JsonSetter(value = "models", nulls = Nulls.SKIP) + public Builder models(Optional>> models) { + this.models = models; + return this; + } + + public Builder models(List> models) { + this.models = Optional.ofNullable(models); + return this; + } + + /** + *

Optional method identifier

+ */ + @JsonSetter(value = "method", nulls = Nulls.SKIP) + public Builder method(Optional method) { + this.method = method; + return this; + } + + public Builder method(String method) { + this.method = Optional.ofNullable(method); + return this; + } + + /** + *

Optional tags

+ */ + @JsonSetter(value = "tags", nulls = Nulls.SKIP) + public Builder tags(Optional tags) { + this.tags = tags; + return this; + } + + public Builder tags(String tags) { + this.tags = Optional.ofNullable(tags); + return this; + } + + /** + *

Optional deployment identifier

+ */ + @JsonSetter(value = "deployment", nulls = Nulls.SKIP) + public Builder deployment(Optional deployment) { + this.deployment = deployment; + return this; + } + + public Builder deployment(String deployment) { + this.deployment = Optional.ofNullable(deployment); + return this; + } + + public UsageBreakdownV1ResponseResultsItemGrouping build() { + return new UsageBreakdownV1ResponseResultsItemGrouping( + start, end, accessor, endpoint, featureSet, models, method, tags, deployment, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/UsageFieldsV1Response.java b/src/main/java/com/deepgram/types/UsageFieldsV1Response.java new file mode 100644 index 0000000..f81f2f5 --- /dev/null +++ b/src/main/java/com/deepgram/types/UsageFieldsV1Response.java @@ -0,0 +1,204 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 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 = UsageFieldsV1Response.Builder.class) +public final class UsageFieldsV1Response { + private final Optional> tags; + + private final Optional> models; + + private final Optional> processingMethods; + + private final Optional> features; + + private final Map additionalProperties; + + private UsageFieldsV1Response( + Optional> tags, + Optional> models, + Optional> processingMethods, + Optional> features, + Map additionalProperties) { + this.tags = tags; + this.models = models; + this.processingMethods = processingMethods; + this.features = features; + this.additionalProperties = additionalProperties; + } + + /** + * @return List of tags associated with the project + */ + @JsonProperty("tags") + public Optional> getTags() { + return tags; + } + + /** + * @return List of models available for the project. + */ + @JsonProperty("models") + public Optional> getModels() { + return models; + } + + /** + * @return Processing methods supported by the API + */ + @JsonProperty("processing_methods") + public Optional> getProcessingMethods() { + return processingMethods; + } + + /** + * @return API features available to the project + */ + @JsonProperty("features") + public Optional> getFeatures() { + return features; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UsageFieldsV1Response && equalTo((UsageFieldsV1Response) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UsageFieldsV1Response other) { + return tags.equals(other.tags) + && models.equals(other.models) + && processingMethods.equals(other.processingMethods) + && features.equals(other.features); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.tags, this.models, this.processingMethods, this.features); + } + + @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> tags = Optional.empty(); + + private Optional> models = Optional.empty(); + + private Optional> processingMethods = Optional.empty(); + + private Optional> features = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UsageFieldsV1Response other) { + tags(other.getTags()); + models(other.getModels()); + processingMethods(other.getProcessingMethods()); + features(other.getFeatures()); + return this; + } + + /** + *

List of tags associated with the project

+ */ + @JsonSetter(value = "tags", nulls = Nulls.SKIP) + public Builder tags(Optional> tags) { + this.tags = tags; + return this; + } + + public Builder tags(List tags) { + this.tags = Optional.ofNullable(tags); + return this; + } + + /** + *

List of models available for the project.

+ */ + @JsonSetter(value = "models", nulls = Nulls.SKIP) + public Builder models(Optional> models) { + this.models = models; + return this; + } + + public Builder models(List models) { + this.models = Optional.ofNullable(models); + return this; + } + + /** + *

Processing methods supported by the API

+ */ + @JsonSetter(value = "processing_methods", nulls = Nulls.SKIP) + public Builder processingMethods(Optional> processingMethods) { + this.processingMethods = processingMethods; + return this; + } + + public Builder processingMethods(List processingMethods) { + this.processingMethods = Optional.ofNullable(processingMethods); + return this; + } + + /** + *

API features available to the project

+ */ + @JsonSetter(value = "features", nulls = Nulls.SKIP) + public Builder features(Optional> features) { + this.features = features; + return this; + } + + public Builder features(List features) { + this.features = Optional.ofNullable(features); + return this; + } + + public UsageFieldsV1Response build() { + return new UsageFieldsV1Response(tags, models, processingMethods, features, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/UsageFieldsV1ResponseModelsItem.java b/src/main/java/com/deepgram/types/UsageFieldsV1ResponseModelsItem.java new file mode 100644 index 0000000..eb59624 --- /dev/null +++ b/src/main/java/com/deepgram/types/UsageFieldsV1ResponseModelsItem.java @@ -0,0 +1,203 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UsageFieldsV1ResponseModelsItem.Builder.class) +public final class UsageFieldsV1ResponseModelsItem { + private final Optional name; + + private final Optional language; + + private final Optional version; + + private final Optional modelId; + + private final Map additionalProperties; + + private UsageFieldsV1ResponseModelsItem( + Optional name, + Optional language, + Optional version, + Optional modelId, + Map additionalProperties) { + this.name = name; + this.language = language; + this.version = version; + this.modelId = modelId; + this.additionalProperties = additionalProperties; + } + + /** + * @return Name of the model. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return The language supported by the model (IETF language tag). + */ + @JsonProperty("language") + public Optional getLanguage() { + return language; + } + + /** + * @return Version identifier of the model, typically with a date and a revision number. + */ + @JsonProperty("version") + public Optional getVersion() { + return version; + } + + /** + * @return Unique identifier for the model. + */ + @JsonProperty("model_id") + public Optional getModelId() { + return modelId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UsageFieldsV1ResponseModelsItem && equalTo((UsageFieldsV1ResponseModelsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UsageFieldsV1ResponseModelsItem other) { + return name.equals(other.name) + && language.equals(other.language) + && version.equals(other.version) + && modelId.equals(other.modelId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.name, this.language, this.version, this.modelId); + } + + @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 language = Optional.empty(); + + private Optional version = Optional.empty(); + + private Optional modelId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UsageFieldsV1ResponseModelsItem other) { + name(other.getName()); + language(other.getLanguage()); + version(other.getVersion()); + modelId(other.getModelId()); + return this; + } + + /** + *

Name of the model.

+ */ + @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; + } + + /** + *

The language supported by the model (IETF language tag).

+ */ + @JsonSetter(value = "language", nulls = Nulls.SKIP) + public Builder language(Optional language) { + this.language = language; + return this; + } + + public Builder language(String language) { + this.language = Optional.ofNullable(language); + return this; + } + + /** + *

Version identifier of the model, typically with a date and a revision number.

+ */ + @JsonSetter(value = "version", nulls = Nulls.SKIP) + public Builder version(Optional version) { + this.version = version; + return this; + } + + public Builder version(String version) { + this.version = Optional.ofNullable(version); + return this; + } + + /** + *

Unique identifier for the model.

+ */ + @JsonSetter(value = "model_id", nulls = Nulls.SKIP) + public Builder modelId(Optional modelId) { + this.modelId = modelId; + return this; + } + + public Builder modelId(String modelId) { + this.modelId = Optional.ofNullable(modelId); + return this; + } + + public UsageFieldsV1ResponseModelsItem build() { + return new UsageFieldsV1ResponseModelsItem(name, language, version, modelId, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/UsageV1Response.java b/src/main/java/com/deepgram/types/UsageV1Response.java new file mode 100644 index 0000000..fa9f08c --- /dev/null +++ b/src/main/java/com/deepgram/types/UsageV1Response.java @@ -0,0 +1,153 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UsageV1Response.Builder.class) +public final class UsageV1Response { + private final Optional start; + + private final Optional end; + + private final Optional resolution; + + private final Map additionalProperties; + + private UsageV1Response( + Optional start, + Optional end, + Optional resolution, + Map additionalProperties) { + this.start = start; + this.end = end; + this.resolution = resolution; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("start") + public Optional getStart() { + return start; + } + + @JsonProperty("end") + public Optional getEnd() { + return end; + } + + @JsonProperty("resolution") + public Optional getResolution() { + return resolution; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UsageV1Response && equalTo((UsageV1Response) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UsageV1Response other) { + return start.equals(other.start) && end.equals(other.end) && resolution.equals(other.resolution); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.start, this.end, this.resolution); + } + + @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 start = Optional.empty(); + + private Optional end = Optional.empty(); + + private Optional resolution = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UsageV1Response other) { + start(other.getStart()); + end(other.getEnd()); + resolution(other.getResolution()); + return this; + } + + @JsonSetter(value = "start", nulls = Nulls.SKIP) + public Builder start(Optional start) { + this.start = start; + return this; + } + + public Builder start(String 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(String end) { + this.end = Optional.ofNullable(end); + return this; + } + + @JsonSetter(value = "resolution", nulls = Nulls.SKIP) + public Builder resolution(Optional resolution) { + this.resolution = resolution; + return this; + } + + public Builder resolution(UsageV1ResponseResolution resolution) { + this.resolution = Optional.ofNullable(resolution); + return this; + } + + public UsageV1Response build() { + return new UsageV1Response(start, end, resolution, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/com/deepgram/types/UsageV1ResponseResolution.java b/src/main/java/com/deepgram/types/UsageV1ResponseResolution.java new file mode 100644 index 0000000..816aca8 --- /dev/null +++ b/src/main/java/com/deepgram/types/UsageV1ResponseResolution.java @@ -0,0 +1,128 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.deepgram.types; + +import com.deepgram.core.ObjectMappers; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.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 java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UsageV1ResponseResolution.Builder.class) +public final class UsageV1ResponseResolution { + private final Optional units; + + private final Optional amount; + + private final Map additionalProperties; + + private UsageV1ResponseResolution( + Optional units, Optional amount, Map additionalProperties) { + this.units = units; + this.amount = amount; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("units") + public Optional getUnits() { + return units; + } + + @JsonProperty("amount") + public Optional getAmount() { + return amount; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UsageV1ResponseResolution && equalTo((UsageV1ResponseResolution) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UsageV1ResponseResolution other) { + return units.equals(other.units) && amount.equals(other.amount); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.units, this.amount); + } + + @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 units = Optional.empty(); + + private Optional amount = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UsageV1ResponseResolution other) { + units(other.getUnits()); + amount(other.getAmount()); + return this; + } + + @JsonSetter(value = "units", nulls = Nulls.SKIP) + public Builder units(Optional units) { + this.units = units; + return this; + } + + public Builder units(String units) { + this.units = Optional.ofNullable(units); + return this; + } + + @JsonSetter(value = "amount", nulls = Nulls.SKIP) + public Builder amount(Optional amount) { + this.amount = amount; + return this; + } + + public Builder amount(Double amount) { + this.amount = Optional.ofNullable(amount); + return this; + } + + public UsageV1ResponseResolution build() { + return new UsageV1ResponseResolution(units, amount, additionalProperties); + } + + public Builder additionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + return this; + } + + public Builder additionalProperties(Map additionalProperties) { + this.additionalProperties.putAll(additionalProperties); + return this; + } + } +} diff --git a/src/main/java/core/ClientOptions.java b/src/main/java/core/ClientOptions.java deleted file mode 100644 index 7084fd1..0000000 --- a/src/main/java/core/ClientOptions.java +++ /dev/null @@ -1,231 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package core; - -import java.util.HashMap; -import java.util.Map; -import java.util.Optional; -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 final int timeout; - - private final int maxRetries; - - private final Optional webSocketFactory; - - private final Optional logging; - - private ClientOptions( - Environment environment, - Map headers, - Map> headerSuppliers, - OkHttpClient httpClient, - int timeout, - int maxRetries, - Optional webSocketFactory, - Optional logging) { - this.environment = environment; - this.headers = new HashMap<>(); - this.headers.putAll(headers); - this.headers.putAll( - new HashMap() { - { - put("X-Fern-Language", "JAVA"); - } - }); - this.headerSuppliers = headerSuppliers; - this.httpClient = httpClient; - this.timeout = timeout; - this.maxRetries = maxRetries; - this.webSocketFactory = webSocketFactory; - this.logging = logging; - } - - 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 int timeout(RequestOptions requestOptions) { - if (requestOptions == null) { - return this.timeout; - } - return requestOptions.getTimeout().orElse(this.timeout); - } - - 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 int maxRetries() { - return this.maxRetries; - } - - public Optional webSocketFactory() { - return this.webSocketFactory; - } - - public Optional logging() { - return this.logging; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private Environment environment; - - private final Map headers = new HashMap<>(); - - private final Map> headerSuppliers = new HashMap<>(); - - private int maxRetries = 2; - - private Optional timeout = Optional.empty(); - - private OkHttpClient httpClient = null; - - private Optional logging = Optional.empty(); - - private Optional webSocketFactory = Optional.empty(); - - 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; - } - - /** Override the timeout in seconds. Defaults to 60 seconds. */ - public Builder timeout(int timeout) { - this.timeout = Optional.of(timeout); - return this; - } - - /** Override the timeout in seconds. Defaults to 60 seconds. */ - public Builder timeout(Optional timeout) { - this.timeout = timeout; - return this; - } - - /** Override the maximum number of retries. Defaults to 2 retries. */ - public Builder maxRetries(int maxRetries) { - this.maxRetries = maxRetries; - return this; - } - - public Builder httpClient(OkHttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /** Set a custom WebSocketFactory for creating WebSocket connections. */ - public Builder webSocketFactory(WebSocketFactory webSocketFactory) { - this.webSocketFactory = Optional.of(webSocketFactory); - return this; - } - - /** - * Configure logging for the SDK. Silent by default — no log output unless explicitly - * configured. - */ - public Builder logging(LogConfig logging) { - this.logging = Optional.of(logging); - return this; - } - - public ClientOptions build() { - OkHttpClient.Builder httpClientBuilder = - this.httpClient != null ? this.httpClient.newBuilder() : new OkHttpClient.Builder(); - - if (this.httpClient != null) { - timeout.ifPresent( - timeout -> - httpClientBuilder - .callTimeout(timeout, TimeUnit.SECONDS) - .connectTimeout(0, TimeUnit.SECONDS) - .writeTimeout(0, TimeUnit.SECONDS) - .readTimeout(0, TimeUnit.SECONDS)); - } else { - httpClientBuilder - .callTimeout(this.timeout.orElse(60), TimeUnit.SECONDS) - .connectTimeout(0, TimeUnit.SECONDS) - .writeTimeout(0, TimeUnit.SECONDS) - .readTimeout(0, TimeUnit.SECONDS) - .addInterceptor(new RetryInterceptor(this.maxRetries)); - } - - Logger logger = Logger.from(this.logging); - httpClientBuilder.addInterceptor(new LoggingInterceptor(logger)); - - this.httpClient = httpClientBuilder.build(); - this.timeout = Optional.of(httpClient.callTimeoutMillis() / 1000); - - return new ClientOptions( - environment, - headers, - headerSuppliers, - httpClient, - this.timeout.get(), - this.maxRetries, - this.webSocketFactory, - this.logging); - } - - /** Create a new Builder initialized with values from an existing ClientOptions */ - public static Builder from(ClientOptions clientOptions) { - Builder builder = new Builder(); - builder.environment = clientOptions.environment(); - builder.timeout = Optional.of(clientOptions.timeout(null)); - builder.httpClient = clientOptions.httpClient(); - builder.headers.putAll(clientOptions.headers); - builder.headerSuppliers.putAll(clientOptions.headerSuppliers); - builder.maxRetries = clientOptions.maxRetries(); - builder.logging = clientOptions.logging(); - return builder; - } - } -} diff --git a/src/main/java/core/ConsoleLogger.java b/src/main/java/core/ConsoleLogger.java deleted file mode 100644 index 571160d..0000000 --- a/src/main/java/core/ConsoleLogger.java +++ /dev/null @@ -1,50 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package core; - -import java.util.logging.Level; - -/** - * Default logger implementation that writes to the console using {@link java.util.logging.Logger}. - * - *

Uses the "fern" logger name with a simple format of "LEVEL - message". - */ -public final class ConsoleLogger implements ILogger { - - private static final java.util.logging.Logger logger = java.util.logging.Logger.getLogger("fern"); - - static { - if (logger.getHandlers().length == 0) { - java.util.logging.ConsoleHandler handler = new java.util.logging.ConsoleHandler(); - handler.setFormatter( - new java.util.logging.SimpleFormatter() { - @Override - public String format(java.util.logging.LogRecord record) { - return record.getLevel() + " - " + record.getMessage() + System.lineSeparator(); - } - }); - logger.addHandler(handler); - logger.setUseParentHandlers(false); - logger.setLevel(Level.ALL); - } - } - - @Override - public void debug(String message) { - logger.log(Level.FINE, message); - } - - @Override - public void info(String message) { - logger.log(Level.INFO, message); - } - - @Override - public void warn(String message) { - logger.log(Level.WARNING, message); - } - - @Override - public void error(String message) { - logger.log(Level.SEVERE, message); - } -} diff --git a/src/main/java/core/DateTimeDeserializer.java b/src/main/java/core/DateTimeDeserializer.java deleted file mode 100644 index b57e807..0000000 --- a/src/main/java/core/DateTimeDeserializer.java +++ /dev/null @@ -1,56 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package 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/core/DeepgramApiApiException.java b/src/main/java/core/DeepgramApiApiException.java deleted file mode 100644 index 8c30175..0000000 --- a/src/main/java/core/DeepgramApiApiException.java +++ /dev/null @@ -1,75 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package core; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import okhttp3.Response; - -/** This exception type will be thrown for any non-2XX API responses. */ -public class DeepgramApiApiException extends DeepgramApiException { - /** 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; - - private final Map> headers; - - public DeepgramApiApiException(String message, int statusCode, Object body) { - super(message); - this.statusCode = statusCode; - this.body = body; - this.headers = new HashMap<>(); - } - - public DeepgramApiApiException( - String message, int statusCode, Object body, Response rawResponse) { - super(message); - this.statusCode = statusCode; - this.body = body; - this.headers = new HashMap<>(); - rawResponse - .headers() - .forEach( - header -> { - String key = header.component1(); - String value = header.component2(); - this.headers.computeIfAbsent(key, _str -> new ArrayList<>()).add(value); - }); - } - - /** - * @return the statusCode - */ - public int statusCode() { - return this.statusCode; - } - - /** - * @return the body - */ - public Object body() { - return this.body; - } - - /** - * @return the headers - */ - public Map> headers() { - return this.headers; - } - - @Override - public String toString() { - return "DeepgramApiApiException{" - + "message: " - + getMessage() - + ", statusCode: " - + statusCode - + ", body: " - + ObjectMappers.stringify(body) - + "}"; - } -} diff --git a/src/main/java/core/DeepgramApiException.java b/src/main/java/core/DeepgramApiException.java deleted file mode 100644 index 2a4ec9a..0000000 --- a/src/main/java/core/DeepgramApiException.java +++ /dev/null @@ -1,13 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package core; - -/** This class serves as the base exception for all errors in the SDK. */ -public class DeepgramApiException extends RuntimeException { - public DeepgramApiException(String message) { - super(message); - } - - public DeepgramApiException(String message, Exception e) { - super(message, e); - } -} diff --git a/src/main/java/core/DeepgramApiHttpResponse.java b/src/main/java/core/DeepgramApiHttpResponse.java deleted file mode 100644 index 25e1014..0000000 --- a/src/main/java/core/DeepgramApiHttpResponse.java +++ /dev/null @@ -1,38 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package core; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import okhttp3.Response; - -public final class DeepgramApiHttpResponse { - - private final T body; - - private final Map> headers; - - public DeepgramApiHttpResponse(T body, Response rawResponse) { - this.body = body; - - Map> headers = new HashMap<>(); - rawResponse - .headers() - .forEach( - header -> { - String key = header.component1(); - String value = header.component2(); - headers.computeIfAbsent(key, _str -> new ArrayList<>()).add(value); - }); - this.headers = headers; - } - - public T body() { - return this.body; - } - - public Map> headers() { - return headers; - } -} diff --git a/src/main/java/core/DisconnectReason.java b/src/main/java/core/DisconnectReason.java deleted file mode 100644 index 7d8c600..0000000 --- a/src/main/java/core/DisconnectReason.java +++ /dev/null @@ -1,22 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package core; - -/** Reason for WebSocket disconnection. */ -public class DisconnectReason { - private final int code; - - private final String reason; - - public DisconnectReason(int code, String reason) { - this.code = code; - this.reason = reason; - } - - public int getCode() { - return code; - } - - public String getReason() { - return reason; - } -} diff --git a/src/main/java/core/DoubleSerializer.java b/src/main/java/core/DoubleSerializer.java deleted file mode 100644 index 9734690..0000000 --- a/src/main/java/core/DoubleSerializer.java +++ /dev/null @@ -1,46 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package core; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.databind.JsonSerializer; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.module.SimpleModule; -import java.io.IOException; - -/** - * Custom serializer that writes integer-valued doubles without a decimal point. For example, {@code - * 24000.0} is serialized as {@code 24000} instead of {@code 24000.0}. Non-integer values like - * {@code 3.14} are serialized normally. - */ -class DoubleSerializer extends JsonSerializer { - private static final SimpleModule MODULE; - - static { - MODULE = - new SimpleModule() - .addSerializer(Double.class, new DoubleSerializer()) - .addSerializer(double.class, new DoubleSerializer()); - } - - /** - * Gets a module wrapping this serializer 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 void serialize(Double value, JsonGenerator gen, SerializerProvider serializers) - throws IOException { - if (value != null - && value == Math.floor(value) - && !Double.isInfinite(value) - && !Double.isNaN(value)) { - gen.writeNumber(value.longValue()); - } else { - gen.writeNumber(value); - } - } -} diff --git a/src/main/java/core/Environment.java b/src/main/java/core/Environment.java deleted file mode 100644 index 5e51258..0000000 --- a/src/main/java/core/Environment.java +++ /dev/null @@ -1,67 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package core; - -public final class Environment { - public static final Environment PRODUCTION = - new Environment( - "https://api.deepgram.com", "wss://agent.deepgram.com", "wss://api.deepgram.com"); - - public static final Environment AGENT = - new Environment( - "https://agent.deepgram.com", "wss://agent.deepgram.com", "wss://api.deepgram.com"); - - private final String base; - - private final String agent; - - private final String production; - - Environment(String base, String agent, String production) { - this.base = base; - this.agent = agent; - this.production = production; - } - - public String getBaseURL() { - return this.base; - } - - public String getAgentURL() { - return this.agent; - } - - public String getProductionURL() { - return this.production; - } - - public static Builder custom() { - return new Builder(); - } - - public static class Builder { - private String base; - - private String agent; - - private String production; - - public Builder base(String base) { - this.base = base; - return this; - } - - public Builder agent(String agent) { - this.agent = agent; - return this; - } - - public Builder production(String production) { - this.production = production; - return this; - } - - public Environment build() { - return new Environment(base, agent, production); - } - } -} diff --git a/src/main/java/core/FileStream.java b/src/main/java/core/FileStream.java deleted file mode 100644 index e09d138..0000000 --- a/src/main/java/core/FileStream.java +++ /dev/null @@ -1,57 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package 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/core/ILogger.java b/src/main/java/core/ILogger.java deleted file mode 100644 index 4e1c3e5..0000000 --- a/src/main/java/core/ILogger.java +++ /dev/null @@ -1,37 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package core; - -/** - * Interface for custom logger implementations. - * - *

Implement this interface to provide a custom logging backend for the SDK. The SDK will call - * the appropriate method based on the log level. - * - *

Example: - * - *

{@code
- * public class MyCustomLogger implements ILogger {
- *     public void debug(String message) {
- *         System.out.println("[DBG] " + message);
- *     }
- *     public void info(String message) {
- *         System.out.println("[INF] " + message);
- *     }
- *     public void warn(String message) {
- *         System.out.println("[WRN] " + message);
- *     }
- *     public void error(String message) {
- *         System.out.println("[ERR] " + message);
- *     }
- * }
- * }
- */ -public interface ILogger { - void debug(String message); - - void info(String message); - - void warn(String message); - - void error(String message); -} diff --git a/src/main/java/core/InputStreamRequestBody.java b/src/main/java/core/InputStreamRequestBody.java deleted file mode 100644 index 251f908..0000000 --- a/src/main/java/core/InputStreamRequestBody.java +++ /dev/null @@ -1,72 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package core; - -import java.io.IOException; -import java.io.InputStream; -import java.util.Objects; -import okhttp3.MediaType; -import okhttp3.RequestBody; -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 { - try (Source source = Okio.source(inputStream)) { - sink.writeAll(source); - } - } -} diff --git a/src/main/java/core/LogConfig.java b/src/main/java/core/LogConfig.java deleted file mode 100644 index 1c821eb..0000000 --- a/src/main/java/core/LogConfig.java +++ /dev/null @@ -1,97 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package core; - -/** - * Configuration for SDK logging. - * - *

Use the builder to configure logging behavior: - * - *

{@code
- * LogConfig config = LogConfig.builder()
- *     .level(LogLevel.DEBUG)
- *     .silent(false)
- *     .build();
- * }
- * - *

Or with a custom logger: - * - *

{@code
- * LogConfig config = LogConfig.builder()
- *     .level(LogLevel.DEBUG)
- *     .logger(new MyCustomLogger())
- *     .silent(false)
- *     .build();
- * }
- * - *

Defaults: - * - *

    - *
  • {@code level} — {@link LogLevel#INFO} - *
  • {@code logger} — {@link ConsoleLogger} (writes to stderr via java.util.logging) - *
  • {@code silent} — {@code true} (no output unless explicitly enabled) - *
- */ -public final class LogConfig { - - private final LogLevel level; - private final ILogger logger; - private final boolean silent; - - private LogConfig(LogLevel level, ILogger logger, boolean silent) { - this.level = level; - this.logger = logger; - this.silent = silent; - } - - public LogLevel level() { - return level; - } - - public ILogger logger() { - return logger; - } - - public boolean silent() { - return silent; - } - - public static Builder builder() { - return new Builder(); - } - - public static final class Builder { - private LogLevel level = LogLevel.INFO; - private ILogger logger = new ConsoleLogger(); - private boolean silent = true; - - private Builder() {} - - /** - * Set the minimum log level. Only messages at this level or above will be logged. Defaults to - * {@link LogLevel#INFO}. - */ - public Builder level(LogLevel level) { - this.level = level; - return this; - } - - /** Set a custom logger implementation. Defaults to {@link ConsoleLogger}. */ - public Builder logger(ILogger logger) { - this.logger = logger; - return this; - } - - /** - * Set whether logging is silent (disabled). Defaults to {@code true}. Set to {@code false} to - * enable log output. - */ - public Builder silent(boolean silent) { - this.silent = silent; - return this; - } - - public LogConfig build() { - return new LogConfig(level, logger, silent); - } - } -} diff --git a/src/main/java/core/LogLevel.java b/src/main/java/core/LogLevel.java deleted file mode 100644 index 698b448..0000000 --- a/src/main/java/core/LogLevel.java +++ /dev/null @@ -1,34 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package core; - -/** - * Log levels for SDK logging configuration. Silent by default — no log output unless explicitly - * configured. - */ -public enum LogLevel { - DEBUG(1), - INFO(2), - WARN(3), - ERROR(4); - - private final int value; - - LogLevel(int value) { - this.value = value; - } - - public int getValue() { - return value; - } - - /** - * Parse a log level from a string (case-insensitive). - * - * @param level the level string (debug, info, warn, error) - * @return the corresponding LogLevel - * @throws IllegalArgumentException if the string does not match any level - */ - public static LogLevel fromString(String level) { - return LogLevel.valueOf(level.toUpperCase()); - } -} diff --git a/src/main/java/core/Logger.java b/src/main/java/core/Logger.java deleted file mode 100644 index db9cf7e..0000000 --- a/src/main/java/core/Logger.java +++ /dev/null @@ -1,96 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package core; - -/** - * SDK logger that filters messages based on level and silent mode. - * - *

Silent by default — no log output unless explicitly configured. Create via {@link LogConfig} - * or directly: - * - *

{@code
- * Logger logger = new Logger(LogLevel.DEBUG, new ConsoleLogger(), false);
- * logger.debug("request sent");
- * }
- */ -public final class Logger { - - private static final Logger DEFAULT = new Logger(LogLevel.INFO, new ConsoleLogger(), true); - - private final LogLevel level; - private final ILogger logger; - private final boolean silent; - - public Logger(LogLevel level, ILogger logger, boolean silent) { - this.level = level; - this.logger = logger; - this.silent = silent; - } - - /** Returns a default silent logger (no output). */ - public static Logger getDefault() { - return DEFAULT; - } - - /** - * Creates a Logger from a {@link LogConfig}. If config is {@code null}, returns the default - * silent logger. - */ - public static Logger from(LogConfig config) { - if (config == null) { - return DEFAULT; - } - return new Logger(config.level(), config.logger(), config.silent()); - } - - /** - * Creates a Logger from an {@code Optional}. If empty, returns the default silent - * logger. - */ - public static Logger from(java.util.Optional config) { - return config.map(Logger::from).orElse(DEFAULT); - } - - private boolean shouldLog(LogLevel messageLevel) { - return !silent && level.getValue() <= messageLevel.getValue(); - } - - public boolean isDebug() { - return shouldLog(LogLevel.DEBUG); - } - - public boolean isInfo() { - return shouldLog(LogLevel.INFO); - } - - public boolean isWarn() { - return shouldLog(LogLevel.WARN); - } - - public boolean isError() { - return shouldLog(LogLevel.ERROR); - } - - public void debug(String message) { - if (isDebug()) { - logger.debug(message); - } - } - - public void info(String message) { - if (isInfo()) { - logger.info(message); - } - } - - public void warn(String message) { - if (isWarn()) { - logger.warn(message); - } - } - - public void error(String message) { - if (isError()) { - logger.error(message); - } - } -} diff --git a/src/main/java/core/LoggingInterceptor.java b/src/main/java/core/LoggingInterceptor.java deleted file mode 100644 index 7e1d6f8..0000000 --- a/src/main/java/core/LoggingInterceptor.java +++ /dev/null @@ -1,103 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package core; - -import java.io.IOException; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; -import okhttp3.Interceptor; -import okhttp3.Request; -import okhttp3.Response; - -/** - * OkHttp interceptor that logs HTTP requests and responses. - * - *

Logs request method, URL, and headers (with sensitive values redacted) at debug level. Logs - * response status at debug level, and 4xx/5xx responses at error level. Does nothing if the logger - * is silent. - */ -public final class LoggingInterceptor implements Interceptor { - - private static final Set SENSITIVE_HEADERS = - new HashSet<>( - Arrays.asList( - "authorization", - "www-authenticate", - "x-api-key", - "api-key", - "apikey", - "x-api-token", - "x-auth-token", - "auth-token", - "proxy-authenticate", - "proxy-authorization", - "cookie", - "set-cookie", - "x-csrf-token", - "x-xsrf-token", - "x-session-token", - "x-access-token")); - - private final Logger logger; - - public LoggingInterceptor(Logger logger) { - this.logger = logger; - } - - @Override - public Response intercept(Chain chain) throws IOException { - Request request = chain.request(); - - if (logger.isDebug()) { - StringBuilder sb = new StringBuilder(); - sb.append("HTTP Request: ").append(request.method()).append(" ").append(request.url()); - sb.append(" headers={"); - boolean first = true; - for (String name : request.headers().names()) { - if (!first) { - sb.append(", "); - } - sb.append(name).append("="); - if (SENSITIVE_HEADERS.contains(name.toLowerCase())) { - sb.append("[REDACTED]"); - } else { - sb.append(request.header(name)); - } - first = false; - } - sb.append("}"); - sb.append(" has_body=").append(request.body() != null); - logger.debug(sb.toString()); - } - - Response response = chain.proceed(request); - - if (logger.isDebug()) { - StringBuilder sb = new StringBuilder(); - sb.append("HTTP Response: status=").append(response.code()); - sb.append(" url=").append(response.request().url()); - sb.append(" headers={"); - boolean first = true; - for (String name : response.headers().names()) { - if (!first) { - sb.append(", "); - } - sb.append(name).append("="); - if (SENSITIVE_HEADERS.contains(name.toLowerCase())) { - sb.append("[REDACTED]"); - } else { - sb.append(response.header(name)); - } - first = false; - } - sb.append("}"); - logger.debug(sb.toString()); - } - - if (response.code() >= 400 && logger.isError()) { - logger.error("HTTP Error: status=" + response.code() + " url=" + response.request().url()); - } - - return response; - } -} diff --git a/src/main/java/core/MediaTypes.java b/src/main/java/core/MediaTypes.java deleted file mode 100644 index 04d8f8e..0000000 --- a/src/main/java/core/MediaTypes.java +++ /dev/null @@ -1,11 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package 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/core/Nullable.java b/src/main/java/core/Nullable.java deleted file mode 100644 index dd59588..0000000 --- a/src/main/java/core/Nullable.java +++ /dev/null @@ -1,138 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package core; - -import java.util.Optional; -import java.util.function.Function; - -public final class Nullable { - - private final Either, Null> value; - - private Nullable() { - this.value = Either.left(Optional.empty()); - } - - private Nullable(T value) { - if (value == null) { - this.value = Either.right(Null.INSTANCE); - } else { - this.value = Either.left(Optional.of(value)); - } - } - - public static Nullable ofNull() { - return new Nullable<>(null); - } - - public static Nullable of(T value) { - return new Nullable<>(value); - } - - public static Nullable empty() { - return new Nullable<>(); - } - - public static Nullable ofOptional(Optional value) { - if (value.isPresent()) { - return of(value.get()); - } else { - return empty(); - } - } - - public boolean isNull() { - return this.value.isRight(); - } - - public boolean isEmpty() { - return this.value.isLeft() && !this.value.getLeft().isPresent(); - } - - public T get() { - if (this.isNull()) { - return null; - } - - return this.value.getLeft().get(); - } - - public Nullable map(Function mapper) { - if (this.isNull()) { - return Nullable.ofNull(); - } - - return Nullable.ofOptional(this.value.getLeft().map(mapper)); - } - - @Override - public boolean equals(Object other) { - if (!(other instanceof Nullable)) { - return false; - } - - if (((Nullable) other).isNull() && this.isNull()) { - return true; - } - - return this.value.getLeft().equals(((Nullable) other).value.getLeft()); - } - - private static final class Either { - private L left = null; - private R right = null; - - private Either(L left, R right) { - if (left != null && right != null) { - throw new IllegalArgumentException("Left and right argument cannot both be non-null."); - } - - if (left == null && right == null) { - throw new IllegalArgumentException("Left and right argument cannot both be null."); - } - - if (left != null) { - this.left = left; - } - - if (right != null) { - this.right = right; - } - } - - public static Either left(L left) { - return new Either<>(left, null); - } - - public static Either right(R right) { - return new Either<>(null, right); - } - - public boolean isLeft() { - return this.left != null; - } - - public boolean isRight() { - return this.right != null; - } - - public L getLeft() { - if (!this.isLeft()) { - throw new IllegalArgumentException("Cannot get left from right Either."); - } - return this.left; - } - - public R getRight() { - if (!this.isRight()) { - throw new IllegalArgumentException("Cannot get right from left Either."); - } - return this.right; - } - } - - private static final class Null { - private static final Null INSTANCE = new Null(); - - private Null() {} - } -} diff --git a/src/main/java/core/NullableNonemptyFilter.java b/src/main/java/core/NullableNonemptyFilter.java deleted file mode 100644 index 017ea59..0000000 --- a/src/main/java/core/NullableNonemptyFilter.java +++ /dev/null @@ -1,20 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package core; - -import java.util.Optional; - -public final class NullableNonemptyFilter { - @Override - public boolean equals(Object o) { - boolean isOptionalEmpty = isOptionalEmpty(o); - - return isOptionalEmpty; - } - - private boolean isOptionalEmpty(Object o) { - if (o instanceof Optional) { - return !((Optional) o).isPresent(); - } - return false; - } -} diff --git a/src/main/java/core/ObjectMappers.java b/src/main/java/core/ObjectMappers.java deleted file mode 100644 index 15b52ae..0000000 --- a/src/main/java/core/ObjectMappers.java +++ /dev/null @@ -1,45 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package core; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.core.JsonProcessingException; -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()) - .addModule(DoubleSerializer.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()); - } - } - - public static Object parseErrorBody(String responseBodyString) { - try { - return JSON_MAPPER.readValue(responseBodyString, Object.class); - } catch (JsonProcessingException ignored) { - return responseBodyString; - } - } -} diff --git a/src/main/java/core/OkHttpWebSocketFactory.java b/src/main/java/core/OkHttpWebSocketFactory.java deleted file mode 100644 index cbf03f6..0000000 --- a/src/main/java/core/OkHttpWebSocketFactory.java +++ /dev/null @@ -1,29 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package core; - -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.WebSocket; -import okhttp3.WebSocketListener; - -/** - * Default WebSocketFactory implementation using OkHttpClient. This factory delegates WebSocket - * creation to the provided OkHttpClient instance. - */ -public final class OkHttpWebSocketFactory implements WebSocketFactory { - private final OkHttpClient okHttpClient; - - /** - * Creates a new OkHttpWebSocketFactory with the specified OkHttpClient. - * - * @param okHttpClient The OkHttpClient instance to use for creating WebSockets - */ - public OkHttpWebSocketFactory(OkHttpClient okHttpClient) { - this.okHttpClient = okHttpClient; - } - - @Override - public WebSocket create(Request request, WebSocketListener listener) { - return okHttpClient.newWebSocket(request, listener); - } -} diff --git a/src/main/java/core/QueryStringMapper.java b/src/main/java/core/QueryStringMapper.java deleted file mode 100644 index fcda180..0000000 --- a/src/main/java/core/QueryStringMapper.java +++ /dev/null @@ -1,144 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package core; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.fasterxml.jackson.databind.node.ObjectNode; -import java.util.AbstractMap; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import okhttp3.HttpUrl; -import okhttp3.MultipartBody; - -public class QueryStringMapper { - - private static final ObjectMapper MAPPER = ObjectMappers.JSON_MAPPER; - - public static void addQueryParameter( - HttpUrl.Builder httpUrl, String key, Object value, boolean arraysAsRepeats) { - JsonNode valueNode = MAPPER.valueToTree(value); - - List> flat; - if (valueNode.isObject()) { - flat = flattenObject((ObjectNode) valueNode, arraysAsRepeats); - } else if (valueNode.isArray()) { - flat = flattenArray((ArrayNode) valueNode, "", arraysAsRepeats); - } else { - if (valueNode.isTextual()) { - httpUrl.addQueryParameter(key, valueNode.textValue()); - } else { - httpUrl.addQueryParameter(key, valueNode.toString()); - } - return; - } - - for (Map.Entry field : flat) { - if (field.getValue().isTextual()) { - httpUrl.addQueryParameter(key + field.getKey(), field.getValue().textValue()); - } else { - httpUrl.addQueryParameter(key + field.getKey(), field.getValue().toString()); - } - } - } - - public static void addFormDataPart( - MultipartBody.Builder multipartBody, String key, Object value, boolean arraysAsRepeats) { - JsonNode valueNode = MAPPER.valueToTree(value); - - List> flat; - if (valueNode.isObject()) { - flat = flattenObject((ObjectNode) valueNode, arraysAsRepeats); - } else if (valueNode.isArray()) { - flat = flattenArray((ArrayNode) valueNode, "", arraysAsRepeats); - } else { - if (valueNode.isTextual()) { - multipartBody.addFormDataPart(key, valueNode.textValue()); - } else { - multipartBody.addFormDataPart(key, valueNode.toString()); - } - return; - } - - for (Map.Entry field : flat) { - if (field.getValue().isTextual()) { - multipartBody.addFormDataPart(key + field.getKey(), field.getValue().textValue()); - } else { - multipartBody.addFormDataPart(key + field.getKey(), field.getValue().toString()); - } - } - } - - public static List> flattenObject( - ObjectNode object, boolean arraysAsRepeats) { - List> flat = new ArrayList<>(); - - Iterator> fields = object.fields(); - while (fields.hasNext()) { - Map.Entry field = fields.next(); - - String key = "[" + field.getKey() + "]"; - - if (field.getValue().isObject()) { - List> flatField = - flattenObject((ObjectNode) field.getValue(), arraysAsRepeats); - addAll(flat, flatField, key); - } else if (field.getValue().isArray()) { - List> flatField = - flattenArray((ArrayNode) field.getValue(), key, arraysAsRepeats); - addAll(flat, flatField, ""); - } else { - flat.add(new AbstractMap.SimpleEntry<>(key, field.getValue())); - } - } - - return flat; - } - - private static List> flattenArray( - ArrayNode array, String key, boolean arraysAsRepeats) { - List> flat = new ArrayList<>(); - - Iterator elements = array.elements(); - - int index = 0; - while (elements.hasNext()) { - JsonNode element = elements.next(); - - String indexKey = key + "[" + index + "]"; - - if (arraysAsRepeats) { - indexKey = key; - } - - if (element.isObject()) { - List> flatField = - flattenObject((ObjectNode) element, arraysAsRepeats); - addAll(flat, flatField, indexKey); - } else if (element.isArray()) { - List> flatField = - flattenArray((ArrayNode) element, "", arraysAsRepeats); - addAll(flat, flatField, indexKey); - } else { - flat.add(new AbstractMap.SimpleEntry<>(indexKey, element)); - } - - index++; - } - - return flat; - } - - private static void addAll( - List> target, - List> source, - String prefix) { - for (Map.Entry entry : source) { - Map.Entry entryToAdd = - new AbstractMap.SimpleEntry<>(prefix + entry.getKey(), entry.getValue()); - target.add(entryToAdd); - } - } -} diff --git a/src/main/java/core/ReconnectingWebSocketListener.java b/src/main/java/core/ReconnectingWebSocketListener.java deleted file mode 100644 index 1e21e37..0000000 --- a/src/main/java/core/ReconnectingWebSocketListener.java +++ /dev/null @@ -1,494 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package core; - -import static java.util.concurrent.TimeUnit.*; - -import java.util.ArrayList; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ConcurrentLinkedQueue; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeoutException; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.function.Supplier; -import okhttp3.Response; -import okhttp3.WebSocket; -import okhttp3.WebSocketListener; -import okio.ByteString; - -/** - * WebSocketListener with automatic reconnection, exponential backoff, and message queuing. Provides - * production-ready resilience for WebSocket connections. - */ -public abstract class ReconnectingWebSocketListener extends WebSocketListener { - private final long minReconnectionDelayMs; - - private final long maxReconnectionDelayMs; - - private final double reconnectionDelayGrowFactor; - - private final int maxRetries; - - private final int maxEnqueuedMessages; - - private final AtomicInteger retryCount = new AtomicInteger(0); - - private final AtomicBoolean connectLock = new AtomicBoolean(false); - - private final AtomicBoolean shouldReconnect = new AtomicBoolean(true); - - protected volatile WebSocket webSocket; - - private volatile long connectionEstablishedTime = 0L; - - private final ConcurrentLinkedQueue messageQueue = new ConcurrentLinkedQueue<>(); - - private final ConcurrentLinkedQueue binaryMessageQueue = - new ConcurrentLinkedQueue<>(); - - private final ScheduledExecutorService reconnectExecutor = - Executors.newSingleThreadScheduledExecutor(); - - private final Supplier connectionSupplier; - - /** - * Creates a new reconnecting WebSocket listener. - * - * @param options Reconnection configuration options - * @param connectionSupplier Supplier that creates new WebSocket connections - */ - public ReconnectingWebSocketListener( - ReconnectingWebSocketListener.ReconnectOptions options, - Supplier connectionSupplier) { - this.minReconnectionDelayMs = options.minReconnectionDelayMs; - this.maxReconnectionDelayMs = options.maxReconnectionDelayMs; - this.reconnectionDelayGrowFactor = options.reconnectionDelayGrowFactor; - this.maxRetries = options.maxRetries; - this.maxEnqueuedMessages = options.maxEnqueuedMessages; - this.connectionSupplier = connectionSupplier; - } - - /** - * Initiates a WebSocket connection with automatic reconnection enabled. - * - *

Connection behavior: - Times out after 4000 milliseconds - Thread-safe via atomic lock - * (returns immediately if connection in progress) - Retry count not incremented for initial - * connection attempt - * - *

Error handling: - TimeoutException: Includes retry attempt context - InterruptedException: - * Preserves thread interruption status - ExecutionException: Extracts actual cause and adds - * context - */ - public void connect() { - if (!connectLock.compareAndSet(false, true)) { - return; - } - if (retryCount.get() >= maxRetries) { - connectLock.set(false); - return; - } - try { - CompletableFuture connectionFuture = - CompletableFuture.supplyAsync(connectionSupplier); - try { - webSocket = connectionFuture.get(4000, MILLISECONDS); - } catch (TimeoutException e) { - connectionFuture.cancel(true); - TimeoutException timeoutError = - new TimeoutException( - "WebSocket connection timeout after " - + 4000 - + " milliseconds" - + (retryCount.get() > 0 - ? " (retry attempt #" + retryCount.get() - : " (initial connection attempt)")); - onWebSocketFailure(null, timeoutError, null); - if (shouldReconnect.get()) { - scheduleReconnect(); - } - } catch (InterruptedException e) { - connectionFuture.cancel(true); - Thread.currentThread().interrupt(); - InterruptedException interruptError = - new InterruptedException( - "WebSocket connection interrupted" - + (retryCount.get() > 0 - ? " during retry attempt #" + retryCount.get() - : " during initial connection")); - interruptError.initCause(e); - onWebSocketFailure(null, interruptError, null); - } catch (ExecutionException e) { - Throwable cause = e.getCause() != null ? e.getCause() : e; - String context = - retryCount.get() > 0 - ? "WebSocket connection failed during retry attempt #" + retryCount.get() - : "WebSocket connection failed during initial attempt"; - RuntimeException wrappedException = - new RuntimeException( - context + ": " + cause.getClass().getSimpleName() + ": " + cause.getMessage()); - wrappedException.initCause(cause); - onWebSocketFailure(null, wrappedException, null); - if (shouldReconnect.get()) { - scheduleReconnect(); - } - } - } finally { - connectLock.set(false); - } - } - - /** - * Disconnects the WebSocket and disables automatic reconnection. - * - *

This method: - Disables automatic reconnection - Clears queued messages to prevent stale - * data - Closes the WebSocket with standard close code 1000 - Properly shuts down the reconnect - * executor to prevent thread leaks - Waits up to 5 seconds for executor termination - */ - public void disconnect() { - shouldReconnect.set(false); - messageQueue.clear(); - binaryMessageQueue.clear(); - if (webSocket != null) { - webSocket.close(1000, "Client disconnecting"); - } - reconnectExecutor.shutdown(); - try { - if (!reconnectExecutor.awaitTermination(5, SECONDS)) { - reconnectExecutor.shutdownNow(); - } - } catch (InterruptedException e) { - reconnectExecutor.shutdownNow(); - Thread.currentThread().interrupt(); - } - } - - /** - * Sends a message or queues it if not connected. - * - *

Thread-safe: Synchronized to prevent race conditions with flushMessageQueue(). - * - *

Behavior: - If connected: Attempts direct send, queues if buffer full - If disconnected: - * Queues message up to maxEnqueuedMessages limit - If queue full: Message is dropped - * - * @param message The message to send - * @return true if sent immediately, false if queued or dropped - */ - public synchronized boolean send(String message) { - WebSocket ws = webSocket; - if (ws != null) { - boolean sent = ws.send(message); - if (!sent && messageQueue.size() < maxEnqueuedMessages) { - messageQueue.offer(message); - return false; - } - return sent; - } else { - if (messageQueue.size() < maxEnqueuedMessages) { - messageQueue.offer(message); - return false; - } - return false; - } - } - - /** - * Sends binary data or queues it if not connected. - * - *

Thread-safe: Synchronized to prevent race conditions with flushMessageQueue(). - * - *

Behavior: - If connected: Attempts direct send, queues if buffer full - If disconnected: - * Queues data up to maxEnqueuedMessages limit - If queue full: Data is dropped - * - * @param data The binary data to send - * @return true if sent immediately, false if queued or dropped - */ - public synchronized boolean sendBinary(ByteString data) { - WebSocket ws = webSocket; - if (ws != null) { - boolean sent = ws.send(data); - if (!sent && binaryMessageQueue.size() < maxEnqueuedMessages) { - binaryMessageQueue.offer(data); - return false; - } - return sent; - } else { - if (binaryMessageQueue.size() < maxEnqueuedMessages) { - binaryMessageQueue.offer(data); - return false; - } - return false; - } - } - - /** - * Gets the current WebSocket instance. Thread-safe method to access the WebSocket connection. - * - * @return the WebSocket or null if not connected - */ - public WebSocket getWebSocket() { - return webSocket; - } - - /** - * @hidden - */ - @Override - public void onOpen(WebSocket webSocket, Response response) { - this.webSocket = webSocket; - connectionEstablishedTime = System.currentTimeMillis(); - retryCount.set(0); - flushMessageQueue(); - onWebSocketOpen(webSocket, response); - } - - @Override - public void onMessage(WebSocket webSocket, String text) { - onWebSocketMessage(webSocket, text); - } - - @Override - public void onMessage(WebSocket webSocket, ByteString bytes) { - onWebSocketBinaryMessage(webSocket, bytes); - } - - /** - * @hidden - */ - @Override - public void onFailure(WebSocket webSocket, Throwable t, Response response) { - this.webSocket = null; - long uptime = 0L; - if (connectionEstablishedTime > 0) { - uptime = System.currentTimeMillis() - connectionEstablishedTime; - if (uptime >= 5000) { - retryCount.set(0); - } - } - connectionEstablishedTime = 0L; - Throwable enhancedError = t; - if (t != null) { - String errorContext = "WebSocket connection failed"; - if (uptime > 0) { - errorContext += " after " + (uptime / 1000) + " seconds"; - } - if (response != null) { - errorContext += " with HTTP " + response.code() + " " + response.message(); - } - enhancedError = - new RuntimeException( - errorContext + ": " + t.getClass().getSimpleName() + ": " + t.getMessage()); - enhancedError.initCause(t); - } - onWebSocketFailure(webSocket, enhancedError, response); - if (shouldReconnect.get()) { - scheduleReconnect(); - } - } - - /** - * @hidden - */ - @Override - public void onClosed(WebSocket webSocket, int code, String reason) { - this.webSocket = null; - if (connectionEstablishedTime > 0) { - long uptime = System.currentTimeMillis() - connectionEstablishedTime; - if (uptime >= 5000) { - retryCount.set(0); - } - } - connectionEstablishedTime = 0L; - onWebSocketClosed(webSocket, code, reason); - if (code != 1000 && shouldReconnect.get()) { - scheduleReconnect(); - } - } - - /** - * Calculates the next reconnection delay using exponential backoff. - * - *

Uses 0-based retry count where: - 0 = initial connection (not used by this method) - 1 = - * first retry (returns minReconnectionDelayMs) - 2+ = exponential backoff up to - * maxReconnectionDelayMs - */ - private long getNextDelay() { - if (retryCount.get() == 1) { - return minReconnectionDelayMs; - } - long delay = - (long) - (minReconnectionDelayMs * Math.pow(reconnectionDelayGrowFactor, retryCount.get() - 1)); - return Math.min(delay, maxReconnectionDelayMs); - } - - /** - * Schedules a reconnection attempt with appropriate delay. Increments retry count and uses - * exponential backoff. - */ - private void scheduleReconnect() { - retryCount.incrementAndGet(); - long delay = getNextDelay(); - reconnectExecutor.schedule(this::connect, delay, MILLISECONDS); - } - - /** - * Sends all queued messages after reconnection. - * - *

Thread-safe: Synchronized to prevent race conditions with send() method. - * - *

Algorithm: 1. Drains queue into temporary list to avoid holding lock during sends 2. - * Attempts to send each message in order 3. If any send fails, re-queues that message and all - * subsequent messages 4. Preserves message ordering during re-queueing 5. Repeats for binary - * message queue - */ - private synchronized void flushMessageQueue() { - WebSocket ws = webSocket; - if (ws != null) { - ArrayList tempQueue = new ArrayList<>(); - String message; - while ((message = messageQueue.poll()) != null) { - tempQueue.add(message); - } - for (int i = 0; i < tempQueue.size(); i++) { - if (!ws.send(tempQueue.get(i))) { - for (int j = i; j < tempQueue.size(); j++) { - messageQueue.offer(tempQueue.get(j)); - } - break; - } - } - ArrayList tempBinaryQueue = new ArrayList<>(); - ByteString binaryMsg; - while ((binaryMsg = binaryMessageQueue.poll()) != null) { - tempBinaryQueue.add(binaryMsg); - } - for (int i = 0; i < tempBinaryQueue.size(); i++) { - if (!ws.send(tempBinaryQueue.get(i))) { - for (int j = i; j < tempBinaryQueue.size(); j++) { - binaryMessageQueue.offer(tempBinaryQueue.get(j)); - } - break; - } - } - } - } - - protected abstract void onWebSocketOpen(WebSocket webSocket, Response response); - - protected abstract void onWebSocketMessage(WebSocket webSocket, String text); - - protected abstract void onWebSocketBinaryMessage(WebSocket webSocket, ByteString bytes); - - protected abstract void onWebSocketFailure(WebSocket webSocket, Throwable t, Response response); - - protected abstract void onWebSocketClosed(WebSocket webSocket, int code, String reason); - - /** Configuration options for automatic reconnection. */ - public static final class ReconnectOptions { - public final long minReconnectionDelayMs; - - public final long maxReconnectionDelayMs; - - public final double reconnectionDelayGrowFactor; - - public final int maxRetries; - - public final int maxEnqueuedMessages; - - private ReconnectOptions(Builder builder) { - this.minReconnectionDelayMs = builder.minReconnectionDelayMs; - this.maxReconnectionDelayMs = builder.maxReconnectionDelayMs; - this.reconnectionDelayGrowFactor = builder.reconnectionDelayGrowFactor; - this.maxRetries = builder.maxRetries; - this.maxEnqueuedMessages = builder.maxEnqueuedMessages; - } - - public static Builder builder() { - return new Builder(); - } - - public static final class Builder { - private long minReconnectionDelayMs; - - private long maxReconnectionDelayMs; - - private double reconnectionDelayGrowFactor; - - private int maxRetries; - - private int maxEnqueuedMessages; - - public Builder() { - this.minReconnectionDelayMs = 1000; - this.maxReconnectionDelayMs = 10000; - this.reconnectionDelayGrowFactor = 1.3; - this.maxRetries = 2147483647; - this.maxEnqueuedMessages = 1000; - } - - public Builder minReconnectionDelayMs(long minReconnectionDelayMs) { - this.minReconnectionDelayMs = minReconnectionDelayMs; - return this; - } - - public Builder maxReconnectionDelayMs(long maxReconnectionDelayMs) { - this.maxReconnectionDelayMs = maxReconnectionDelayMs; - return this; - } - - public Builder reconnectionDelayGrowFactor(double reconnectionDelayGrowFactor) { - this.reconnectionDelayGrowFactor = reconnectionDelayGrowFactor; - return this; - } - - public Builder maxRetries(int maxRetries) { - this.maxRetries = maxRetries; - return this; - } - - public Builder maxEnqueuedMessages(int maxEnqueuedMessages) { - this.maxEnqueuedMessages = maxEnqueuedMessages; - return this; - } - - /** - * Builds the ReconnectOptions with validation. - * - *

Validates that: - All delay values are positive - minReconnectionDelayMs <= - * maxReconnectionDelayMs - reconnectionDelayGrowFactor >= 1.0 - maxRetries and - * maxEnqueuedMessages are non-negative - * - * @return The validated ReconnectOptions instance - * @throws IllegalArgumentException if configuration is invalid - */ - public ReconnectOptions build() { - if (minReconnectionDelayMs <= 0) { - throw new IllegalArgumentException("minReconnectionDelayMs must be positive"); - } - if (maxReconnectionDelayMs <= 0) { - throw new IllegalArgumentException("maxReconnectionDelayMs must be positive"); - } - if (minReconnectionDelayMs > maxReconnectionDelayMs) { - throw new IllegalArgumentException( - "minReconnectionDelayMs (" - + minReconnectionDelayMs - + ") must not exceed maxReconnectionDelayMs (" - + maxReconnectionDelayMs - + ")"); - } - if (reconnectionDelayGrowFactor < 1.0) { - throw new IllegalArgumentException("reconnectionDelayGrowFactor must be >= 1.0"); - } - if (maxRetries < 0) { - throw new IllegalArgumentException("maxRetries must be non-negative"); - } - if (maxEnqueuedMessages < 0) { - throw new IllegalArgumentException("maxEnqueuedMessages must be non-negative"); - } - return new ReconnectOptions(this); - } - } - } -} diff --git a/src/main/java/core/RequestOptions.java b/src/main/java/core/RequestOptions.java deleted file mode 100644 index 315ea84..0000000 --- a/src/main/java/core/RequestOptions.java +++ /dev/null @@ -1,138 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package core; - -import java.util.HashMap; -import java.util.Map; -import java.util.Optional; -import java.util.concurrent.TimeUnit; -import java.util.function.Supplier; - -public final class RequestOptions { - private final String apiKey; - - private final Optional timeout; - - private final TimeUnit timeoutTimeUnit; - - private final Map headers; - - private final Map> headerSuppliers; - - private final Map queryParameters; - - private final Map> queryParameterSuppliers; - - private RequestOptions( - String apiKey, - Optional timeout, - TimeUnit timeoutTimeUnit, - Map headers, - Map> headerSuppliers, - Map queryParameters, - Map> queryParameterSuppliers) { - this.apiKey = apiKey; - this.timeout = timeout; - this.timeoutTimeUnit = timeoutTimeUnit; - this.headers = headers; - this.headerSuppliers = headerSuppliers; - this.queryParameters = queryParameters; - this.queryParameterSuppliers = queryParameterSuppliers; - } - - public Optional getTimeout() { - return timeout; - } - - public TimeUnit getTimeoutTimeUnit() { - return timeoutTimeUnit; - } - - public Map getHeaders() { - Map headers = new HashMap<>(); - if (this.apiKey != null) { - headers.put("Authorization", "Token " + this.apiKey); - } - headers.putAll(this.headers); - this.headerSuppliers.forEach( - (key, supplier) -> { - headers.put(key, supplier.get()); - }); - return headers; - } - - public Map getQueryParameters() { - Map queryParameters = new HashMap<>(this.queryParameters); - this.queryParameterSuppliers.forEach( - (key, supplier) -> { - queryParameters.put(key, supplier.get()); - }); - return queryParameters; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private String apiKey = null; - - private Optional timeout = Optional.empty(); - - private TimeUnit timeoutTimeUnit = TimeUnit.SECONDS; - - private final Map headers = new HashMap<>(); - - private final Map> headerSuppliers = new HashMap<>(); - - private final Map queryParameters = new HashMap<>(); - - private final Map> queryParameterSuppliers = new HashMap<>(); - - public Builder apiKey(String apiKey) { - this.apiKey = apiKey; - 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 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 Builder addQueryParameter(String key, String value) { - this.queryParameters.put(key, value); - return this; - } - - public Builder addQueryParameter(String key, Supplier value) { - this.queryParameterSuppliers.put(key, value); - return this; - } - - public RequestOptions build() { - return new RequestOptions( - apiKey, - timeout, - timeoutTimeUnit, - headers, - headerSuppliers, - queryParameters, - queryParameterSuppliers); - } - } -} diff --git a/src/main/java/core/ResponseBodyInputStream.java b/src/main/java/core/ResponseBodyInputStream.java deleted file mode 100644 index 3285480..0000000 --- a/src/main/java/core/ResponseBodyInputStream.java +++ /dev/null @@ -1,43 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package 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/core/ResponseBodyReader.java b/src/main/java/core/ResponseBodyReader.java deleted file mode 100644 index 98f1a78..0000000 --- a/src/main/java/core/ResponseBodyReader.java +++ /dev/null @@ -1,42 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package 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/core/RetryInterceptor.java b/src/main/java/core/RetryInterceptor.java deleted file mode 100644 index e999e99..0000000 --- a/src/main/java/core/RetryInterceptor.java +++ /dev/null @@ -1,177 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package core; - -import java.io.IOException; -import java.time.Duration; -import java.time.ZonedDateTime; -import java.time.format.DateTimeFormatter; -import java.time.format.DateTimeParseException; -import java.util.Optional; -import java.util.Random; -import okhttp3.Interceptor; -import okhttp3.Response; - -public class RetryInterceptor implements Interceptor { - - private static final Duration INITIAL_RETRY_DELAY = Duration.ofMillis(1000); - private static final Duration MAX_RETRY_DELAY = Duration.ofMillis(60000); - private static final double JITTER_FACTOR = 0.2; - - 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(response); - 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(response); - } else { - return response; - } - } - - return response; - } - - /** - * Calculates the retry delay from response headers, with fallback to exponential backoff. - * Priority: Retry-After > X-RateLimit-Reset > Exponential Backoff - */ - private Duration getRetryDelayFromHeaders(Response response, int retryAttempt) { - // Check for Retry-After header first (RFC 7231), with no jitter - String retryAfter = response.header("Retry-After"); - if (retryAfter != null) { - // Parse as number of seconds... - Optional secondsDelay = - tryParseLong(retryAfter) - .map(seconds -> seconds * 1000) - .filter(delayMs -> delayMs > 0) - .map(delayMs -> Math.min(delayMs, MAX_RETRY_DELAY.toMillis())) - .map(Duration::ofMillis); - if (secondsDelay.isPresent()) { - return secondsDelay.get(); - } - - // ...or as an HTTP date; both are valid - Optional dateDelay = - tryParseHttpDate(retryAfter) - .map(resetTime -> resetTime.toInstant().toEpochMilli() - System.currentTimeMillis()) - .filter(delayMs -> delayMs > 0) - .map(delayMs -> Math.min(delayMs, MAX_RETRY_DELAY.toMillis())) - .map(Duration::ofMillis); - if (dateDelay.isPresent()) { - return dateDelay.get(); - } - } - - // Then check for industry-standard X-RateLimit-Reset header, with positive jitter - String rateLimitReset = response.header("X-RateLimit-Reset"); - if (rateLimitReset != null) { - // Assume Unix timestamp in epoch seconds - Optional rateLimitDelay = - tryParseLong(rateLimitReset) - .map(resetTimeSeconds -> (resetTimeSeconds * 1000) - System.currentTimeMillis()) - .filter(delayMs -> delayMs > 0) - .map(delayMs -> Math.min(delayMs, MAX_RETRY_DELAY.toMillis())) - .map(this::addPositiveJitter) - .map(Duration::ofMillis); - if (rateLimitDelay.isPresent()) { - return rateLimitDelay.get(); - } - } - - // Fall back to exponential backoff, with symmetric jitter - long baseDelay = INITIAL_RETRY_DELAY.toMillis() * (1L << retryAttempt); // 2^retryAttempt - long cappedDelay = Math.min(baseDelay, MAX_RETRY_DELAY.toMillis()); - return Duration.ofMillis(addSymmetricJitter(cappedDelay)); - } - - /** Attempts to parse a string as a long, returning empty Optional on failure. */ - private Optional tryParseLong(String value) { - if (value == null) { - return Optional.empty(); - } - try { - return Optional.of(Long.parseLong(value)); - } catch (NumberFormatException e) { - return Optional.empty(); - } - } - - /** Attempts to parse a string as an HTTP date (RFC 1123), returning empty Optional on failure. */ - private Optional tryParseHttpDate(String value) { - if (value == null) { - return Optional.empty(); - } - try { - return Optional.of(ZonedDateTime.parse(value, DateTimeFormatter.RFC_1123_DATE_TIME)); - } catch (DateTimeParseException e) { - return Optional.empty(); - } - } - - /** - * Adds positive jitter (100-120% of original value) to prevent thundering herd. Used for - * X-RateLimit-Reset header delays. - */ - private long addPositiveJitter(long delayMs) { - double jitterMultiplier = 1.0 + (random.nextDouble() * JITTER_FACTOR); - return (long) (delayMs * jitterMultiplier); - } - - /** - * Adds symmetric jitter (90-110% of original value) to prevent thundering herd. Used for - * exponential backoff delays. - */ - private long addSymmetricJitter(long delayMs) { - double jitterMultiplier = 1.0 + ((random.nextDouble() - 0.5) * JITTER_FACTOR); - return (long) (delayMs * jitterMultiplier); - } - - private static boolean shouldRetry(int statusCode) { - return statusCode == 408 || 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(Response response) { - if (retryNumber >= maxNumRetries) { - return Optional.empty(); - } - - Duration delay = getRetryDelayFromHeaders(response, retryNumber); - retryNumber += 1; - return Optional.of(delay); - } - } -} diff --git a/src/main/java/core/Rfc2822DateTimeDeserializer.java b/src/main/java/core/Rfc2822DateTimeDeserializer.java deleted file mode 100644 index f111762..0000000 --- a/src/main/java/core/Rfc2822DateTimeDeserializer.java +++ /dev/null @@ -1,25 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package core; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.JsonDeserializer; -import java.io.IOException; -import java.time.OffsetDateTime; -import java.time.ZonedDateTime; -import java.time.format.DateTimeFormatter; - -/** - * Custom deserializer that handles converting RFC 2822 (RFC 1123) dates into {@link OffsetDateTime} - * objects. This is used for fields with format "date-time-rfc-2822", such as Twilio's dateCreated, - * dateSent, dateUpdated. - */ -public class Rfc2822DateTimeDeserializer extends JsonDeserializer { - - @Override - public OffsetDateTime deserialize(JsonParser parser, DeserializationContext context) - throws IOException { - String raw = parser.getValueAsString(); - return ZonedDateTime.parse(raw, DateTimeFormatter.RFC_1123_DATE_TIME).toOffsetDateTime(); - } -} diff --git a/src/main/java/core/SseEvent.java b/src/main/java/core/SseEvent.java deleted file mode 100644 index 266869b..0000000 --- a/src/main/java/core/SseEvent.java +++ /dev/null @@ -1,119 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package core; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.Objects; -import java.util.Optional; - -/** - * Represents a Server-Sent Event with all standard fields. Used for event-level discrimination - * where the discriminator is at the SSE envelope level. - * - * @param The type of the data field - */ -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonIgnoreProperties(ignoreUnknown = true) -public final class SseEvent { - private final String event; - private final T data; - private final String id; - private final Long retry; - - private SseEvent(String event, T data, String id, Long retry) { - this.event = event; - this.data = data; - this.id = id; - this.retry = retry; - } - - @JsonProperty("event") - public Optional getEvent() { - return Optional.ofNullable(event); - } - - @JsonProperty("data") - public T getData() { - return data; - } - - @JsonProperty("id") - public Optional getId() { - return Optional.ofNullable(id); - } - - @JsonProperty("retry") - public Optional getRetry() { - return Optional.ofNullable(retry); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - SseEvent sseEvent = (SseEvent) o; - return Objects.equals(event, sseEvent.event) - && Objects.equals(data, sseEvent.data) - && Objects.equals(id, sseEvent.id) - && Objects.equals(retry, sseEvent.retry); - } - - @Override - public int hashCode() { - return Objects.hash(event, data, id, retry); - } - - @Override - public String toString() { - return "SseEvent{" - + "event='" - + event - + '\'' - + ", data=" - + data - + ", id='" - + id - + '\'' - + ", retry=" - + retry - + '}'; - } - - public static Builder builder() { - return new Builder<>(); - } - - public static final class Builder { - private String event; - private T data; - private String id; - private Long retry; - - private Builder() {} - - public Builder event(String event) { - this.event = event; - return this; - } - - public Builder data(T data) { - this.data = data; - return this; - } - - public Builder id(String id) { - this.id = id; - return this; - } - - public Builder retry(Long retry) { - this.retry = retry; - return this; - } - - public SseEvent build() { - return new SseEvent<>(event, data, id, retry); - } - } -} diff --git a/src/main/java/core/SseEventParser.java b/src/main/java/core/SseEventParser.java deleted file mode 100644 index 1685803..0000000 --- a/src/main/java/core/SseEventParser.java +++ /dev/null @@ -1,226 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package core; - -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.core.type.TypeReference; -import java.lang.reflect.Field; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Optional; -import java.util.Set; - -/** - * Utility class for parsing Server-Sent Events with support for discriminated unions. - * - *

Handles two discrimination patterns: - * - *

    - *
  1. Data-level discrimination: The discriminator (e.g., 'type') is inside the JSON data - * payload. Jackson's polymorphic deserialization handles this automatically. - *
  2. Event-level discrimination: The discriminator (e.g., 'event') is at the SSE envelope - * level. This requires constructing the full SSE envelope for Jackson to process. - *
- */ -public final class SseEventParser { - - private static final Set SSE_ENVELOPE_FIELDS = - new HashSet<>(Arrays.asList("event", "data", "id", "retry")); - - private SseEventParser() { - // Utility class - } - - /** - * Parse an SSE event using event-level discrimination. - * - *

Constructs the full SSE envelope object with event, data, id, and retry fields, then - * deserializes it to the target union type. - * - * @param eventType The SSE event type (from event: field) - * @param data The SSE data content (from data: field) - * @param id The SSE event ID (from id: field), may be null - * @param retry The SSE retry value (from retry: field), may be null - * @param unionClass The target union class - * @param discriminatorProperty The property name used for discrimination (e.g., "event") - * @param The target type - * @return The deserialized object - */ - public static T parseEventLevelUnion( - String eventType, - String data, - String id, - Long retry, - Class unionClass, - String discriminatorProperty) { - try { - // Determine if data should be parsed as JSON based on the variant's expected type - Object parsedData = parseDataForVariant(eventType, data, unionClass, discriminatorProperty); - - // Construct the SSE envelope object - Map envelope = new HashMap<>(); - envelope.put(discriminatorProperty, eventType); - envelope.put("data", parsedData); - if (id != null) { - envelope.put("id", id); - } - if (retry != null) { - envelope.put("retry", retry); - } - - // Serialize to JSON and deserialize to target type - String envelopeJson = ObjectMappers.JSON_MAPPER.writeValueAsString(envelope); - return ObjectMappers.JSON_MAPPER.readValue(envelopeJson, unionClass); - } catch (Exception e) { - throw new RuntimeException("Failed to parse SSE event with event-level discrimination", e); - } - } - - /** - * Parse an SSE event using data-level discrimination. - * - *

Simply parses the data field as JSON and deserializes it to the target type. Jackson's - * polymorphic deserialization handles the discrimination automatically. - * - * @param data The SSE data content (from data: field) - * @param valueType The target type - * @param The target type - * @return The deserialized object - */ - public static T parseDataLevelUnion(String data, Class valueType) { - try { - return ObjectMappers.JSON_MAPPER.readValue(data, valueType); - } catch (Exception e) { - throw new RuntimeException("Failed to parse SSE data with data-level discrimination", e); - } - } - - /** - * Determines if the given discriminator property indicates event-level discrimination. - * Event-level discrimination occurs when the discriminator is an SSE envelope field. - * - * @param discriminatorProperty The discriminator property name - * @return true if event-level discrimination, false otherwise - */ - public static boolean isEventLevelDiscrimination(String discriminatorProperty) { - return SSE_ENVELOPE_FIELDS.contains(discriminatorProperty); - } - - /** - * Attempts to find the discriminator property from the union class's Jackson annotations. - * - * @param unionClass The union class to inspect - * @return The discriminator property name, or empty if not found - */ - public static Optional findDiscriminatorProperty(Class unionClass) { - try { - // Look for JsonTypeInfo on the class itself - JsonTypeInfo typeInfo = unionClass.getAnnotation(JsonTypeInfo.class); - if (typeInfo != null && !typeInfo.property().isEmpty()) { - return Optional.of(typeInfo.property()); - } - - // Look for inner Value interface with JsonTypeInfo - for (Class innerClass : unionClass.getDeclaredClasses()) { - typeInfo = innerClass.getAnnotation(JsonTypeInfo.class); - if (typeInfo != null && !typeInfo.property().isEmpty()) { - return Optional.of(typeInfo.property()); - } - } - } catch (Exception e) { - // Ignore reflection errors - } - return Optional.empty(); - } - - /** - * Parse the data field based on what the matching variant expects. If the variant expects a - * String for its data field, returns the raw string. Otherwise, parses the data as JSON. - */ - private static Object parseDataForVariant( - String eventType, String data, Class unionClass, String discriminatorProperty) { - if (data == null || data.isEmpty()) { - return data; - } - - try { - // Try to find the variant class that matches this event type - Class variantClass = findVariantClass(unionClass, eventType, discriminatorProperty); - if (variantClass != null) { - // Check if the variant expects a String for the data field - Field dataField = findField(variantClass, "data"); - if (dataField != null && String.class.equals(dataField.getType())) { - // Variant expects String - return raw data - return data; - } - } - - // Try to parse as JSON - return ObjectMappers.JSON_MAPPER.readValue(data, new TypeReference>() {}); - } catch (Exception e) { - // If JSON parsing fails, return as string - return data; - } - } - - /** Find the variant class that matches the given discriminator value. */ - private static Class findVariantClass( - Class unionClass, String discriminatorValue, String discriminatorProperty) { - try { - // Look for JsonSubTypes annotation - JsonSubTypes subTypes = findJsonSubTypes(unionClass); - if (subTypes == null) { - return null; - } - - for (JsonSubTypes.Type subType : subTypes.value()) { - JsonTypeName typeName = subType.value().getAnnotation(JsonTypeName.class); - if (typeName != null && typeName.value().equals(discriminatorValue)) { - return subType.value(); - } - // Also check the name attribute of @JsonSubTypes.Type - if (subType.name().equals(discriminatorValue)) { - return subType.value(); - } - } - } catch (Exception e) { - // Ignore reflection errors - } - return null; - } - - /** Find JsonSubTypes annotation on the class or its inner classes. */ - private static JsonSubTypes findJsonSubTypes(Class unionClass) { - // Check the class itself - JsonSubTypes subTypes = unionClass.getAnnotation(JsonSubTypes.class); - if (subTypes != null) { - return subTypes; - } - - // Check inner classes (for Fern-style unions with inner Value interface) - for (Class innerClass : unionClass.getDeclaredClasses()) { - subTypes = innerClass.getAnnotation(JsonSubTypes.class); - if (subTypes != null) { - return subTypes; - } - } - return null; - } - - /** Find a field by name in a class, including private fields. */ - private static Field findField(Class clazz, String fieldName) { - try { - return clazz.getDeclaredField(fieldName); - } catch (NoSuchFieldException e) { - // Check superclass - Class superClass = clazz.getSuperclass(); - if (superClass != null && superClass != Object.class) { - return findField(superClass, fieldName); - } - return null; - } - } -} diff --git a/src/main/java/core/Stream.java b/src/main/java/core/Stream.java deleted file mode 100644 index 7fc7e56..0000000 --- a/src/main/java/core/Stream.java +++ /dev/null @@ -1,526 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package core; - -import java.io.Closeable; -import java.io.IOException; -import java.io.Reader; -import java.util.Iterator; -import java.util.NoSuchElementException; -import java.util.Scanner; - -/** - * The {@code Stream} class implements {@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. - * Iterable stream for parsing JSON and Server-Sent Events (SSE) data. Supports both - * newline-delimited JSON and SSE with optional stream termination. - * - * @param The type of objects in the stream. - */ -public final class Stream implements Iterable, Closeable { - - private static final String NEWLINE = "\n"; - private static final String DATA_PREFIX = "data:"; - - public enum StreamType { - JSON, - SSE, - SSE_EVENT_DISCRIMINATED - } - - private final Class valueType; - private final Scanner scanner; - private final StreamType streamType; - private final String messageTerminator; - private final String streamTerminator; - private final Reader sseReader; - private final String discriminatorProperty; - private boolean isClosed = false; - - /** - * 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.valueType = valueType; - this.scanner = new Scanner(reader).useDelimiter(delimiter); - this.streamType = StreamType.JSON; - this.messageTerminator = delimiter; - this.streamTerminator = null; - this.sseReader = null; - this.discriminatorProperty = null; - } - - private Stream(Class valueType, StreamType type, Reader reader, String terminator) { - this(valueType, type, reader, terminator, null); - } - - private Stream( - Class valueType, - StreamType type, - Reader reader, - String terminator, - String discriminatorProperty) { - this.valueType = valueType; - this.streamType = type; - this.discriminatorProperty = discriminatorProperty; - if (type == StreamType.JSON) { - this.scanner = new Scanner(reader).useDelimiter(terminator); - this.messageTerminator = terminator; - this.streamTerminator = null; - this.sseReader = null; - } else { - this.scanner = null; - this.messageTerminator = NEWLINE; - this.streamTerminator = terminator; - this.sseReader = reader; - } - } - - public static Stream fromJson(Class valueType, Reader reader, String delimiter) { - return new Stream<>(valueType, reader, delimiter); - } - - public static Stream fromJson(Class valueType, Reader reader) { - return new Stream<>(valueType, reader, NEWLINE); - } - - public static Stream fromSse(Class valueType, Reader sseReader) { - return new Stream<>(valueType, StreamType.SSE, sseReader, null); - } - - public static Stream fromSse( - Class valueType, Reader sseReader, String streamTerminator) { - return new Stream<>(valueType, StreamType.SSE, sseReader, streamTerminator); - } - - /** - * Creates a stream from SSE data with event-level discrimination support. Use this when the SSE - * payload is a discriminated union where the discriminator is an SSE envelope field (e.g., - * 'event'). - * - * @param valueType The class of the objects in the stream. - * @param sseReader The reader that provides the SSE data. - * @param discriminatorProperty The property name used for discrimination (e.g., "event"). - * @param The type of objects in the stream. - * @return A new Stream instance configured for SSE with event-level discrimination. - */ - public static Stream fromSseWithEventDiscrimination( - Class valueType, Reader sseReader, String discriminatorProperty) { - return new Stream<>( - valueType, StreamType.SSE_EVENT_DISCRIMINATED, sseReader, null, discriminatorProperty); - } - - /** - * Creates a stream from SSE data with event-level discrimination support and a stream terminator. - * - * @param valueType The class of the objects in the stream. - * @param sseReader The reader that provides the SSE data. - * @param discriminatorProperty The property name used for discrimination (e.g., "event"). - * @param streamTerminator The terminator string that signals end of stream (e.g., "[DONE]"). - * @param The type of objects in the stream. - * @return A new Stream instance configured for SSE with event-level discrimination. - */ - public static Stream fromSseWithEventDiscrimination( - Class valueType, Reader sseReader, String discriminatorProperty, String streamTerminator) { - return new Stream<>( - valueType, - StreamType.SSE_EVENT_DISCRIMINATED, - sseReader, - streamTerminator, - discriminatorProperty); - } - - @Override - public void close() throws IOException { - if (!isClosed) { - isClosed = true; - if (scanner != null) { - scanner.close(); - } - if (sseReader != null) { - sseReader.close(); - } - } - } - - private boolean isStreamClosed() { - return isClosed; - } - - /** - * 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() { - switch (streamType) { - case SSE: - return new SSEIterator(); - case SSE_EVENT_DISCRIMINATED: - return new SSEEventDiscriminatedIterator(); - case JSON: - default: - return new JsonIterator(); - } - } - - private final class JsonIterator implements 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() { - if (isStreamClosed()) { - return false; - } - 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 (isStreamClosed()) { - throw new NoSuchElementException("Stream is closed"); - } - - 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); - } - } - } - - @Override - public void remove() { - throw new UnsupportedOperationException(); - } - } - - private final class SSEIterator implements Iterator { - private Scanner sseScanner; - private T nextItem; - private boolean hasNextItem = false; - private boolean endOfStream = false; - private StringBuilder eventDataBuffer = new StringBuilder(); - private String currentEventType = null; - - private SSEIterator() { - if (sseReader != null && !isStreamClosed()) { - this.sseScanner = new Scanner(sseReader); - } else { - this.endOfStream = true; - } - } - - @Override - public boolean hasNext() { - if (isStreamClosed() || endOfStream) { - return false; - } - - if (hasNextItem) { - return true; - } - - return readNextMessage(); - } - - @Override - public T next() { - if (!hasNext()) { - throw new NoSuchElementException("No more elements in stream"); - } - - T result = nextItem; - nextItem = null; - hasNextItem = false; - return result; - } - - @Override - public void remove() { - throw new UnsupportedOperationException(); - } - - private boolean readNextMessage() { - if (sseScanner == null || isStreamClosed()) { - endOfStream = true; - return false; - } - - try { - while (sseScanner.hasNextLine()) { - String line = sseScanner.nextLine(); - - if (line.trim().isEmpty()) { - if (eventDataBuffer.length() > 0) { - try { - nextItem = - ObjectMappers.JSON_MAPPER.readValue(eventDataBuffer.toString(), valueType); - hasNextItem = true; - eventDataBuffer.setLength(0); - currentEventType = null; - return true; - } catch (Exception parseEx) { - System.err.println("Failed to parse SSE event: " + parseEx.getMessage()); - eventDataBuffer.setLength(0); - currentEventType = null; - continue; - } - } - continue; - } - - if (line.startsWith(DATA_PREFIX)) { - String dataContent = line.substring(DATA_PREFIX.length()); - if (dataContent.startsWith(" ")) { - dataContent = dataContent.substring(1); - } - - if (eventDataBuffer.length() == 0 - && streamTerminator != null - && dataContent.trim().equals(streamTerminator)) { - endOfStream = true; - return false; - } - - if (eventDataBuffer.length() > 0) { - eventDataBuffer.append('\n'); - } - eventDataBuffer.append(dataContent); - } else if (line.startsWith("event:")) { - String eventValue = line.length() > 6 ? line.substring(6) : ""; - if (eventValue.startsWith(" ")) { - eventValue = eventValue.substring(1); - } - currentEventType = eventValue; - } else if (line.startsWith("id:")) { - // Event ID field (ignored) - } else if (line.startsWith("retry:")) { - // Retry field (ignored) - } else if (line.startsWith(":")) { - // Comment line (ignored) - } - } - - if (eventDataBuffer.length() > 0) { - try { - nextItem = ObjectMappers.JSON_MAPPER.readValue(eventDataBuffer.toString(), valueType); - hasNextItem = true; - eventDataBuffer.setLength(0); - currentEventType = null; - return true; - } catch (Exception parseEx) { - System.err.println("Failed to parse final SSE event: " + parseEx.getMessage()); - eventDataBuffer.setLength(0); - currentEventType = null; - } - } - - endOfStream = true; - return false; - - } catch (Exception e) { - System.err.println("Failed to parse SSE stream: " + e.getMessage()); - endOfStream = true; - return false; - } - } - } - - /** - * Iterator for SSE streams with event-level discrimination. Uses SseEventParser to construct the - * full SSE envelope for Jackson deserialization. - */ - private final class SSEEventDiscriminatedIterator implements Iterator { - private Scanner sseScanner; - private T nextItem; - private boolean hasNextItem = false; - private boolean endOfStream = false; - private StringBuilder eventDataBuffer = new StringBuilder(); - private String currentEventType = null; - private String currentEventId = null; - private Long currentRetry = null; - - private SSEEventDiscriminatedIterator() { - if (sseReader != null && !isStreamClosed()) { - this.sseScanner = new Scanner(sseReader); - } else { - this.endOfStream = true; - } - } - - @Override - public boolean hasNext() { - if (isStreamClosed() || endOfStream) { - return false; - } - - if (hasNextItem) { - return true; - } - - return readNextMessage(); - } - - @Override - public T next() { - if (!hasNext()) { - throw new NoSuchElementException("No more elements in stream"); - } - - T result = nextItem; - nextItem = null; - hasNextItem = false; - return result; - } - - @Override - public void remove() { - throw new UnsupportedOperationException(); - } - - private boolean readNextMessage() { - if (sseScanner == null || isStreamClosed()) { - endOfStream = true; - return false; - } - - try { - while (sseScanner.hasNextLine()) { - String line = sseScanner.nextLine(); - - if (line.trim().isEmpty()) { - if (eventDataBuffer.length() > 0 || currentEventType != null) { - try { - // Use SseEventParser for event-level discrimination - nextItem = - SseEventParser.parseEventLevelUnion( - currentEventType, - eventDataBuffer.toString(), - currentEventId, - currentRetry, - valueType, - discriminatorProperty); - hasNextItem = true; - resetEventState(); - return true; - } catch (Exception parseEx) { - System.err.println("Failed to parse SSE event: " + parseEx.getMessage()); - resetEventState(); - continue; - } - } - continue; - } - - if (line.startsWith(DATA_PREFIX)) { - String dataContent = line.substring(DATA_PREFIX.length()); - if (dataContent.startsWith(" ")) { - dataContent = dataContent.substring(1); - } - - if (eventDataBuffer.length() == 0 - && streamTerminator != null - && dataContent.trim().equals(streamTerminator)) { - endOfStream = true; - return false; - } - - if (eventDataBuffer.length() > 0) { - eventDataBuffer.append('\n'); - } - eventDataBuffer.append(dataContent); - } else if (line.startsWith("event:")) { - String eventValue = line.length() > 6 ? line.substring(6) : ""; - if (eventValue.startsWith(" ")) { - eventValue = eventValue.substring(1); - } - currentEventType = eventValue; - } else if (line.startsWith("id:")) { - String idValue = line.length() > 3 ? line.substring(3) : ""; - if (idValue.startsWith(" ")) { - idValue = idValue.substring(1); - } - currentEventId = idValue; - } else if (line.startsWith("retry:")) { - String retryValue = line.length() > 6 ? line.substring(6) : ""; - if (retryValue.startsWith(" ")) { - retryValue = retryValue.substring(1); - } - try { - currentRetry = Long.parseLong(retryValue.trim()); - } catch (NumberFormatException e) { - // Ignore invalid retry values - } - } else if (line.startsWith(":")) { - // Comment line (ignored) - } - } - - // Handle any remaining buffered data at end of stream - if (eventDataBuffer.length() > 0 || currentEventType != null) { - try { - nextItem = - SseEventParser.parseEventLevelUnion( - currentEventType, - eventDataBuffer.toString(), - currentEventId, - currentRetry, - valueType, - discriminatorProperty); - hasNextItem = true; - resetEventState(); - return true; - } catch (Exception parseEx) { - System.err.println("Failed to parse final SSE event: " + parseEx.getMessage()); - resetEventState(); - } - } - - endOfStream = true; - return false; - - } catch (Exception e) { - System.err.println("Failed to parse SSE stream: " + e.getMessage()); - endOfStream = true; - return false; - } - } - - private void resetEventState() { - eventDataBuffer.setLength(0); - currentEventType = null; - currentEventId = null; - currentRetry = null; - } - } -} diff --git a/src/main/java/core/Suppliers.java b/src/main/java/core/Suppliers.java deleted file mode 100644 index bdacaf7..0000000 --- a/src/main/java/core/Suppliers.java +++ /dev/null @@ -1,21 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package 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/core/WebSocketFactory.java b/src/main/java/core/WebSocketFactory.java deleted file mode 100644 index 157d63c..0000000 --- a/src/main/java/core/WebSocketFactory.java +++ /dev/null @@ -1,21 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package core; - -import okhttp3.Request; -import okhttp3.WebSocket; -import okhttp3.WebSocketListener; - -/** - * Factory interface for creating WebSocket connections. Allows for pluggable WebSocket - * implementations and testing. - */ -public interface WebSocketFactory { - /** - * Creates a WebSocket connection with the specified request and listener. - * - * @param request The WebSocket connection request with URL and headers - * @param listener The listener for WebSocket events - * @return A WebSocket instance ready for communication - */ - WebSocket create(Request request, WebSocketListener listener); -} diff --git a/src/main/java/core/WebSocketReadyState.java b/src/main/java/core/WebSocketReadyState.java deleted file mode 100644 index c732748..0000000 --- a/src/main/java/core/WebSocketReadyState.java +++ /dev/null @@ -1,17 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package core; - -/** WebSocket connection ready state, based on the W3C WebSocket API. */ -public enum WebSocketReadyState { - /** The connection is being established. */ - CONNECTING, - - /** The connection is open and ready to communicate. */ - OPEN, - - /** The connection is in the process of closing. */ - CLOSING, - - /** The connection is closed. */ - CLOSED -} diff --git a/src/main/java/core/WrappedAlias.java b/src/main/java/core/WrappedAlias.java deleted file mode 100644 index 58b9eed..0000000 --- a/src/main/java/core/WrappedAlias.java +++ /dev/null @@ -1,6 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package core; - -public interface WrappedAlias { - Object get(); -} diff --git a/src/main/java/errors/BadRequestError.java b/src/main/java/errors/BadRequestError.java deleted file mode 100644 index cb30c72..0000000 --- a/src/main/java/errors/BadRequestError.java +++ /dev/null @@ -1,28 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package errors; - -import core.DeepgramApiApiException; -import okhttp3.Response; - -public final class BadRequestError extends DeepgramApiApiException { - /** The body of the response that triggered the exception. */ - private final Object body; - - public BadRequestError(Object body) { - super("BadRequestError", 400, body); - this.body = body; - } - - public BadRequestError(Object body, Response rawResponse) { - super("BadRequestError", 400, body, rawResponse); - this.body = body; - } - - /** - * @return the body - */ - @java.lang.Override - public Object body() { - return this.body; - } -} diff --git a/src/main/java/resources/agent/AgentClient.java b/src/main/java/resources/agent/AgentClient.java deleted file mode 100644 index 2063a85..0000000 --- a/src/main/java/resources/agent/AgentClient.java +++ /dev/null @@ -1,22 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent; - -import core.ClientOptions; -import core.Suppliers; -import java.util.function.Supplier; -import resources.agent.v1.V1Client; - -public class AgentClient { - protected final ClientOptions clientOptions; - - protected final Supplier v1Client; - - public AgentClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.v1Client = Suppliers.memoize(() -> new V1Client(clientOptions)); - } - - public V1Client v1() { - return this.v1Client.get(); - } -} diff --git a/src/main/java/resources/agent/AsyncAgentClient.java b/src/main/java/resources/agent/AsyncAgentClient.java deleted file mode 100644 index 1b3dd61..0000000 --- a/src/main/java/resources/agent/AsyncAgentClient.java +++ /dev/null @@ -1,22 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent; - -import core.ClientOptions; -import core.Suppliers; -import java.util.function.Supplier; -import resources.agent.v1.AsyncV1Client; - -public class AsyncAgentClient { - protected final ClientOptions clientOptions; - - protected final Supplier v1Client; - - public AsyncAgentClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.v1Client = Suppliers.memoize(() -> new AsyncV1Client(clientOptions)); - } - - public AsyncV1Client v1() { - return this.v1Client.get(); - } -} diff --git a/src/main/java/resources/agent/v1/AsyncV1Client.java b/src/main/java/resources/agent/v1/AsyncV1Client.java deleted file mode 100644 index 6f8ff48..0000000 --- a/src/main/java/resources/agent/v1/AsyncV1Client.java +++ /dev/null @@ -1,28 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1; - -import core.ClientOptions; -import core.Suppliers; -import java.util.function.Supplier; -import resources.agent.v1.settings.AsyncSettingsClient; -import resources.agent.v1.websocket.V1WebSocketClient; - -public class AsyncV1Client { - protected final ClientOptions clientOptions; - - protected final Supplier settingsClient; - - public AsyncV1Client(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.settingsClient = Suppliers.memoize(() -> new AsyncSettingsClient(clientOptions)); - } - - /** Creates a new WebSocket client for the v1 channel. */ - public V1WebSocketClient v1WebSocket() { - return new V1WebSocketClient(clientOptions); - } - - public AsyncSettingsClient settings() { - return this.settingsClient.get(); - } -} diff --git a/src/main/java/resources/agent/v1/V1Client.java b/src/main/java/resources/agent/v1/V1Client.java deleted file mode 100644 index 878a821..0000000 --- a/src/main/java/resources/agent/v1/V1Client.java +++ /dev/null @@ -1,28 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1; - -import core.ClientOptions; -import core.Suppliers; -import java.util.function.Supplier; -import resources.agent.v1.settings.SettingsClient; -import resources.agent.v1.websocket.V1WebSocketClient; - -public class V1Client { - protected final ClientOptions clientOptions; - - protected final Supplier settingsClient; - - public V1Client(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.settingsClient = Suppliers.memoize(() -> new SettingsClient(clientOptions)); - } - - /** Creates a new WebSocket client for the v1 channel. */ - public V1WebSocketClient v1WebSocket() { - return new V1WebSocketClient(clientOptions); - } - - public SettingsClient settings() { - return this.settingsClient.get(); - } -} diff --git a/src/main/java/resources/agent/v1/settings/AsyncSettingsClient.java b/src/main/java/resources/agent/v1/settings/AsyncSettingsClient.java deleted file mode 100644 index 46868ce..0000000 --- a/src/main/java/resources/agent/v1/settings/AsyncSettingsClient.java +++ /dev/null @@ -1,22 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.settings; - -import core.ClientOptions; -import core.Suppliers; -import java.util.function.Supplier; -import resources.agent.v1.settings.think.AsyncThinkClient; - -public class AsyncSettingsClient { - protected final ClientOptions clientOptions; - - protected final Supplier thinkClient; - - public AsyncSettingsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.thinkClient = Suppliers.memoize(() -> new AsyncThinkClient(clientOptions)); - } - - public AsyncThinkClient think() { - return this.thinkClient.get(); - } -} diff --git a/src/main/java/resources/agent/v1/settings/SettingsClient.java b/src/main/java/resources/agent/v1/settings/SettingsClient.java deleted file mode 100644 index d352782..0000000 --- a/src/main/java/resources/agent/v1/settings/SettingsClient.java +++ /dev/null @@ -1,22 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.settings; - -import core.ClientOptions; -import core.Suppliers; -import java.util.function.Supplier; -import resources.agent.v1.settings.think.ThinkClient; - -public class SettingsClient { - protected final ClientOptions clientOptions; - - protected final Supplier thinkClient; - - public SettingsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.thinkClient = Suppliers.memoize(() -> new ThinkClient(clientOptions)); - } - - public ThinkClient think() { - return this.thinkClient.get(); - } -} diff --git a/src/main/java/resources/agent/v1/settings/think/AsyncThinkClient.java b/src/main/java/resources/agent/v1/settings/think/AsyncThinkClient.java deleted file mode 100644 index ebab206..0000000 --- a/src/main/java/resources/agent/v1/settings/think/AsyncThinkClient.java +++ /dev/null @@ -1,22 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.settings.think; - -import core.ClientOptions; -import core.Suppliers; -import java.util.function.Supplier; -import resources.agent.v1.settings.think.models.AsyncModelsClient; - -public class AsyncThinkClient { - protected final ClientOptions clientOptions; - - protected final Supplier modelsClient; - - public AsyncThinkClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.modelsClient = Suppliers.memoize(() -> new AsyncModelsClient(clientOptions)); - } - - public AsyncModelsClient models() { - return this.modelsClient.get(); - } -} diff --git a/src/main/java/resources/agent/v1/settings/think/ThinkClient.java b/src/main/java/resources/agent/v1/settings/think/ThinkClient.java deleted file mode 100644 index 2b8acfd..0000000 --- a/src/main/java/resources/agent/v1/settings/think/ThinkClient.java +++ /dev/null @@ -1,22 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.settings.think; - -import core.ClientOptions; -import core.Suppliers; -import java.util.function.Supplier; -import resources.agent.v1.settings.think.models.ModelsClient; - -public class ThinkClient { - protected final ClientOptions clientOptions; - - protected final Supplier modelsClient; - - public ThinkClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.modelsClient = Suppliers.memoize(() -> new ModelsClient(clientOptions)); - } - - public ModelsClient models() { - return this.modelsClient.get(); - } -} diff --git a/src/main/java/resources/agent/v1/settings/think/models/AsyncModelsClient.java b/src/main/java/resources/agent/v1/settings/think/models/AsyncModelsClient.java deleted file mode 100644 index 724d5b7..0000000 --- a/src/main/java/resources/agent/v1/settings/think/models/AsyncModelsClient.java +++ /dev/null @@ -1,33 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.settings.think.models; - -import core.ClientOptions; -import core.RequestOptions; -import java.util.concurrent.CompletableFuture; -import types.AgentThinkModelsV1Response; - -public class AsyncModelsClient { - protected final ClientOptions clientOptions; - - private final AsyncRawModelsClient rawClient; - - public AsyncModelsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new AsyncRawModelsClient(clientOptions); - } - - /** Get responses with HTTP metadata like headers */ - public AsyncRawModelsClient withRawResponse() { - return this.rawClient; - } - - /** Retrieves the available think models that can be used for AI agent processing */ - public CompletableFuture list() { - return this.rawClient.list().thenApply(response -> response.body()); - } - - /** Retrieves the available think models that can be used for AI agent processing */ - public CompletableFuture list(RequestOptions requestOptions) { - return this.rawClient.list(requestOptions).thenApply(response -> response.body()); - } -} diff --git a/src/main/java/resources/agent/v1/settings/think/models/AsyncRawModelsClient.java b/src/main/java/resources/agent/v1/settings/think/models/AsyncRawModelsClient.java deleted file mode 100644 index d2508d9..0000000 --- a/src/main/java/resources/agent/v1/settings/think/models/AsyncRawModelsClient.java +++ /dev/null @@ -1,115 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.settings.think.models; - -import com.fasterxml.jackson.core.JsonProcessingException; -import core.ClientOptions; -import core.DeepgramApiApiException; -import core.DeepgramApiException; -import core.DeepgramApiHttpResponse; -import core.ObjectMappers; -import core.RequestOptions; -import errors.BadRequestError; -import java.io.IOException; -import java.util.concurrent.CompletableFuture; -import okhttp3.Call; -import okhttp3.Callback; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import okhttp3.ResponseBody; -import org.jetbrains.annotations.NotNull; -import types.AgentThinkModelsV1Response; - -public class AsyncRawModelsClient { - protected final ClientOptions clientOptions; - - public AsyncRawModelsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** Retrieves the available think models that can be used for AI agent processing */ - public CompletableFuture> list() { - return list(null); - } - - /** Retrieves the available think models that can be used for AI agent processing */ - public CompletableFuture> list( - RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/agent/settings/think/models"); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = - new CompletableFuture<>(); - client - .newCall(okhttpRequest) - .enqueue( - new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) - throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete( - new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, AgentThinkModelsV1Response.class), - response)); - return; - } - try { - if (response.code() == 400) { - future.completeExceptionally( - new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally( - new DeepgramApiApiException( - "Error with status code " + response.code(), - response.code(), - errorBody, - response)); - return; - } catch (IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - }); - return future; - } -} diff --git a/src/main/java/resources/agent/v1/settings/think/models/ModelsClient.java b/src/main/java/resources/agent/v1/settings/think/models/ModelsClient.java deleted file mode 100644 index 5f17201..0000000 --- a/src/main/java/resources/agent/v1/settings/think/models/ModelsClient.java +++ /dev/null @@ -1,32 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.settings.think.models; - -import core.ClientOptions; -import core.RequestOptions; -import types.AgentThinkModelsV1Response; - -public class ModelsClient { - protected final ClientOptions clientOptions; - - private final RawModelsClient rawClient; - - public ModelsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new RawModelsClient(clientOptions); - } - - /** Get responses with HTTP metadata like headers */ - public RawModelsClient withRawResponse() { - return this.rawClient; - } - - /** Retrieves the available think models that can be used for AI agent processing */ - public AgentThinkModelsV1Response list() { - return this.rawClient.list().body(); - } - - /** Retrieves the available think models that can be used for AI agent processing */ - public AgentThinkModelsV1Response list(RequestOptions requestOptions) { - return this.rawClient.list(requestOptions).body(); - } -} diff --git a/src/main/java/resources/agent/v1/settings/think/models/RawModelsClient.java b/src/main/java/resources/agent/v1/settings/think/models/RawModelsClient.java deleted file mode 100644 index 9c85e44..0000000 --- a/src/main/java/resources/agent/v1/settings/think/models/RawModelsClient.java +++ /dev/null @@ -1,82 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.settings.think.models; - -import com.fasterxml.jackson.core.JsonProcessingException; -import core.ClientOptions; -import core.DeepgramApiApiException; -import core.DeepgramApiException; -import core.DeepgramApiHttpResponse; -import core.ObjectMappers; -import core.RequestOptions; -import errors.BadRequestError; -import java.io.IOException; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import okhttp3.ResponseBody; -import types.AgentThinkModelsV1Response; - -public class RawModelsClient { - protected final ClientOptions clientOptions; - - public RawModelsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** Retrieves the available think models that can be used for AI agent processing */ - public DeepgramApiHttpResponse list() { - return list(null); - } - - /** Retrieves the available think models that can be used for AI agent processing */ - public DeepgramApiHttpResponse list(RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/agent/settings/think/models"); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "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(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, AgentThinkModelsV1Response.class), - response); - } - try { - if (response.code() == 400) { - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new DeepgramApiApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (IOException e) { - throw new DeepgramApiException("Network error executing HTTP request", e); - } - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1AgentAudioDone.java b/src/main/java/resources/agent/v1/types/AgentV1AgentAudioDone.java deleted file mode 100644 index 0c7d41b..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1AgentAudioDone.java +++ /dev/null @@ -1,75 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import core.ObjectMappers; -import java.util.HashMap; -import java.util.Map; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = AgentV1AgentAudioDone.Builder.class) -public final class AgentV1AgentAudioDone { - private final Map additionalProperties; - - private AgentV1AgentAudioDone(Map additionalProperties) { - this.additionalProperties = additionalProperties; - } - - /** - * @return Message type identifier indicating the agent has finished sending audio - */ - @JsonProperty("type") - public String getType() { - return "AgentAudioDone"; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AgentV1AgentAudioDone; - } - - @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(AgentV1AgentAudioDone other) { - return this; - } - - public AgentV1AgentAudioDone build() { - return new AgentV1AgentAudioDone(additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1AgentStartedSpeaking.java b/src/main/java/resources/agent/v1/types/AgentV1AgentStartedSpeaking.java deleted file mode 100644 index cedb303..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1AgentStartedSpeaking.java +++ /dev/null @@ -1,208 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 core.ObjectMappers; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = AgentV1AgentStartedSpeaking.Builder.class) -public final class AgentV1AgentStartedSpeaking { - private final float totalLatency; - - private final float ttsLatency; - - private final float tttLatency; - - private final Map additionalProperties; - - private AgentV1AgentStartedSpeaking( - float totalLatency, - float ttsLatency, - float tttLatency, - Map additionalProperties) { - this.totalLatency = totalLatency; - this.ttsLatency = ttsLatency; - this.tttLatency = tttLatency; - this.additionalProperties = additionalProperties; - } - - /** - * @return Message type identifier for agent started speaking - */ - @JsonProperty("type") - public String getType() { - return "AgentStartedSpeaking"; - } - - /** - * @return Seconds from receiving the user's utterance to producing the agent's reply - */ - @JsonProperty("total_latency") - public float getTotalLatency() { - return totalLatency; - } - - /** - * @return The portion of total latency attributable to text-to-speech - */ - @JsonProperty("tts_latency") - public float getTtsLatency() { - return ttsLatency; - } - - /** - * @return The portion of total latency attributable to text-to-text (usually an LLM) - */ - @JsonProperty("ttt_latency") - public float getTttLatency() { - return tttLatency; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AgentV1AgentStartedSpeaking - && equalTo((AgentV1AgentStartedSpeaking) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(AgentV1AgentStartedSpeaking other) { - return totalLatency == other.totalLatency - && ttsLatency == other.ttsLatency - && tttLatency == other.tttLatency; - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.totalLatency, this.ttsLatency, this.tttLatency); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static TotalLatencyStage builder() { - return new Builder(); - } - - public interface TotalLatencyStage { - /** Seconds from receiving the user's utterance to producing the agent's reply */ - TtsLatencyStage totalLatency(float totalLatency); - - Builder from(AgentV1AgentStartedSpeaking other); - } - - public interface TtsLatencyStage { - /** The portion of total latency attributable to text-to-speech */ - TttLatencyStage ttsLatency(float ttsLatency); - } - - public interface TttLatencyStage { - /** The portion of total latency attributable to text-to-text (usually an LLM) */ - _FinalStage tttLatency(float tttLatency); - } - - public interface _FinalStage { - AgentV1AgentStartedSpeaking build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements TotalLatencyStage, TtsLatencyStage, TttLatencyStage, _FinalStage { - private float totalLatency; - - private float ttsLatency; - - private float tttLatency; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(AgentV1AgentStartedSpeaking other) { - totalLatency(other.getTotalLatency()); - ttsLatency(other.getTtsLatency()); - tttLatency(other.getTttLatency()); - return this; - } - - /** - * Seconds from receiving the user's utterance to producing the agent's reply - * - *

Seconds from receiving the user's utterance to producing the agent's reply - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("total_latency") - public TtsLatencyStage totalLatency(float totalLatency) { - this.totalLatency = totalLatency; - return this; - } - - /** - * The portion of total latency attributable to text-to-speech - * - *

The portion of total latency attributable to text-to-speech - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("tts_latency") - public TttLatencyStage ttsLatency(float ttsLatency) { - this.ttsLatency = ttsLatency; - return this; - } - - /** - * The portion of total latency attributable to text-to-text (usually an LLM) - * - *

The portion of total latency attributable to text-to-text (usually an LLM) - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("ttt_latency") - public _FinalStage tttLatency(float tttLatency) { - this.tttLatency = tttLatency; - return this; - } - - @java.lang.Override - public AgentV1AgentStartedSpeaking build() { - return new AgentV1AgentStartedSpeaking( - totalLatency, ttsLatency, tttLatency, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1AgentThinking.java b/src/main/java/resources/agent/v1/types/AgentV1AgentThinking.java deleted file mode 100644 index 84a92de..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1AgentThinking.java +++ /dev/null @@ -1,134 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = AgentV1AgentThinking.Builder.class) -public final class AgentV1AgentThinking { - private final String content; - - private final Map additionalProperties; - - private AgentV1AgentThinking(String content, Map additionalProperties) { - this.content = content; - this.additionalProperties = additionalProperties; - } - - /** - * @return Message type identifier for agent thinking - */ - @JsonProperty("type") - public String getType() { - return "AgentThinking"; - } - - /** - * @return The text of the agent's thought process - */ - @JsonProperty("content") - public String getContent() { - return content; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AgentV1AgentThinking && equalTo((AgentV1AgentThinking) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(AgentV1AgentThinking other) { - return content.equals(other.content); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.content); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static ContentStage builder() { - return new Builder(); - } - - public interface ContentStage { - /** The text of the agent's thought process */ - _FinalStage content(@NotNull String content); - - Builder from(AgentV1AgentThinking other); - } - - public interface _FinalStage { - AgentV1AgentThinking build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements ContentStage, _FinalStage { - private String content; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(AgentV1AgentThinking other) { - content(other.getContent()); - return this; - } - - /** - * The text of the agent's thought process - * - *

The text of the agent's thought process - * - * @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; - } - - @java.lang.Override - public AgentV1AgentThinking build() { - return new AgentV1AgentThinking(content, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1ConversationText.java b/src/main/java/resources/agent/v1/types/AgentV1ConversationText.java deleted file mode 100644 index 597a9f9..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1ConversationText.java +++ /dev/null @@ -1,168 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = AgentV1ConversationText.Builder.class) -public final class AgentV1ConversationText { - private final AgentV1ConversationTextRole role; - - private final String content; - - private final Map additionalProperties; - - private AgentV1ConversationText( - AgentV1ConversationTextRole role, String content, Map additionalProperties) { - this.role = role; - this.content = content; - this.additionalProperties = additionalProperties; - } - - /** - * @return Message type identifier for conversation text - */ - @JsonProperty("type") - public String getType() { - return "ConversationText"; - } - - /** - * @return Identifies who spoke the statement - */ - @JsonProperty("role") - public AgentV1ConversationTextRole getRole() { - return role; - } - - /** - * @return The actual statement that was spoken - */ - @JsonProperty("content") - public String getContent() { - return content; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AgentV1ConversationText && equalTo((AgentV1ConversationText) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(AgentV1ConversationText other) { - return role.equals(other.role) && content.equals(other.content); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.role, this.content); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static RoleStage builder() { - return new Builder(); - } - - public interface RoleStage { - /** Identifies who spoke the statement */ - ContentStage role(@NotNull AgentV1ConversationTextRole role); - - Builder from(AgentV1ConversationText other); - } - - public interface ContentStage { - /** The actual statement that was spoken */ - _FinalStage content(@NotNull String content); - } - - public interface _FinalStage { - AgentV1ConversationText build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements RoleStage, ContentStage, _FinalStage { - private AgentV1ConversationTextRole role; - - private String content; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(AgentV1ConversationText other) { - role(other.getRole()); - content(other.getContent()); - return this; - } - - /** - * Identifies who spoke the statement - * - *

Identifies who spoke the statement - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("role") - public ContentStage role(@NotNull AgentV1ConversationTextRole role) { - this.role = Objects.requireNonNull(role, "role must not be null"); - return this; - } - - /** - * The actual statement that was spoken - * - *

The actual statement that was spoken - * - * @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; - } - - @java.lang.Override - public AgentV1ConversationText build() { - return new AgentV1ConversationText(role, content, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1ConversationTextRole.java b/src/main/java/resources/agent/v1/types/AgentV1ConversationTextRole.java deleted file mode 100644 index fae9f92..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1ConversationTextRole.java +++ /dev/null @@ -1,84 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class AgentV1ConversationTextRole { - public static final AgentV1ConversationTextRole ASSISTANT = - new AgentV1ConversationTextRole(Value.ASSISTANT, "assistant"); - - public static final AgentV1ConversationTextRole USER = - new AgentV1ConversationTextRole(Value.USER, "user"); - - private final Value value; - - private final String string; - - AgentV1ConversationTextRole(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof AgentV1ConversationTextRole - && this.string.equals(((AgentV1ConversationTextRole) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case ASSISTANT: - return visitor.visitAssistant(); - case USER: - return visitor.visitUser(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static AgentV1ConversationTextRole valueOf(String value) { - switch (value) { - case "assistant": - return ASSISTANT; - case "user": - return USER; - default: - return new AgentV1ConversationTextRole(Value.UNKNOWN, value); - } - } - - public enum Value { - USER, - - ASSISTANT, - - UNKNOWN - } - - public interface Visitor { - T visitUser(); - - T visitAssistant(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1Error.java b/src/main/java/resources/agent/v1/types/AgentV1Error.java deleted file mode 100644 index 81c767a..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1Error.java +++ /dev/null @@ -1,167 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = AgentV1Error.Builder.class) -public final class AgentV1Error { - private final String description; - - private final String code; - - private final Map additionalProperties; - - private AgentV1Error(String description, String code, Map additionalProperties) { - this.description = description; - this.code = code; - this.additionalProperties = additionalProperties; - } - - /** - * @return Message type identifier for error responses - */ - @JsonProperty("type") - public String getType() { - return "Error"; - } - - /** - * @return A description of what went wrong - */ - @JsonProperty("description") - public String getDescription() { - return description; - } - - /** - * @return Error code identifying the type of error - */ - @JsonProperty("code") - public String getCode() { - return code; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AgentV1Error && equalTo((AgentV1Error) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(AgentV1Error other) { - return description.equals(other.description) && code.equals(other.code); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.description, this.code); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static DescriptionStage builder() { - return new Builder(); - } - - public interface DescriptionStage { - /** A description of what went wrong */ - CodeStage description(@NotNull String description); - - Builder from(AgentV1Error other); - } - - public interface CodeStage { - /** Error code identifying the type of error */ - _FinalStage code(@NotNull String code); - } - - public interface _FinalStage { - AgentV1Error build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements DescriptionStage, CodeStage, _FinalStage { - private String description; - - private String code; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(AgentV1Error other) { - description(other.getDescription()); - code(other.getCode()); - return this; - } - - /** - * A description of what went wrong - * - *

A description of what went wrong - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("description") - public CodeStage description(@NotNull String description) { - this.description = Objects.requireNonNull(description, "description must not be null"); - return this; - } - - /** - * Error code identifying the type of error - * - *

Error code identifying the type of error - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("code") - public _FinalStage code(@NotNull String code) { - this.code = Objects.requireNonNull(code, "code must not be null"); - return this; - } - - @java.lang.Override - public AgentV1Error build() { - return new AgentV1Error(description, code, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1FunctionCallRequest.java b/src/main/java/resources/agent/v1/types/AgentV1FunctionCallRequest.java deleted file mode 100644 index 79360a5..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1FunctionCallRequest.java +++ /dev/null @@ -1,128 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = AgentV1FunctionCallRequest.Builder.class) -public final class AgentV1FunctionCallRequest { - private final List functions; - - private final Map additionalProperties; - - private AgentV1FunctionCallRequest( - List functions, - Map additionalProperties) { - this.functions = functions; - this.additionalProperties = additionalProperties; - } - - /** - * @return Message type identifier for function call requests - */ - @JsonProperty("type") - public String getType() { - return "FunctionCallRequest"; - } - - /** - * @return Array of functions to be called - */ - @JsonProperty("functions") - public List getFunctions() { - return functions; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AgentV1FunctionCallRequest - && equalTo((AgentV1FunctionCallRequest) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(AgentV1FunctionCallRequest other) { - return functions.equals(other.functions); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.functions); - } - - @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 functions = new ArrayList<>(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(AgentV1FunctionCallRequest other) { - functions(other.getFunctions()); - return this; - } - - /** Array of functions to be called */ - @JsonSetter(value = "functions", nulls = Nulls.SKIP) - public Builder functions(List functions) { - this.functions.clear(); - if (functions != null) { - this.functions.addAll(functions); - } - return this; - } - - public Builder addFunctions(AgentV1FunctionCallRequestFunctionsItem functions) { - this.functions.add(functions); - return this; - } - - public Builder addAllFunctions(List functions) { - if (functions != null) { - this.functions.addAll(functions); - } - return this; - } - - public AgentV1FunctionCallRequest build() { - return new AgentV1FunctionCallRequest(functions, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1FunctionCallRequestFunctionsItem.java b/src/main/java/resources/agent/v1/types/AgentV1FunctionCallRequestFunctionsItem.java deleted file mode 100644 index ae5e1f0..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1FunctionCallRequestFunctionsItem.java +++ /dev/null @@ -1,236 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = AgentV1FunctionCallRequestFunctionsItem.Builder.class) -public final class AgentV1FunctionCallRequestFunctionsItem { - private final String id; - - private final String name; - - private final String arguments; - - private final boolean clientSide; - - private final Map additionalProperties; - - private AgentV1FunctionCallRequestFunctionsItem( - String id, - String name, - String arguments, - boolean clientSide, - Map additionalProperties) { - this.id = id; - this.name = name; - this.arguments = arguments; - this.clientSide = clientSide; - this.additionalProperties = additionalProperties; - } - - /** - * @return Unique identifier for the function call - */ - @JsonProperty("id") - public String getId() { - return id; - } - - /** - * @return The name of the function to call - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * @return JSON string containing the function arguments - */ - @JsonProperty("arguments") - public String getArguments() { - return arguments; - } - - /** - * @return Whether the function should be executed client-side - */ - @JsonProperty("client_side") - public boolean getClientSide() { - return clientSide; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AgentV1FunctionCallRequestFunctionsItem - && equalTo((AgentV1FunctionCallRequestFunctionsItem) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(AgentV1FunctionCallRequestFunctionsItem other) { - return id.equals(other.id) - && name.equals(other.name) - && arguments.equals(other.arguments) - && clientSide == other.clientSide; - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.id, this.name, this.arguments, this.clientSide); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - /** Unique identifier for the function call */ - NameStage id(@NotNull String id); - - Builder from(AgentV1FunctionCallRequestFunctionsItem other); - } - - public interface NameStage { - /** The name of the function to call */ - ArgumentsStage name(@NotNull String name); - } - - public interface ArgumentsStage { - /** JSON string containing the function arguments */ - ClientSideStage arguments(@NotNull String arguments); - } - - public interface ClientSideStage { - /** Whether the function should be executed client-side */ - _FinalStage clientSide(boolean clientSide); - } - - public interface _FinalStage { - AgentV1FunctionCallRequestFunctionsItem build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements IdStage, NameStage, ArgumentsStage, ClientSideStage, _FinalStage { - private String id; - - private String name; - - private String arguments; - - private boolean clientSide; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(AgentV1FunctionCallRequestFunctionsItem other) { - id(other.getId()); - name(other.getName()); - arguments(other.getArguments()); - clientSide(other.getClientSide()); - return this; - } - - /** - * Unique identifier for the function call - * - *

Unique identifier for the function call - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("id") - public NameStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - /** - * The name of the function to call - * - *

The name of the function to call - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("name") - public ArgumentsStage name(@NotNull String name) { - this.name = Objects.requireNonNull(name, "name must not be null"); - return this; - } - - /** - * JSON string containing the function arguments - * - *

JSON string containing the function arguments - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("arguments") - public ClientSideStage arguments(@NotNull String arguments) { - this.arguments = Objects.requireNonNull(arguments, "arguments must not be null"); - return this; - } - - /** - * Whether the function should be executed client-side - * - *

Whether the function should be executed client-side - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("client_side") - public _FinalStage clientSide(boolean clientSide) { - this.clientSide = clientSide; - return this; - } - - @java.lang.Override - public AgentV1FunctionCallRequestFunctionsItem build() { - return new AgentV1FunctionCallRequestFunctionsItem( - id, name, arguments, clientSide, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1InjectAgentMessage.java b/src/main/java/resources/agent/v1/types/AgentV1InjectAgentMessage.java deleted file mode 100644 index 80f87a0..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1InjectAgentMessage.java +++ /dev/null @@ -1,134 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = AgentV1InjectAgentMessage.Builder.class) -public final class AgentV1InjectAgentMessage { - private final String message; - - private final Map additionalProperties; - - private AgentV1InjectAgentMessage(String message, Map additionalProperties) { - this.message = message; - this.additionalProperties = additionalProperties; - } - - /** - * @return Message type identifier for injecting an agent message - */ - @JsonProperty("type") - public String getType() { - return "InjectAgentMessage"; - } - - /** - * @return The statement that the agent should say - */ - @JsonProperty("message") - public String getMessage() { - return message; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AgentV1InjectAgentMessage && equalTo((AgentV1InjectAgentMessage) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(AgentV1InjectAgentMessage 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 { - /** The statement that the agent should say */ - _FinalStage message(@NotNull String message); - - Builder from(AgentV1InjectAgentMessage other); - } - - public interface _FinalStage { - AgentV1InjectAgentMessage build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @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(AgentV1InjectAgentMessage other) { - message(other.getMessage()); - return this; - } - - /** - * The statement that the agent should say - * - *

The statement that the agent should say - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @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 AgentV1InjectAgentMessage build() { - return new AgentV1InjectAgentMessage(message, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1InjectUserMessage.java b/src/main/java/resources/agent/v1/types/AgentV1InjectUserMessage.java deleted file mode 100644 index 0495966..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1InjectUserMessage.java +++ /dev/null @@ -1,134 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = AgentV1InjectUserMessage.Builder.class) -public final class AgentV1InjectUserMessage { - private final String content; - - private final Map additionalProperties; - - private AgentV1InjectUserMessage(String content, Map additionalProperties) { - this.content = content; - this.additionalProperties = additionalProperties; - } - - /** - * @return Message type identifier for injecting a user message - */ - @JsonProperty("type") - public String getType() { - return "InjectUserMessage"; - } - - /** - * @return The specific phrase or statement the agent should respond to - */ - @JsonProperty("content") - public String getContent() { - return content; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AgentV1InjectUserMessage && equalTo((AgentV1InjectUserMessage) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(AgentV1InjectUserMessage other) { - return content.equals(other.content); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.content); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static ContentStage builder() { - return new Builder(); - } - - public interface ContentStage { - /** The specific phrase or statement the agent should respond to */ - _FinalStage content(@NotNull String content); - - Builder from(AgentV1InjectUserMessage other); - } - - public interface _FinalStage { - AgentV1InjectUserMessage build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements ContentStage, _FinalStage { - private String content; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(AgentV1InjectUserMessage other) { - content(other.getContent()); - return this; - } - - /** - * The specific phrase or statement the agent should respond to - * - *

The specific phrase or statement the agent should respond to - * - * @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; - } - - @java.lang.Override - public AgentV1InjectUserMessage build() { - return new AgentV1InjectUserMessage(content, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1InjectionRefused.java b/src/main/java/resources/agent/v1/types/AgentV1InjectionRefused.java deleted file mode 100644 index 881e64e..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1InjectionRefused.java +++ /dev/null @@ -1,134 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = AgentV1InjectionRefused.Builder.class) -public final class AgentV1InjectionRefused { - private final String message; - - private final Map additionalProperties; - - private AgentV1InjectionRefused(String message, Map additionalProperties) { - this.message = message; - this.additionalProperties = additionalProperties; - } - - /** - * @return Message type identifier for injection refused - */ - @JsonProperty("type") - public String getType() { - return "InjectionRefused"; - } - - /** - * @return Details about why the injection was refused - */ - @JsonProperty("message") - public String getMessage() { - return message; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AgentV1InjectionRefused && equalTo((AgentV1InjectionRefused) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(AgentV1InjectionRefused 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 { - /** Details about why the injection was refused */ - _FinalStage message(@NotNull String message); - - Builder from(AgentV1InjectionRefused other); - } - - public interface _FinalStage { - AgentV1InjectionRefused build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @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(AgentV1InjectionRefused other) { - message(other.getMessage()); - return this; - } - - /** - * Details about why the injection was refused - * - *

Details about why the injection was refused - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @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 AgentV1InjectionRefused build() { - return new AgentV1InjectionRefused(message, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1KeepAlive.java b/src/main/java/resources/agent/v1/types/AgentV1KeepAlive.java deleted file mode 100644 index b010cd5..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1KeepAlive.java +++ /dev/null @@ -1,75 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import core.ObjectMappers; -import java.util.HashMap; -import java.util.Map; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = AgentV1KeepAlive.Builder.class) -public final class AgentV1KeepAlive { - private final Map additionalProperties; - - private AgentV1KeepAlive(Map additionalProperties) { - this.additionalProperties = additionalProperties; - } - - /** - * @return Message type identifier - */ - @JsonProperty("type") - public String getType() { - return "KeepAlive"; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AgentV1KeepAlive; - } - - @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(AgentV1KeepAlive other) { - return this; - } - - public AgentV1KeepAlive build() { - return new AgentV1KeepAlive(additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1PromptUpdated.java b/src/main/java/resources/agent/v1/types/AgentV1PromptUpdated.java deleted file mode 100644 index b9b71a8..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1PromptUpdated.java +++ /dev/null @@ -1,75 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import core.ObjectMappers; -import java.util.HashMap; -import java.util.Map; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = AgentV1PromptUpdated.Builder.class) -public final class AgentV1PromptUpdated { - private final Map additionalProperties; - - private AgentV1PromptUpdated(Map additionalProperties) { - this.additionalProperties = additionalProperties; - } - - /** - * @return Message type identifier for prompt update confirmation - */ - @JsonProperty("type") - public String getType() { - return "PromptUpdated"; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AgentV1PromptUpdated; - } - - @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(AgentV1PromptUpdated other) { - return this; - } - - public AgentV1PromptUpdated build() { - return new AgentV1PromptUpdated(additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1ReceiveFunctionCallResponse.java b/src/main/java/resources/agent/v1/types/AgentV1ReceiveFunctionCallResponse.java deleted file mode 100644 index e3924aa..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1ReceiveFunctionCallResponse.java +++ /dev/null @@ -1,228 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = AgentV1ReceiveFunctionCallResponse.Builder.class) -public final class AgentV1ReceiveFunctionCallResponse { - private final Optional id; - - private final String name; - - private final String content; - - private final Map additionalProperties; - - private AgentV1ReceiveFunctionCallResponse( - Optional id, String name, String content, Map additionalProperties) { - this.id = id; - this.name = name; - this.content = content; - this.additionalProperties = additionalProperties; - } - - /** - * @return Message type identifier for function call responses - */ - @JsonProperty("type") - public String getType() { - return "FunctionCallResponse"; - } - - /** - * @return The unique identifier for the function call. - *

Required for client responses: Should match the id from the - * corresponding FunctionCallRequestOptional for server - * responses: Server may omit when responding to internal function executions - */ - @JsonProperty("id") - public Optional getId() { - return id; - } - - /** - * @return The name of the function being called - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * @return The content or result of the function call - */ - @JsonProperty("content") - public String getContent() { - return content; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AgentV1ReceiveFunctionCallResponse - && equalTo((AgentV1ReceiveFunctionCallResponse) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(AgentV1ReceiveFunctionCallResponse other) { - return id.equals(other.id) && name.equals(other.name) && content.equals(other.content); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.id, this.name, this.content); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static NameStage builder() { - return new Builder(); - } - - public interface NameStage { - /** The name of the function being called */ - ContentStage name(@NotNull String name); - - Builder from(AgentV1ReceiveFunctionCallResponse other); - } - - public interface ContentStage { - /** The content or result of the function call */ - _FinalStage content(@NotNull String content); - } - - public interface _FinalStage { - AgentV1ReceiveFunctionCallResponse build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** - * The unique identifier for the function call. - * - *

Required for client responses: Should match the id from the - * corresponding FunctionCallRequestOptional for server - * responses: Server may omit when responding to internal function executions - */ - _FinalStage id(Optional id); - - _FinalStage id(String id); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements NameStage, ContentStage, _FinalStage { - private String name; - - private String content; - - private Optional id = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(AgentV1ReceiveFunctionCallResponse other) { - id(other.getId()); - name(other.getName()); - content(other.getContent()); - return this; - } - - /** - * The name of the function being called - * - *

The name of the function being called - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("name") - public ContentStage name(@NotNull String name) { - this.name = Objects.requireNonNull(name, "name must not be null"); - return this; - } - - /** - * The content or result of the function call - * - *

The content or result of the function call - * - * @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; - } - - /** - * The unique identifier for the function call. - * - *

Required for client responses: Should match the id from the - * corresponding FunctionCallRequestOptional for server - * responses: Server may omit when responding to internal function executions - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage id(String id) { - this.id = Optional.ofNullable(id); - return this; - } - - /** - * The unique identifier for the function call. - * - *

Required for client responses: Should match the id from the - * corresponding FunctionCallRequestOptional for server - * responses: Server may omit when responding to internal function executions - */ - @java.lang.Override - @JsonSetter(value = "id", nulls = Nulls.SKIP) - public _FinalStage id(Optional id) { - this.id = id; - return this; - } - - @java.lang.Override - public AgentV1ReceiveFunctionCallResponse build() { - return new AgentV1ReceiveFunctionCallResponse(id, name, content, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1SendFunctionCallResponse.java b/src/main/java/resources/agent/v1/types/AgentV1SendFunctionCallResponse.java deleted file mode 100644 index cc83c4c..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1SendFunctionCallResponse.java +++ /dev/null @@ -1,228 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = AgentV1SendFunctionCallResponse.Builder.class) -public final class AgentV1SendFunctionCallResponse { - private final Optional id; - - private final String name; - - private final String content; - - private final Map additionalProperties; - - private AgentV1SendFunctionCallResponse( - Optional id, String name, String content, Map additionalProperties) { - this.id = id; - this.name = name; - this.content = content; - this.additionalProperties = additionalProperties; - } - - /** - * @return Message type identifier for function call responses - */ - @JsonProperty("type") - public String getType() { - return "FunctionCallResponse"; - } - - /** - * @return The unique identifier for the function call. - *

Required for client responses: Should match the id from the - * corresponding FunctionCallRequestOptional for server - * responses: Server may omit when responding to internal function executions - */ - @JsonProperty("id") - public Optional getId() { - return id; - } - - /** - * @return The name of the function being called - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * @return The content or result of the function call - */ - @JsonProperty("content") - public String getContent() { - return content; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AgentV1SendFunctionCallResponse - && equalTo((AgentV1SendFunctionCallResponse) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(AgentV1SendFunctionCallResponse other) { - return id.equals(other.id) && name.equals(other.name) && content.equals(other.content); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.id, this.name, this.content); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static NameStage builder() { - return new Builder(); - } - - public interface NameStage { - /** The name of the function being called */ - ContentStage name(@NotNull String name); - - Builder from(AgentV1SendFunctionCallResponse other); - } - - public interface ContentStage { - /** The content or result of the function call */ - _FinalStage content(@NotNull String content); - } - - public interface _FinalStage { - AgentV1SendFunctionCallResponse build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** - * The unique identifier for the function call. - * - *

Required for client responses: Should match the id from the - * corresponding FunctionCallRequestOptional for server - * responses: Server may omit when responding to internal function executions - */ - _FinalStage id(Optional id); - - _FinalStage id(String id); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements NameStage, ContentStage, _FinalStage { - private String name; - - private String content; - - private Optional id = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(AgentV1SendFunctionCallResponse other) { - id(other.getId()); - name(other.getName()); - content(other.getContent()); - return this; - } - - /** - * The name of the function being called - * - *

The name of the function being called - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("name") - public ContentStage name(@NotNull String name) { - this.name = Objects.requireNonNull(name, "name must not be null"); - return this; - } - - /** - * The content or result of the function call - * - *

The content or result of the function call - * - * @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; - } - - /** - * The unique identifier for the function call. - * - *

Required for client responses: Should match the id from the - * corresponding FunctionCallRequestOptional for server - * responses: Server may omit when responding to internal function executions - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage id(String id) { - this.id = Optional.ofNullable(id); - return this; - } - - /** - * The unique identifier for the function call. - * - *

Required for client responses: Should match the id from the - * corresponding FunctionCallRequestOptional for server - * responses: Server may omit when responding to internal function executions - */ - @java.lang.Override - @JsonSetter(value = "id", nulls = Nulls.SKIP) - public _FinalStage id(Optional id) { - this.id = id; - return this; - } - - @java.lang.Override - public AgentV1SendFunctionCallResponse build() { - return new AgentV1SendFunctionCallResponse(id, name, content, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1Settings.java b/src/main/java/resources/agent/v1/types/AgentV1Settings.java deleted file mode 100644 index 48ca9e4..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1Settings.java +++ /dev/null @@ -1,301 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = AgentV1Settings.Builder.class) -public final class AgentV1Settings { - private final Optional> tags; - - private final Optional experimental; - - private final Optional flags; - - private final Optional mipOptOut; - - private final AgentV1SettingsAudio audio; - - private final AgentV1SettingsAgent agent; - - private final Map additionalProperties; - - private AgentV1Settings( - Optional> tags, - Optional experimental, - Optional flags, - Optional mipOptOut, - AgentV1SettingsAudio audio, - AgentV1SettingsAgent agent, - Map additionalProperties) { - this.tags = tags; - this.experimental = experimental; - this.flags = flags; - this.mipOptOut = mipOptOut; - this.audio = audio; - this.agent = agent; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("type") - public String getType() { - return "Settings"; - } - - /** - * @return Tags to associate with the request - */ - @JsonProperty("tags") - public Optional> getTags() { - return tags; - } - - /** - * @return To enable experimental features - */ - @JsonProperty("experimental") - public Optional getExperimental() { - return experimental; - } - - @JsonProperty("flags") - public Optional getFlags() { - return flags; - } - - /** - * @return To opt out of Deepgram Model Improvement Program - */ - @JsonProperty("mip_opt_out") - public Optional getMipOptOut() { - return mipOptOut; - } - - @JsonProperty("audio") - public AgentV1SettingsAudio getAudio() { - return audio; - } - - @JsonProperty("agent") - public AgentV1SettingsAgent getAgent() { - return agent; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AgentV1Settings && equalTo((AgentV1Settings) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(AgentV1Settings other) { - return tags.equals(other.tags) - && experimental.equals(other.experimental) - && flags.equals(other.flags) - && mipOptOut.equals(other.mipOptOut) - && audio.equals(other.audio) - && agent.equals(other.agent); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.tags, this.experimental, this.flags, this.mipOptOut, this.audio, this.agent); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static AudioStage builder() { - return new Builder(); - } - - public interface AudioStage { - AgentStage audio(@NotNull AgentV1SettingsAudio audio); - - Builder from(AgentV1Settings other); - } - - public interface AgentStage { - _FinalStage agent(@NotNull AgentV1SettingsAgent agent); - } - - public interface _FinalStage { - AgentV1Settings build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** Tags to associate with the request */ - _FinalStage tags(Optional> tags); - - _FinalStage tags(List tags); - - /** To enable experimental features */ - _FinalStage experimental(Optional experimental); - - _FinalStage experimental(Boolean experimental); - - _FinalStage flags(Optional flags); - - _FinalStage flags(AgentV1SettingsFlags flags); - - /** To opt out of Deepgram Model Improvement Program */ - _FinalStage mipOptOut(Optional mipOptOut); - - _FinalStage mipOptOut(Boolean mipOptOut); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements AudioStage, AgentStage, _FinalStage { - private AgentV1SettingsAudio audio; - - private AgentV1SettingsAgent agent; - - private Optional mipOptOut = Optional.empty(); - - private Optional flags = Optional.empty(); - - private Optional experimental = Optional.empty(); - - private Optional> tags = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(AgentV1Settings other) { - tags(other.getTags()); - experimental(other.getExperimental()); - flags(other.getFlags()); - mipOptOut(other.getMipOptOut()); - audio(other.getAudio()); - agent(other.getAgent()); - return this; - } - - @java.lang.Override - @JsonSetter("audio") - public AgentStage audio(@NotNull AgentV1SettingsAudio audio) { - this.audio = Objects.requireNonNull(audio, "audio must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("agent") - public _FinalStage agent(@NotNull AgentV1SettingsAgent agent) { - this.agent = Objects.requireNonNull(agent, "agent must not be null"); - return this; - } - - /** - * To opt out of Deepgram Model Improvement Program - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage mipOptOut(Boolean mipOptOut) { - this.mipOptOut = Optional.ofNullable(mipOptOut); - return this; - } - - /** To opt out of Deepgram Model Improvement Program */ - @java.lang.Override - @JsonSetter(value = "mip_opt_out", nulls = Nulls.SKIP) - public _FinalStage mipOptOut(Optional mipOptOut) { - this.mipOptOut = mipOptOut; - return this; - } - - @java.lang.Override - public _FinalStage flags(AgentV1SettingsFlags flags) { - this.flags = Optional.ofNullable(flags); - return this; - } - - @java.lang.Override - @JsonSetter(value = "flags", nulls = Nulls.SKIP) - public _FinalStage flags(Optional flags) { - this.flags = flags; - return this; - } - - /** - * To enable experimental features - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage experimental(Boolean experimental) { - this.experimental = Optional.ofNullable(experimental); - return this; - } - - /** To enable experimental features */ - @java.lang.Override - @JsonSetter(value = "experimental", nulls = Nulls.SKIP) - public _FinalStage experimental(Optional experimental) { - this.experimental = experimental; - return this; - } - - /** - * Tags to associate with the request - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage tags(List tags) { - this.tags = Optional.ofNullable(tags); - return this; - } - - /** Tags to associate with the request */ - @java.lang.Override - @JsonSetter(value = "tags", nulls = Nulls.SKIP) - public _FinalStage tags(Optional> tags) { - this.tags = tags; - return this; - } - - @java.lang.Override - public AgentV1Settings build() { - return new AgentV1Settings( - tags, experimental, flags, mipOptOut, audio, agent, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1SettingsAgent.java b/src/main/java/resources/agent/v1/types/AgentV1SettingsAgent.java deleted file mode 100644 index aff20e8..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1SettingsAgent.java +++ /dev/null @@ -1,94 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.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 core.ObjectMappers; -import java.io.IOException; -import java.util.Objects; - -@JsonDeserialize(using = AgentV1SettingsAgent.Deserializer.class) -public final class AgentV1SettingsAgent { - private final Object value; - - private final int type; - - private AgentV1SettingsAgent(Object value, int type) { - this.value = value; - this.type = type; - } - - @JsonValue - public Object get() { - return this.value; - } - - @SuppressWarnings("unchecked") - public T visit(Visitor visitor) { - if (this.type == 0) { - return visitor.visit((AgentV1SettingsAgentContext) 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 AgentV1SettingsAgent && equalTo((AgentV1SettingsAgent) other); - } - - private boolean equalTo(AgentV1SettingsAgent 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 AgentV1SettingsAgent of(AgentV1SettingsAgentContext value) { - return new AgentV1SettingsAgent(value, 0); - } - - public static AgentV1SettingsAgent of(String value) { - return new AgentV1SettingsAgent(value, 1); - } - - public interface Visitor { - T visit(AgentV1SettingsAgentContext value); - - T visit(String value); - } - - static final class Deserializer extends StdDeserializer { - Deserializer() { - super(AgentV1SettingsAgent.class); - } - - @java.lang.Override - public AgentV1SettingsAgent deserialize(JsonParser p, DeserializationContext context) - throws IOException { - Object value = p.readValueAs(Object.class); - try { - return of(ObjectMappers.JSON_MAPPER.convertValue(value, AgentV1SettingsAgentContext.class)); - } catch (RuntimeException e) { - } - try { - return of(ObjectMappers.JSON_MAPPER.convertValue(value, String.class)); - } catch (RuntimeException e) { - } - throw new JsonParseException(p, "Failed to deserialize"); - } - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1SettingsAgentContext.java b/src/main/java/resources/agent/v1/types/AgentV1SettingsAgentContext.java deleted file mode 100644 index 1317e7c..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1SettingsAgentContext.java +++ /dev/null @@ -1,243 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = AgentV1SettingsAgentContext.Builder.class) -public final class AgentV1SettingsAgentContext { - private final Optional language; - - private final Optional context; - - private final Optional listen; - - private final Optional think; - - private final Optional speak; - - private final Optional greeting; - - private final Map additionalProperties; - - private AgentV1SettingsAgentContext( - Optional language, - Optional context, - Optional listen, - Optional think, - Optional speak, - Optional greeting, - Map additionalProperties) { - this.language = language; - this.context = context; - this.listen = listen; - this.think = think; - this.speak = speak; - this.greeting = greeting; - this.additionalProperties = additionalProperties; - } - - /** - * @return Deprecated. Use listen.provider.language and speak.provider.language - * fields instead. - */ - @JsonProperty("language") - public Optional getLanguage() { - return language; - } - - /** - * @return Conversation context including the history of messages and function calls - */ - @JsonProperty("context") - public Optional getContext() { - return context; - } - - @JsonProperty("listen") - public Optional getListen() { - return listen; - } - - @JsonProperty("think") - public Optional getThink() { - return think; - } - - @JsonProperty("speak") - public Optional getSpeak() { - return speak; - } - - /** - * @return Optional message that agent will speak at the start - */ - @JsonProperty("greeting") - public Optional getGreeting() { - return greeting; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AgentV1SettingsAgentContext - && equalTo((AgentV1SettingsAgentContext) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(AgentV1SettingsAgentContext other) { - return language.equals(other.language) - && context.equals(other.context) - && listen.equals(other.listen) - && think.equals(other.think) - && speak.equals(other.speak) - && greeting.equals(other.greeting); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.language, this.context, this.listen, this.think, this.speak, this.greeting); - } - - @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 language = Optional.empty(); - - private Optional context = Optional.empty(); - - private Optional listen = Optional.empty(); - - private Optional think = Optional.empty(); - - private Optional speak = Optional.empty(); - - private Optional greeting = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(AgentV1SettingsAgentContext other) { - language(other.getLanguage()); - context(other.getContext()); - listen(other.getListen()); - think(other.getThink()); - speak(other.getSpeak()); - greeting(other.getGreeting()); - return this; - } - - /** - * Deprecated. Use listen.provider.language and speak.provider.language - * fields instead. - */ - @JsonSetter(value = "language", nulls = Nulls.SKIP) - public Builder language(Optional language) { - this.language = language; - return this; - } - - public Builder language(String language) { - this.language = Optional.ofNullable(language); - return this; - } - - /** Conversation context including the history of messages and function calls */ - @JsonSetter(value = "context", nulls = Nulls.SKIP) - public Builder context(Optional context) { - this.context = context; - return this; - } - - public Builder context(AgentV1SettingsAgentContextContext context) { - this.context = Optional.ofNullable(context); - return this; - } - - @JsonSetter(value = "listen", nulls = Nulls.SKIP) - public Builder listen(Optional listen) { - this.listen = listen; - return this; - } - - public Builder listen(AgentV1SettingsAgentContextListen listen) { - this.listen = Optional.ofNullable(listen); - return this; - } - - @JsonSetter(value = "think", nulls = Nulls.SKIP) - public Builder think(Optional think) { - this.think = think; - return this; - } - - public Builder think(AgentV1SettingsAgentContextThink think) { - this.think = Optional.ofNullable(think); - return this; - } - - @JsonSetter(value = "speak", nulls = Nulls.SKIP) - public Builder speak(Optional speak) { - this.speak = speak; - return this; - } - - public Builder speak(AgentV1SettingsAgentContextSpeak speak) { - this.speak = Optional.ofNullable(speak); - return this; - } - - /** Optional message that agent will speak at the start */ - @JsonSetter(value = "greeting", nulls = Nulls.SKIP) - public Builder greeting(Optional greeting) { - this.greeting = greeting; - return this; - } - - public Builder greeting(String greeting) { - this.greeting = Optional.ofNullable(greeting); - return this; - } - - public AgentV1SettingsAgentContext build() { - return new AgentV1SettingsAgentContext( - language, context, listen, think, speak, greeting, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1SettingsAgentContextContext.java b/src/main/java/resources/agent/v1/types/AgentV1SettingsAgentContextContext.java deleted file mode 100644 index 95fe429..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1SettingsAgentContextContext.java +++ /dev/null @@ -1,112 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = AgentV1SettingsAgentContextContext.Builder.class) -public final class AgentV1SettingsAgentContextContext { - private final Optional> messages; - - private final Map additionalProperties; - - private AgentV1SettingsAgentContextContext( - Optional> messages, - Map additionalProperties) { - this.messages = messages; - this.additionalProperties = additionalProperties; - } - - /** - * @return Conversation history as a list of messages and function calls - */ - @JsonProperty("messages") - public Optional> getMessages() { - return messages; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AgentV1SettingsAgentContextContext - && equalTo((AgentV1SettingsAgentContextContext) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(AgentV1SettingsAgentContextContext other) { - return messages.equals(other.messages); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.messages); - } - - @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(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(AgentV1SettingsAgentContextContext other) { - messages(other.getMessages()); - return this; - } - - /** Conversation history as a list of messages and function calls */ - @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; - } - - public AgentV1SettingsAgentContextContext build() { - return new AgentV1SettingsAgentContextContext(messages, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1SettingsAgentContextContextMessagesItem.java b/src/main/java/resources/agent/v1/types/AgentV1SettingsAgentContextContextMessagesItem.java deleted file mode 100644 index e5ce72e..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1SettingsAgentContextContextMessagesItem.java +++ /dev/null @@ -1,103 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.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 core.ObjectMappers; -import java.io.IOException; -import java.util.Objects; - -@JsonDeserialize(using = AgentV1SettingsAgentContextContextMessagesItem.Deserializer.class) -public final class AgentV1SettingsAgentContextContextMessagesItem { - private final Object value; - - private final int type; - - private AgentV1SettingsAgentContextContextMessagesItem(Object value, int type) { - this.value = value; - this.type = type; - } - - @JsonValue - public Object get() { - return this.value; - } - - @SuppressWarnings("unchecked") - public T visit(Visitor visitor) { - if (this.type == 0) { - return visitor.visit((AgentV1SettingsAgentContextContextMessagesItemContent) this.value); - } else if (this.type == 1) { - return visitor.visit( - (AgentV1SettingsAgentContextContextMessagesItemFunctionCalls) 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 AgentV1SettingsAgentContextContextMessagesItem - && equalTo((AgentV1SettingsAgentContextContextMessagesItem) other); - } - - private boolean equalTo(AgentV1SettingsAgentContextContextMessagesItem 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 AgentV1SettingsAgentContextContextMessagesItem of( - AgentV1SettingsAgentContextContextMessagesItemContent value) { - return new AgentV1SettingsAgentContextContextMessagesItem(value, 0); - } - - public static AgentV1SettingsAgentContextContextMessagesItem of( - AgentV1SettingsAgentContextContextMessagesItemFunctionCalls value) { - return new AgentV1SettingsAgentContextContextMessagesItem(value, 1); - } - - public interface Visitor { - T visit(AgentV1SettingsAgentContextContextMessagesItemContent value); - - T visit(AgentV1SettingsAgentContextContextMessagesItemFunctionCalls value); - } - - static final class Deserializer - extends StdDeserializer { - Deserializer() { - super(AgentV1SettingsAgentContextContextMessagesItem.class); - } - - @java.lang.Override - public AgentV1SettingsAgentContextContextMessagesItem deserialize( - JsonParser p, DeserializationContext context) throws IOException { - Object value = p.readValueAs(Object.class); - try { - return of( - ObjectMappers.JSON_MAPPER.convertValue( - value, AgentV1SettingsAgentContextContextMessagesItemContent.class)); - } catch (RuntimeException e) { - } - try { - return of( - ObjectMappers.JSON_MAPPER.convertValue( - value, AgentV1SettingsAgentContextContextMessagesItemFunctionCalls.class)); - } catch (RuntimeException e) { - } - throw new JsonParseException(p, "Failed to deserialize"); - } - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1SettingsAgentContextContextMessagesItemContent.java b/src/main/java/resources/agent/v1/types/AgentV1SettingsAgentContextContextMessagesItemContent.java deleted file mode 100644 index c56469b..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1SettingsAgentContextContextMessagesItemContent.java +++ /dev/null @@ -1,173 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = AgentV1SettingsAgentContextContextMessagesItemContent.Builder.class) -public final class AgentV1SettingsAgentContextContextMessagesItemContent { - private final AgentV1SettingsAgentContextContextMessagesItemContentRole role; - - private final String content; - - private final Map additionalProperties; - - private AgentV1SettingsAgentContextContextMessagesItemContent( - AgentV1SettingsAgentContextContextMessagesItemContentRole role, - String content, - Map additionalProperties) { - this.role = role; - this.content = content; - this.additionalProperties = additionalProperties; - } - - /** - * @return Message type identifier for conversation text - */ - @JsonProperty("type") - public String getType() { - return "History"; - } - - /** - * @return Identifies who spoke the statement - */ - @JsonProperty("role") - public AgentV1SettingsAgentContextContextMessagesItemContentRole getRole() { - return role; - } - - /** - * @return The actual statement that was spoken - */ - @JsonProperty("content") - public String getContent() { - return content; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AgentV1SettingsAgentContextContextMessagesItemContent - && equalTo((AgentV1SettingsAgentContextContextMessagesItemContent) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(AgentV1SettingsAgentContextContextMessagesItemContent other) { - return role.equals(other.role) && content.equals(other.content); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.role, this.content); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static RoleStage builder() { - return new Builder(); - } - - public interface RoleStage { - /** Identifies who spoke the statement */ - ContentStage role(@NotNull AgentV1SettingsAgentContextContextMessagesItemContentRole role); - - Builder from(AgentV1SettingsAgentContextContextMessagesItemContent other); - } - - public interface ContentStage { - /** The actual statement that was spoken */ - _FinalStage content(@NotNull String content); - } - - public interface _FinalStage { - AgentV1SettingsAgentContextContextMessagesItemContent build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements RoleStage, ContentStage, _FinalStage { - private AgentV1SettingsAgentContextContextMessagesItemContentRole role; - - private String content; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(AgentV1SettingsAgentContextContextMessagesItemContent other) { - role(other.getRole()); - content(other.getContent()); - return this; - } - - /** - * Identifies who spoke the statement - * - *

Identifies who spoke the statement - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("role") - public ContentStage role( - @NotNull AgentV1SettingsAgentContextContextMessagesItemContentRole role) { - this.role = Objects.requireNonNull(role, "role must not be null"); - return this; - } - - /** - * The actual statement that was spoken - * - *

The actual statement that was spoken - * - * @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; - } - - @java.lang.Override - public AgentV1SettingsAgentContextContextMessagesItemContent build() { - return new AgentV1SettingsAgentContextContextMessagesItemContent( - role, content, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1SettingsAgentContextContextMessagesItemContentRole.java b/src/main/java/resources/agent/v1/types/AgentV1SettingsAgentContextContextMessagesItemContentRole.java deleted file mode 100644 index d25498c..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1SettingsAgentContextContextMessagesItemContentRole.java +++ /dev/null @@ -1,85 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class AgentV1SettingsAgentContextContextMessagesItemContentRole { - public static final AgentV1SettingsAgentContextContextMessagesItemContentRole ASSISTANT = - new AgentV1SettingsAgentContextContextMessagesItemContentRole(Value.ASSISTANT, "assistant"); - - public static final AgentV1SettingsAgentContextContextMessagesItemContentRole USER = - new AgentV1SettingsAgentContextContextMessagesItemContentRole(Value.USER, "user"); - - private final Value value; - - private final String string; - - AgentV1SettingsAgentContextContextMessagesItemContentRole(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof AgentV1SettingsAgentContextContextMessagesItemContentRole - && this.string.equals( - ((AgentV1SettingsAgentContextContextMessagesItemContentRole) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case ASSISTANT: - return visitor.visitAssistant(); - case USER: - return visitor.visitUser(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static AgentV1SettingsAgentContextContextMessagesItemContentRole valueOf(String value) { - switch (value) { - case "assistant": - return ASSISTANT; - case "user": - return USER; - default: - return new AgentV1SettingsAgentContextContextMessagesItemContentRole(Value.UNKNOWN, value); - } - } - - public enum Value { - USER, - - ASSISTANT, - - UNKNOWN - } - - public interface Visitor { - T visitUser(); - - T visitAssistant(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1SettingsAgentContextContextMessagesItemFunctionCalls.java b/src/main/java/resources/agent/v1/types/AgentV1SettingsAgentContextContextMessagesItemFunctionCalls.java deleted file mode 100644 index 29b0e5f..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1SettingsAgentContextContextMessagesItemFunctionCalls.java +++ /dev/null @@ -1,137 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = AgentV1SettingsAgentContextContextMessagesItemFunctionCalls.Builder.class) -public final class AgentV1SettingsAgentContextContextMessagesItemFunctionCalls { - private final List - functionCalls; - - private final Map additionalProperties; - - private AgentV1SettingsAgentContextContextMessagesItemFunctionCalls( - List - functionCalls, - Map additionalProperties) { - this.functionCalls = functionCalls; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("type") - public String getType() { - return "History"; - } - - /** - * @return List of function call objects - */ - @JsonProperty("function_calls") - public List - getFunctionCalls() { - return functionCalls; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AgentV1SettingsAgentContextContextMessagesItemFunctionCalls - && equalTo((AgentV1SettingsAgentContextContextMessagesItemFunctionCalls) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(AgentV1SettingsAgentContextContextMessagesItemFunctionCalls other) { - return functionCalls.equals(other.functionCalls); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.functionCalls); - } - - @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 - functionCalls = new ArrayList<>(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(AgentV1SettingsAgentContextContextMessagesItemFunctionCalls other) { - functionCalls(other.getFunctionCalls()); - return this; - } - - /** List of function call objects */ - @JsonSetter(value = "function_calls", nulls = Nulls.SKIP) - public Builder functionCalls( - List - functionCalls) { - this.functionCalls.clear(); - if (functionCalls != null) { - this.functionCalls.addAll(functionCalls); - } - return this; - } - - public Builder addFunctionCalls( - AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem - functionCalls) { - this.functionCalls.add(functionCalls); - return this; - } - - public Builder addAllFunctionCalls( - List - functionCalls) { - if (functionCalls != null) { - this.functionCalls.addAll(functionCalls); - } - return this; - } - - public AgentV1SettingsAgentContextContextMessagesItemFunctionCalls build() { - return new AgentV1SettingsAgentContextContextMessagesItemFunctionCalls( - functionCalls, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem.java b/src/main/java/resources/agent/v1/types/AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem.java deleted file mode 100644 index 651fca5..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem.java +++ /dev/null @@ -1,278 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = - AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem.Builder.class) -public final class AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem { - private final String id; - - private final String name; - - private final boolean clientSide; - - private final String arguments; - - private final String response; - - private final Map additionalProperties; - - private AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem( - String id, - String name, - boolean clientSide, - String arguments, - String response, - Map additionalProperties) { - this.id = id; - this.name = name; - this.clientSide = clientSide; - this.arguments = arguments; - this.response = response; - this.additionalProperties = additionalProperties; - } - - /** - * @return Unique identifier for the function call - */ - @JsonProperty("id") - public String getId() { - return id; - } - - /** - * @return Name of the function called - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * @return Indicates if the call was client-side or server-side - */ - @JsonProperty("client_side") - public boolean getClientSide() { - return clientSide; - } - - /** - * @return Arguments passed to the function - */ - @JsonProperty("arguments") - public String getArguments() { - return arguments; - } - - /** - * @return Response from the function call - */ - @JsonProperty("response") - public String getResponse() { - return response; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other - instanceof AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem - && equalTo( - (AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo( - AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem other) { - return id.equals(other.id) - && name.equals(other.name) - && clientSide == other.clientSide - && arguments.equals(other.arguments) - && response.equals(other.response); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.id, this.name, this.clientSide, this.arguments, this.response); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - /** Unique identifier for the function call */ - NameStage id(@NotNull String id); - - Builder from( - AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem other); - } - - public interface NameStage { - /** Name of the function called */ - ClientSideStage name(@NotNull String name); - } - - public interface ClientSideStage { - /** Indicates if the call was client-side or server-side */ - ArgumentsStage clientSide(boolean clientSide); - } - - public interface ArgumentsStage { - /** Arguments passed to the function */ - ResponseStage arguments(@NotNull String arguments); - } - - public interface ResponseStage { - /** Response from the function call */ - _FinalStage response(@NotNull String response); - } - - public interface _FinalStage { - AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements IdStage, NameStage, ClientSideStage, ArgumentsStage, ResponseStage, _FinalStage { - private String id; - - private String name; - - private boolean clientSide; - - private String arguments; - - private String response; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from( - AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem other) { - id(other.getId()); - name(other.getName()); - clientSide(other.getClientSide()); - arguments(other.getArguments()); - response(other.getResponse()); - return this; - } - - /** - * Unique identifier for the function call - * - *

Unique identifier for the function call - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("id") - public NameStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - /** - * Name of the function called - * - *

Name of the function called - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("name") - public ClientSideStage name(@NotNull String name) { - this.name = Objects.requireNonNull(name, "name must not be null"); - return this; - } - - /** - * Indicates if the call was client-side or server-side - * - *

Indicates if the call was client-side or server-side - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("client_side") - public ArgumentsStage clientSide(boolean clientSide) { - this.clientSide = clientSide; - return this; - } - - /** - * Arguments passed to the function - * - *

Arguments passed to the function - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("arguments") - public ResponseStage arguments(@NotNull String arguments) { - this.arguments = Objects.requireNonNull(arguments, "arguments must not be null"); - return this; - } - - /** - * Response from the function call - * - *

Response from the function call - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("response") - public _FinalStage response(@NotNull String response) { - this.response = Objects.requireNonNull(response, "response must not be null"); - return this; - } - - @java.lang.Override - public AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem build() { - return new AgentV1SettingsAgentContextContextMessagesItemFunctionCallsFunctionCallsItem( - id, name, clientSide, arguments, response, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1SettingsAgentContextListen.java b/src/main/java/resources/agent/v1/types/AgentV1SettingsAgentContextListen.java deleted file mode 100644 index bc6803b..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1SettingsAgentContextListen.java +++ /dev/null @@ -1,105 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = AgentV1SettingsAgentContextListen.Builder.class) -public final class AgentV1SettingsAgentContextListen { - private final Optional provider; - - private final Map additionalProperties; - - private AgentV1SettingsAgentContextListen( - Optional provider, - Map additionalProperties) { - this.provider = provider; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("provider") - public Optional getProvider() { - return provider; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AgentV1SettingsAgentContextListen - && equalTo((AgentV1SettingsAgentContextListen) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(AgentV1SettingsAgentContextListen other) { - return provider.equals(other.provider); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(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 provider = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(AgentV1SettingsAgentContextListen other) { - provider(other.getProvider()); - return this; - } - - @JsonSetter(value = "provider", nulls = Nulls.SKIP) - public Builder provider(Optional provider) { - this.provider = provider; - return this; - } - - public Builder provider(AgentV1SettingsAgentContextListenProvider provider) { - this.provider = Optional.ofNullable(provider); - return this; - } - - public AgentV1SettingsAgentContextListen build() { - return new AgentV1SettingsAgentContextListen(provider, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1SettingsAgentContextListenProvider.java b/src/main/java/resources/agent/v1/types/AgentV1SettingsAgentContextListenProvider.java deleted file mode 100644 index b72cdb9..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1SettingsAgentContextListenProvider.java +++ /dev/null @@ -1,230 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.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 AgentV1SettingsAgentContextListenProvider { - private final Value value; - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - private AgentV1SettingsAgentContextListenProvider(Value value) { - this.value = value; - } - - public T visit(Visitor visitor) { - return value.visit(visitor); - } - - public static AgentV1SettingsAgentContextListenProvider v1( - AgentV1SettingsAgentContextListenProviderV1 value) { - return new AgentV1SettingsAgentContextListenProvider(new V1Value(value)); - } - - public static AgentV1SettingsAgentContextListenProvider v2( - AgentV1SettingsAgentContextListenProviderV2 value) { - return new AgentV1SettingsAgentContextListenProvider(new V2Value(value)); - } - - public boolean isV1() { - return value instanceof V1Value; - } - - public boolean isV2() { - return value instanceof V2Value; - } - - public boolean _isUnknown() { - return value instanceof _UnknownValue; - } - - public Optional getV1() { - if (isV1()) { - return Optional.of(((V1Value) value).value); - } - return Optional.empty(); - } - - public Optional getV2() { - if (isV2()) { - return Optional.of(((V2Value) value).value); - } - return Optional.empty(); - } - - public Optional _getUnknown() { - if (_isUnknown()) { - return Optional.of(((_UnknownValue) value).value); - } - return Optional.empty(); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AgentV1SettingsAgentContextListenProvider - && value.equals(((AgentV1SettingsAgentContextListenProvider) other).value); - } - - @Override - public int hashCode() { - return Objects.hash(value); - } - - @Override - public String toString() { - return value.toString(); - } - - @JsonValue - private Value getValue() { - return this.value; - } - - public interface Visitor { - T visitV1(AgentV1SettingsAgentContextListenProviderV1 v1); - - T visitV2(AgentV1SettingsAgentContextListenProviderV2 v2); - - T _visitUnknown(Object unknownType); - } - - @JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "version", - visible = true, - defaultImpl = _UnknownValue.class) - @JsonSubTypes({@JsonSubTypes.Type(V1Value.class), @JsonSubTypes.Type(V2Value.class)}) - @JsonIgnoreProperties(ignoreUnknown = true) - private interface Value { - T visit(Visitor visitor); - } - - @JsonTypeName("v1") - @JsonIgnoreProperties("version") - private static final class V1Value implements Value { - @JsonUnwrapped - @JsonIgnoreProperties(value = "version", allowSetters = true) - private AgentV1SettingsAgentContextListenProviderV1 value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private V1Value() {} - - private V1Value(AgentV1SettingsAgentContextListenProviderV1 value) { - this.value = value; - } - - @java.lang.Override - public T visit(Visitor visitor) { - return visitor.visitV1(value); - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof V1Value && equalTo((V1Value) other); - } - - private boolean equalTo(V1Value other) { - return value.equals(other.value); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.value); - } - - @java.lang.Override - public String toString() { - return "AgentV1SettingsAgentContextListenProvider{" + "value: " + value + "}"; - } - } - - @JsonTypeName("v2") - @JsonIgnoreProperties("version") - private static final class V2Value implements Value { - @JsonUnwrapped - @JsonIgnoreProperties(value = "version", allowSetters = true) - private AgentV1SettingsAgentContextListenProviderV2 value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private V2Value() {} - - private V2Value(AgentV1SettingsAgentContextListenProviderV2 value) { - this.value = value; - } - - @java.lang.Override - public T visit(Visitor visitor) { - return visitor.visitV2(value); - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof V2Value && equalTo((V2Value) other); - } - - private boolean equalTo(V2Value other) { - return value.equals(other.value); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.value); - } - - @java.lang.Override - public String toString() { - return "AgentV1SettingsAgentContextListenProvider{" + "value: " + value + "}"; - } - } - - @JsonIgnoreProperties("version") - 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 "AgentV1SettingsAgentContextListenProvider{" - + "type: " - + type - + ", value: " - + value - + "}"; - } - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1SettingsAgentContextListenProviderV1.java b/src/main/java/resources/agent/v1/types/AgentV1SettingsAgentContextListenProviderV1.java deleted file mode 100644 index 832665e..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1SettingsAgentContextListenProviderV1.java +++ /dev/null @@ -1,203 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = AgentV1SettingsAgentContextListenProviderV1.Builder.class) -public final class AgentV1SettingsAgentContextListenProviderV1 { - private final Optional model; - - private final Optional language; - - private final Optional> keyterms; - - private final Optional smartFormat; - - private final Map additionalProperties; - - private AgentV1SettingsAgentContextListenProviderV1( - Optional model, - Optional language, - Optional> keyterms, - Optional smartFormat, - Map additionalProperties) { - this.model = model; - this.language = language; - this.keyterms = keyterms; - this.smartFormat = smartFormat; - this.additionalProperties = additionalProperties; - } - - /** - * @return Provider type for speech-to-text - */ - @JsonProperty("type") - public String getType() { - return "deepgram"; - } - - /** - * @return Model to use for speech to text using the V1 API (e.g. Nova-3, Nova-2) - */ - @JsonProperty("model") - public Optional getModel() { - return model; - } - - /** - * @return Language code to use for speech-to-text. Can be a BCP-47 language tag (e.g. en - * ), or multi for code-switching transcription - */ - @JsonProperty("language") - public Optional getLanguage() { - return language; - } - - @JsonProperty("keyterms") - public Optional> getKeyterms() { - return keyterms; - } - - /** - * @return Applies smart formatting to improve transcript readability - */ - @JsonProperty("smart_format") - public Optional getSmartFormat() { - return smartFormat; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AgentV1SettingsAgentContextListenProviderV1 - && equalTo((AgentV1SettingsAgentContextListenProviderV1) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(AgentV1SettingsAgentContextListenProviderV1 other) { - return model.equals(other.model) - && language.equals(other.language) - && keyterms.equals(other.keyterms) - && smartFormat.equals(other.smartFormat); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.model, this.language, this.keyterms, this.smartFormat); - } - - @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> keyterms = Optional.empty(); - - private Optional smartFormat = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(AgentV1SettingsAgentContextListenProviderV1 other) { - model(other.getModel()); - language(other.getLanguage()); - keyterms(other.getKeyterms()); - smartFormat(other.getSmartFormat()); - return this; - } - - /** Model to use for speech to text using the V1 API (e.g. Nova-3, Nova-2) */ - @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; - } - - /** - * Language code to use for speech-to-text. Can be a BCP-47 language tag (e.g. en), - * or multi for code-switching transcription - */ - @JsonSetter(value = "language", nulls = Nulls.SKIP) - public Builder language(Optional language) { - this.language = language; - return this; - } - - public Builder language(String language) { - this.language = Optional.ofNullable(language); - return this; - } - - @JsonSetter(value = "keyterms", nulls = Nulls.SKIP) - public Builder keyterms(Optional> keyterms) { - this.keyterms = keyterms; - return this; - } - - public Builder keyterms(List keyterms) { - this.keyterms = Optional.ofNullable(keyterms); - return this; - } - - /** Applies smart formatting to improve transcript readability */ - @JsonSetter(value = "smart_format", 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; - } - - public AgentV1SettingsAgentContextListenProviderV1 build() { - return new AgentV1SettingsAgentContextListenProviderV1( - model, language, keyterms, smartFormat, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1SettingsAgentContextListenProviderV2.java b/src/main/java/resources/agent/v1/types/AgentV1SettingsAgentContextListenProviderV2.java deleted file mode 100644 index cf48c2d..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1SettingsAgentContextListenProviderV2.java +++ /dev/null @@ -1,233 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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; -import types.ListenV2EagerEotThreshold; -import types.ListenV2EotThreshold; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = AgentV1SettingsAgentContextListenProviderV2.Builder.class) -public final class AgentV1SettingsAgentContextListenProviderV2 { - private final String model; - - private final Optional> keyterms; - - private final Optional eotThreshold; - - private final Optional eagerEotThreshold; - - private final Map additionalProperties; - - private AgentV1SettingsAgentContextListenProviderV2( - String model, - Optional> keyterms, - Optional eotThreshold, - Optional eagerEotThreshold, - Map additionalProperties) { - this.model = model; - this.keyterms = keyterms; - this.eotThreshold = eotThreshold; - this.eagerEotThreshold = eagerEotThreshold; - this.additionalProperties = additionalProperties; - } - - /** - * @return Provider type for speech-to-text - */ - @JsonProperty("type") - public String getType() { - return "deepgram"; - } - - /** - * @return Model to use for speech to text using the V2 API (e.g. flux-general-en) - */ - @JsonProperty("model") - public String getModel() { - return model; - } - - @JsonProperty("keyterms") - public Optional> getKeyterms() { - return keyterms; - } - - @JsonProperty("eot_threshold") - public Optional getEotThreshold() { - return eotThreshold; - } - - @JsonProperty("eager_eot_threshold") - public Optional getEagerEotThreshold() { - return eagerEotThreshold; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AgentV1SettingsAgentContextListenProviderV2 - && equalTo((AgentV1SettingsAgentContextListenProviderV2) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(AgentV1SettingsAgentContextListenProviderV2 other) { - return model.equals(other.model) - && keyterms.equals(other.keyterms) - && eotThreshold.equals(other.eotThreshold) - && eagerEotThreshold.equals(other.eagerEotThreshold); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.model, this.keyterms, this.eotThreshold, this.eagerEotThreshold); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static ModelStage builder() { - return new Builder(); - } - - public interface ModelStage { - /** Model to use for speech to text using the V2 API (e.g. flux-general-en) */ - _FinalStage model(@NotNull String model); - - Builder from(AgentV1SettingsAgentContextListenProviderV2 other); - } - - public interface _FinalStage { - AgentV1SettingsAgentContextListenProviderV2 build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - _FinalStage keyterms(Optional> keyterms); - - _FinalStage keyterms(List keyterms); - - _FinalStage eotThreshold(Optional eotThreshold); - - _FinalStage eotThreshold(ListenV2EotThreshold eotThreshold); - - _FinalStage eagerEotThreshold(Optional eagerEotThreshold); - - _FinalStage eagerEotThreshold(ListenV2EagerEotThreshold eagerEotThreshold); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements ModelStage, _FinalStage { - private String model; - - private Optional eagerEotThreshold = Optional.empty(); - - private Optional eotThreshold = Optional.empty(); - - private Optional> keyterms = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(AgentV1SettingsAgentContextListenProviderV2 other) { - model(other.getModel()); - keyterms(other.getKeyterms()); - eotThreshold(other.getEotThreshold()); - eagerEotThreshold(other.getEagerEotThreshold()); - return this; - } - - /** - * Model to use for speech to text using the V2 API (e.g. flux-general-en) - * - *

Model to use for speech to text using the V2 API (e.g. flux-general-en) - * - * @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; - } - - @java.lang.Override - public _FinalStage eagerEotThreshold(ListenV2EagerEotThreshold eagerEotThreshold) { - this.eagerEotThreshold = Optional.ofNullable(eagerEotThreshold); - return this; - } - - @java.lang.Override - @JsonSetter(value = "eager_eot_threshold", nulls = Nulls.SKIP) - public _FinalStage eagerEotThreshold(Optional eagerEotThreshold) { - this.eagerEotThreshold = eagerEotThreshold; - return this; - } - - @java.lang.Override - public _FinalStage eotThreshold(ListenV2EotThreshold eotThreshold) { - this.eotThreshold = Optional.ofNullable(eotThreshold); - return this; - } - - @java.lang.Override - @JsonSetter(value = "eot_threshold", nulls = Nulls.SKIP) - public _FinalStage eotThreshold(Optional eotThreshold) { - this.eotThreshold = eotThreshold; - return this; - } - - @java.lang.Override - public _FinalStage keyterms(List keyterms) { - this.keyterms = Optional.ofNullable(keyterms); - return this; - } - - @java.lang.Override - @JsonSetter(value = "keyterms", nulls = Nulls.SKIP) - public _FinalStage keyterms(Optional> keyterms) { - this.keyterms = keyterms; - return this; - } - - @java.lang.Override - public AgentV1SettingsAgentContextListenProviderV2 build() { - return new AgentV1SettingsAgentContextListenProviderV2( - model, keyterms, eotThreshold, eagerEotThreshold, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1SettingsAgentContextSpeak.java b/src/main/java/resources/agent/v1/types/AgentV1SettingsAgentContextSpeak.java deleted file mode 100644 index 3d7bb92..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1SettingsAgentContextSpeak.java +++ /dev/null @@ -1,100 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.types; - -import com.fasterxml.jackson.annotation.JsonValue; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.deser.std.StdDeserializer; -import core.ObjectMappers; -import java.io.IOException; -import java.util.List; -import java.util.Objects; -import types.SpeakSettingsV1; - -@JsonDeserialize(using = AgentV1SettingsAgentContextSpeak.Deserializer.class) -public final class AgentV1SettingsAgentContextSpeak { - private final Object value; - - private final int type; - - private AgentV1SettingsAgentContextSpeak(Object value, int type) { - this.value = value; - this.type = type; - } - - @JsonValue - public Object get() { - return this.value; - } - - @SuppressWarnings("unchecked") - public T visit(Visitor visitor) { - if (this.type == 0) { - return visitor.visit((SpeakSettingsV1) this.value); - } else if (this.type == 1) { - return visitor.visit((List) 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 AgentV1SettingsAgentContextSpeak - && equalTo((AgentV1SettingsAgentContextSpeak) other); - } - - private boolean equalTo(AgentV1SettingsAgentContextSpeak 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 AgentV1SettingsAgentContextSpeak of(SpeakSettingsV1 value) { - return new AgentV1SettingsAgentContextSpeak(value, 0); - } - - public static AgentV1SettingsAgentContextSpeak of(List value) { - return new AgentV1SettingsAgentContextSpeak(value, 1); - } - - public interface Visitor { - T visit(SpeakSettingsV1 value); - - T visit(List value); - } - - static final class Deserializer extends StdDeserializer { - Deserializer() { - super(AgentV1SettingsAgentContextSpeak.class); - } - - @java.lang.Override - public AgentV1SettingsAgentContextSpeak deserialize( - JsonParser p, DeserializationContext context) throws IOException { - Object value = p.readValueAs(Object.class); - try { - return of(ObjectMappers.JSON_MAPPER.convertValue(value, SpeakSettingsV1.class)); - } catch (RuntimeException e) { - } - try { - return of( - ObjectMappers.JSON_MAPPER.convertValue( - value, new TypeReference>() {})); - } catch (RuntimeException e) { - } - throw new JsonParseException(p, "Failed to deserialize"); - } - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1SettingsAgentContextThink.java b/src/main/java/resources/agent/v1/types/AgentV1SettingsAgentContextThink.java deleted file mode 100644 index cd7237e..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1SettingsAgentContextThink.java +++ /dev/null @@ -1,100 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.types; - -import com.fasterxml.jackson.annotation.JsonValue; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.deser.std.StdDeserializer; -import core.ObjectMappers; -import java.io.IOException; -import java.util.List; -import java.util.Objects; -import types.ThinkSettingsV1; - -@JsonDeserialize(using = AgentV1SettingsAgentContextThink.Deserializer.class) -public final class AgentV1SettingsAgentContextThink { - private final Object value; - - private final int type; - - private AgentV1SettingsAgentContextThink(Object value, int type) { - this.value = value; - this.type = type; - } - - @JsonValue - public Object get() { - return this.value; - } - - @SuppressWarnings("unchecked") - public T visit(Visitor visitor) { - if (this.type == 0) { - return visitor.visit((ThinkSettingsV1) this.value); - } else if (this.type == 1) { - return visitor.visit((List) 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 AgentV1SettingsAgentContextThink - && equalTo((AgentV1SettingsAgentContextThink) other); - } - - private boolean equalTo(AgentV1SettingsAgentContextThink 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 AgentV1SettingsAgentContextThink of(ThinkSettingsV1 value) { - return new AgentV1SettingsAgentContextThink(value, 0); - } - - public static AgentV1SettingsAgentContextThink of(List value) { - return new AgentV1SettingsAgentContextThink(value, 1); - } - - public interface Visitor { - T visit(ThinkSettingsV1 value); - - T visit(List value); - } - - static final class Deserializer extends StdDeserializer { - Deserializer() { - super(AgentV1SettingsAgentContextThink.class); - } - - @java.lang.Override - public AgentV1SettingsAgentContextThink deserialize( - JsonParser p, DeserializationContext context) throws IOException { - Object value = p.readValueAs(Object.class); - try { - return of(ObjectMappers.JSON_MAPPER.convertValue(value, ThinkSettingsV1.class)); - } catch (RuntimeException e) { - } - try { - return of( - ObjectMappers.JSON_MAPPER.convertValue( - value, new TypeReference>() {})); - } catch (RuntimeException e) { - } - throw new JsonParseException(p, "Failed to deserialize"); - } - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1SettingsApplied.java b/src/main/java/resources/agent/v1/types/AgentV1SettingsApplied.java deleted file mode 100644 index 9a7a7a4..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1SettingsApplied.java +++ /dev/null @@ -1,75 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import core.ObjectMappers; -import java.util.HashMap; -import java.util.Map; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = AgentV1SettingsApplied.Builder.class) -public final class AgentV1SettingsApplied { - private final Map additionalProperties; - - private AgentV1SettingsApplied(Map additionalProperties) { - this.additionalProperties = additionalProperties; - } - - /** - * @return Message type identifier for settings applied confirmation - */ - @JsonProperty("type") - public String getType() { - return "SettingsApplied"; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AgentV1SettingsApplied; - } - - @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(AgentV1SettingsApplied other) { - return this; - } - - public AgentV1SettingsApplied build() { - return new AgentV1SettingsApplied(additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1SettingsAudio.java b/src/main/java/resources/agent/v1/types/AgentV1SettingsAudio.java deleted file mode 100644 index c378133..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1SettingsAudio.java +++ /dev/null @@ -1,139 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = AgentV1SettingsAudio.Builder.class) -public final class AgentV1SettingsAudio { - private final Optional input; - - private final Optional output; - - private final Map additionalProperties; - - private AgentV1SettingsAudio( - Optional input, - Optional output, - Map additionalProperties) { - this.input = input; - this.output = output; - this.additionalProperties = additionalProperties; - } - - /** - * @return Audio input configuration settings. If omitted, defaults to encoding=linear16 and - * sample_rate=24000. Higher sample rates like 44100 Hz provide better audio quality. - */ - @JsonProperty("input") - public Optional getInput() { - return input; - } - - /** - * @return Audio output configuration settings - */ - @JsonProperty("output") - public Optional getOutput() { - return output; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AgentV1SettingsAudio && equalTo((AgentV1SettingsAudio) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(AgentV1SettingsAudio other) { - return input.equals(other.input) && output.equals(other.output); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.input, 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 input = Optional.empty(); - - private Optional output = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(AgentV1SettingsAudio other) { - input(other.getInput()); - output(other.getOutput()); - return this; - } - - /** - * Audio input configuration settings. If omitted, defaults to encoding=linear16 and - * sample_rate=24000. Higher sample rates like 44100 Hz provide better audio quality. - */ - @JsonSetter(value = "input", nulls = Nulls.SKIP) - public Builder input(Optional input) { - this.input = input; - return this; - } - - public Builder input(AgentV1SettingsAudioInput input) { - this.input = Optional.ofNullable(input); - return this; - } - - /** Audio output configuration settings */ - @JsonSetter(value = "output", nulls = Nulls.SKIP) - public Builder output(Optional output) { - this.output = output; - return this; - } - - public Builder output(AgentV1SettingsAudioOutput output) { - this.output = Optional.ofNullable(output); - return this; - } - - public AgentV1SettingsAudio build() { - return new AgentV1SettingsAudio(input, output, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1SettingsAudioInput.java b/src/main/java/resources/agent/v1/types/AgentV1SettingsAudioInput.java deleted file mode 100644 index deddbf6..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1SettingsAudioInput.java +++ /dev/null @@ -1,162 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = AgentV1SettingsAudioInput.Builder.class) -public final class AgentV1SettingsAudioInput { - private final AgentV1SettingsAudioInputEncoding encoding; - - private final double sampleRate; - - private final Map additionalProperties; - - private AgentV1SettingsAudioInput( - AgentV1SettingsAudioInputEncoding encoding, - double sampleRate, - Map additionalProperties) { - this.encoding = encoding; - this.sampleRate = sampleRate; - this.additionalProperties = additionalProperties; - } - - /** - * @return Audio encoding format - */ - @JsonProperty("encoding") - public AgentV1SettingsAudioInputEncoding getEncoding() { - return encoding; - } - - /** - * @return Sample rate in Hz. Common values are 16000, 24000, 44100, 48000 - */ - @JsonProperty("sample_rate") - public double getSampleRate() { - return sampleRate; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AgentV1SettingsAudioInput && equalTo((AgentV1SettingsAudioInput) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(AgentV1SettingsAudioInput other) { - return encoding.equals(other.encoding) && sampleRate == other.sampleRate; - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.encoding, this.sampleRate); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static EncodingStage builder() { - return new Builder(); - } - - public interface EncodingStage { - /** Audio encoding format */ - SampleRateStage encoding(@NotNull AgentV1SettingsAudioInputEncoding encoding); - - Builder from(AgentV1SettingsAudioInput other); - } - - public interface SampleRateStage { - /** Sample rate in Hz. Common values are 16000, 24000, 44100, 48000 */ - _FinalStage sampleRate(double sampleRate); - } - - public interface _FinalStage { - AgentV1SettingsAudioInput build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements EncodingStage, SampleRateStage, _FinalStage { - private AgentV1SettingsAudioInputEncoding encoding; - - private double sampleRate; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(AgentV1SettingsAudioInput other) { - encoding(other.getEncoding()); - sampleRate(other.getSampleRate()); - return this; - } - - /** - * Audio encoding format - * - *

Audio encoding format - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("encoding") - public SampleRateStage encoding(@NotNull AgentV1SettingsAudioInputEncoding encoding) { - this.encoding = Objects.requireNonNull(encoding, "encoding must not be null"); - return this; - } - - /** - * Sample rate in Hz. Common values are 16000, 24000, 44100, 48000 - * - *

Sample rate in Hz. Common values are 16000, 24000, 44100, 48000 - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("sample_rate") - public _FinalStage sampleRate(double sampleRate) { - this.sampleRate = sampleRate; - return this; - } - - @java.lang.Override - public AgentV1SettingsAudioInput build() { - return new AgentV1SettingsAudioInput(encoding, sampleRate, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1SettingsAudioInputEncoding.java b/src/main/java/resources/agent/v1/types/AgentV1SettingsAudioInputEncoding.java deleted file mode 100644 index 8bcf8b1..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1SettingsAudioInputEncoding.java +++ /dev/null @@ -1,183 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class AgentV1SettingsAudioInputEncoding { - public static final AgentV1SettingsAudioInputEncoding MULAW = - new AgentV1SettingsAudioInputEncoding(Value.MULAW, "mulaw"); - - public static final AgentV1SettingsAudioInputEncoding AMR_WB = - new AgentV1SettingsAudioInputEncoding(Value.AMR_WB, "amr-wb"); - - public static final AgentV1SettingsAudioInputEncoding LINEAR32 = - new AgentV1SettingsAudioInputEncoding(Value.LINEAR32, "linear32"); - - public static final AgentV1SettingsAudioInputEncoding OGG_OPUS = - new AgentV1SettingsAudioInputEncoding(Value.OGG_OPUS, "ogg-opus"); - - public static final AgentV1SettingsAudioInputEncoding FLAC = - new AgentV1SettingsAudioInputEncoding(Value.FLAC, "flac"); - - public static final AgentV1SettingsAudioInputEncoding SPEEX = - new AgentV1SettingsAudioInputEncoding(Value.SPEEX, "speex"); - - public static final AgentV1SettingsAudioInputEncoding LINEAR16 = - new AgentV1SettingsAudioInputEncoding(Value.LINEAR16, "linear16"); - - public static final AgentV1SettingsAudioInputEncoding OPUS = - new AgentV1SettingsAudioInputEncoding(Value.OPUS, "opus"); - - public static final AgentV1SettingsAudioInputEncoding ALAW = - new AgentV1SettingsAudioInputEncoding(Value.ALAW, "alaw"); - - public static final AgentV1SettingsAudioInputEncoding AMR_NB = - new AgentV1SettingsAudioInputEncoding(Value.AMR_NB, "amr-nb"); - - public static final AgentV1SettingsAudioInputEncoding G729 = - new AgentV1SettingsAudioInputEncoding(Value.G729, "g729"); - - private final Value value; - - private final String string; - - AgentV1SettingsAudioInputEncoding(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof AgentV1SettingsAudioInputEncoding - && this.string.equals(((AgentV1SettingsAudioInputEncoding) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case MULAW: - return visitor.visitMulaw(); - case AMR_WB: - return visitor.visitAmrWb(); - case LINEAR32: - return visitor.visitLinear32(); - case OGG_OPUS: - return visitor.visitOggOpus(); - case FLAC: - return visitor.visitFlac(); - case SPEEX: - return visitor.visitSpeex(); - case LINEAR16: - return visitor.visitLinear16(); - case OPUS: - return visitor.visitOpus(); - case ALAW: - return visitor.visitAlaw(); - case AMR_NB: - return visitor.visitAmrNb(); - case G729: - return visitor.visitG729(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static AgentV1SettingsAudioInputEncoding valueOf(String value) { - switch (value) { - case "mulaw": - return MULAW; - case "amr-wb": - return AMR_WB; - case "linear32": - return LINEAR32; - case "ogg-opus": - return OGG_OPUS; - case "flac": - return FLAC; - case "speex": - return SPEEX; - case "linear16": - return LINEAR16; - case "opus": - return OPUS; - case "alaw": - return ALAW; - case "amr-nb": - return AMR_NB; - case "g729": - return G729; - default: - return new AgentV1SettingsAudioInputEncoding(Value.UNKNOWN, value); - } - } - - public enum Value { - LINEAR16, - - LINEAR32, - - FLAC, - - ALAW, - - MULAW, - - AMR_NB, - - AMR_WB, - - OPUS, - - OGG_OPUS, - - SPEEX, - - G729, - - UNKNOWN - } - - public interface Visitor { - T visitLinear16(); - - T visitLinear32(); - - T visitFlac(); - - T visitAlaw(); - - T visitMulaw(); - - T visitAmrNb(); - - T visitAmrWb(); - - T visitOpus(); - - T visitOggOpus(); - - T visitSpeex(); - - T visitG729(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1SettingsAudioOutput.java b/src/main/java/resources/agent/v1/types/AgentV1SettingsAudioOutput.java deleted file mode 100644 index 454631a..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1SettingsAudioOutput.java +++ /dev/null @@ -1,194 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = AgentV1SettingsAudioOutput.Builder.class) -public final class AgentV1SettingsAudioOutput { - private final Optional encoding; - - private final Optional sampleRate; - - private final Optional bitrate; - - private final Optional container; - - private final Map additionalProperties; - - private AgentV1SettingsAudioOutput( - Optional encoding, - Optional sampleRate, - Optional bitrate, - Optional container, - Map additionalProperties) { - this.encoding = encoding; - this.sampleRate = sampleRate; - this.bitrate = bitrate; - this.container = container; - this.additionalProperties = additionalProperties; - } - - /** - * @return Audio encoding format for streaming TTS output - */ - @JsonProperty("encoding") - public Optional getEncoding() { - return encoding; - } - - /** - * @return Sample rate in Hz - */ - @JsonProperty("sample_rate") - public Optional getSampleRate() { - return sampleRate; - } - - /** - * @return Audio bitrate in bits per second - */ - @JsonProperty("bitrate") - public Optional getBitrate() { - return bitrate; - } - - /** - * @return Audio container format. If omitted, defaults to 'none' - */ - @JsonProperty("container") - public Optional getContainer() { - return container; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AgentV1SettingsAudioOutput - && equalTo((AgentV1SettingsAudioOutput) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(AgentV1SettingsAudioOutput other) { - return encoding.equals(other.encoding) - && sampleRate.equals(other.sampleRate) - && bitrate.equals(other.bitrate) - && container.equals(other.container); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.encoding, this.sampleRate, this.bitrate, this.container); - } - - @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 encoding = Optional.empty(); - - private Optional sampleRate = Optional.empty(); - - private Optional bitrate = Optional.empty(); - - private Optional container = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(AgentV1SettingsAudioOutput other) { - encoding(other.getEncoding()); - sampleRate(other.getSampleRate()); - bitrate(other.getBitrate()); - container(other.getContainer()); - return this; - } - - /** Audio encoding format for streaming TTS output */ - @JsonSetter(value = "encoding", nulls = Nulls.SKIP) - public Builder encoding(Optional encoding) { - this.encoding = encoding; - return this; - } - - public Builder encoding(AgentV1SettingsAudioOutputEncoding encoding) { - this.encoding = Optional.ofNullable(encoding); - return this; - } - - /** Sample rate in Hz */ - @JsonSetter(value = "sample_rate", nulls = Nulls.SKIP) - public Builder sampleRate(Optional sampleRate) { - this.sampleRate = sampleRate; - return this; - } - - public Builder sampleRate(Double sampleRate) { - this.sampleRate = Optional.ofNullable(sampleRate); - return this; - } - - /** Audio bitrate in bits per second */ - @JsonSetter(value = "bitrate", nulls = Nulls.SKIP) - public Builder bitrate(Optional bitrate) { - this.bitrate = bitrate; - return this; - } - - public Builder bitrate(Double bitrate) { - this.bitrate = Optional.ofNullable(bitrate); - return this; - } - - /** Audio container format. If omitted, defaults to 'none' */ - @JsonSetter(value = "container", nulls = Nulls.SKIP) - public Builder container(Optional container) { - this.container = container; - return this; - } - - public Builder container(String container) { - this.container = Optional.ofNullable(container); - return this; - } - - public AgentV1SettingsAudioOutput build() { - return new AgentV1SettingsAudioOutput( - encoding, sampleRate, bitrate, container, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1SettingsAudioOutputEncoding.java b/src/main/java/resources/agent/v1/types/AgentV1SettingsAudioOutputEncoding.java deleted file mode 100644 index e598b33..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1SettingsAudioOutputEncoding.java +++ /dev/null @@ -1,95 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class AgentV1SettingsAudioOutputEncoding { - public static final AgentV1SettingsAudioOutputEncoding MULAW = - new AgentV1SettingsAudioOutputEncoding(Value.MULAW, "mulaw"); - - public static final AgentV1SettingsAudioOutputEncoding LINEAR16 = - new AgentV1SettingsAudioOutputEncoding(Value.LINEAR16, "linear16"); - - public static final AgentV1SettingsAudioOutputEncoding ALAW = - new AgentV1SettingsAudioOutputEncoding(Value.ALAW, "alaw"); - - private final Value value; - - private final String string; - - AgentV1SettingsAudioOutputEncoding(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof AgentV1SettingsAudioOutputEncoding - && this.string.equals(((AgentV1SettingsAudioOutputEncoding) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case MULAW: - return visitor.visitMulaw(); - case LINEAR16: - return visitor.visitLinear16(); - case ALAW: - return visitor.visitAlaw(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static AgentV1SettingsAudioOutputEncoding valueOf(String value) { - switch (value) { - case "mulaw": - return MULAW; - case "linear16": - return LINEAR16; - case "alaw": - return ALAW; - default: - return new AgentV1SettingsAudioOutputEncoding(Value.UNKNOWN, value); - } - } - - public enum Value { - LINEAR16, - - MULAW, - - ALAW, - - UNKNOWN - } - - public interface Visitor { - T visitLinear16(); - - T visitMulaw(); - - T visitAlaw(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1SettingsFlags.java b/src/main/java/resources/agent/v1/types/AgentV1SettingsFlags.java deleted file mode 100644 index 08883d0..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1SettingsFlags.java +++ /dev/null @@ -1,107 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = AgentV1SettingsFlags.Builder.class) -public final class AgentV1SettingsFlags { - private final Optional history; - - private final Map additionalProperties; - - private AgentV1SettingsFlags( - Optional history, Map additionalProperties) { - this.history = history; - this.additionalProperties = additionalProperties; - } - - /** - * @return Enable or disable history message reporting - */ - @JsonProperty("history") - public Optional getHistory() { - return history; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AgentV1SettingsFlags && equalTo((AgentV1SettingsFlags) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(AgentV1SettingsFlags other) { - return history.equals(other.history); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.history); - } - - @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 history = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(AgentV1SettingsFlags other) { - history(other.getHistory()); - return this; - } - - /** Enable or disable history message reporting */ - @JsonSetter(value = "history", nulls = Nulls.SKIP) - public Builder history(Optional history) { - this.history = history; - return this; - } - - public Builder history(Boolean history) { - this.history = Optional.ofNullable(history); - return this; - } - - public AgentV1SettingsFlags build() { - return new AgentV1SettingsFlags(history, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1SpeakUpdated.java b/src/main/java/resources/agent/v1/types/AgentV1SpeakUpdated.java deleted file mode 100644 index d46770a..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1SpeakUpdated.java +++ /dev/null @@ -1,75 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import core.ObjectMappers; -import java.util.HashMap; -import java.util.Map; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = AgentV1SpeakUpdated.Builder.class) -public final class AgentV1SpeakUpdated { - private final Map additionalProperties; - - private AgentV1SpeakUpdated(Map additionalProperties) { - this.additionalProperties = additionalProperties; - } - - /** - * @return Message type identifier for speak update confirmation - */ - @JsonProperty("type") - public String getType() { - return "SpeakUpdated"; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AgentV1SpeakUpdated; - } - - @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(AgentV1SpeakUpdated other) { - return this; - } - - public AgentV1SpeakUpdated build() { - return new AgentV1SpeakUpdated(additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1ThinkUpdated.java b/src/main/java/resources/agent/v1/types/AgentV1ThinkUpdated.java deleted file mode 100644 index bd5df6e..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1ThinkUpdated.java +++ /dev/null @@ -1,75 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import core.ObjectMappers; -import java.util.HashMap; -import java.util.Map; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = AgentV1ThinkUpdated.Builder.class) -public final class AgentV1ThinkUpdated { - private final Map additionalProperties; - - private AgentV1ThinkUpdated(Map additionalProperties) { - this.additionalProperties = additionalProperties; - } - - /** - * @return Message type identifier for think update confirmation - */ - @JsonProperty("type") - public String getType() { - return "ThinkUpdated"; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AgentV1ThinkUpdated; - } - - @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(AgentV1ThinkUpdated other) { - return this; - } - - public AgentV1ThinkUpdated build() { - return new AgentV1ThinkUpdated(additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1UpdatePrompt.java b/src/main/java/resources/agent/v1/types/AgentV1UpdatePrompt.java deleted file mode 100644 index e87b63f..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1UpdatePrompt.java +++ /dev/null @@ -1,134 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = AgentV1UpdatePrompt.Builder.class) -public final class AgentV1UpdatePrompt { - private final String prompt; - - private final Map additionalProperties; - - private AgentV1UpdatePrompt(String prompt, Map additionalProperties) { - this.prompt = prompt; - this.additionalProperties = additionalProperties; - } - - /** - * @return Message type identifier for prompt update request - */ - @JsonProperty("type") - public String getType() { - return "UpdatePrompt"; - } - - /** - * @return The new system prompt to be used by the agent - */ - @JsonProperty("prompt") - public String getPrompt() { - return prompt; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AgentV1UpdatePrompt && equalTo((AgentV1UpdatePrompt) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(AgentV1UpdatePrompt other) { - return prompt.equals(other.prompt); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.prompt); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static PromptStage builder() { - return new Builder(); - } - - public interface PromptStage { - /** The new system prompt to be used by the agent */ - _FinalStage prompt(@NotNull String prompt); - - Builder from(AgentV1UpdatePrompt other); - } - - public interface _FinalStage { - AgentV1UpdatePrompt build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements PromptStage, _FinalStage { - private String prompt; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(AgentV1UpdatePrompt other) { - prompt(other.getPrompt()); - return this; - } - - /** - * The new system prompt to be used by the agent - * - *

The new system prompt to be used by the agent - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("prompt") - public _FinalStage prompt(@NotNull String prompt) { - this.prompt = Objects.requireNonNull(prompt, "prompt must not be null"); - return this; - } - - @java.lang.Override - public AgentV1UpdatePrompt build() { - return new AgentV1UpdatePrompt(prompt, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1UpdateSpeak.java b/src/main/java/resources/agent/v1/types/AgentV1UpdateSpeak.java deleted file mode 100644 index 11c2563..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1UpdateSpeak.java +++ /dev/null @@ -1,124 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = AgentV1UpdateSpeak.Builder.class) -public final class AgentV1UpdateSpeak { - private final AgentV1UpdateSpeakSpeak speak; - - private final Map additionalProperties; - - private AgentV1UpdateSpeak( - AgentV1UpdateSpeakSpeak speak, Map additionalProperties) { - this.speak = speak; - this.additionalProperties = additionalProperties; - } - - /** - * @return Message type identifier for updating the speak model - */ - @JsonProperty("type") - public String getType() { - return "UpdateSpeak"; - } - - @JsonProperty("speak") - public AgentV1UpdateSpeakSpeak getSpeak() { - return speak; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AgentV1UpdateSpeak && equalTo((AgentV1UpdateSpeak) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(AgentV1UpdateSpeak other) { - return speak.equals(other.speak); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.speak); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static SpeakStage builder() { - return new Builder(); - } - - public interface SpeakStage { - _FinalStage speak(@NotNull AgentV1UpdateSpeakSpeak speak); - - Builder from(AgentV1UpdateSpeak other); - } - - public interface _FinalStage { - AgentV1UpdateSpeak build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements SpeakStage, _FinalStage { - private AgentV1UpdateSpeakSpeak speak; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(AgentV1UpdateSpeak other) { - speak(other.getSpeak()); - return this; - } - - @java.lang.Override - @JsonSetter("speak") - public _FinalStage speak(@NotNull AgentV1UpdateSpeakSpeak speak) { - this.speak = Objects.requireNonNull(speak, "speak must not be null"); - return this; - } - - @java.lang.Override - public AgentV1UpdateSpeak build() { - return new AgentV1UpdateSpeak(speak, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1UpdateSpeakSpeak.java b/src/main/java/resources/agent/v1/types/AgentV1UpdateSpeakSpeak.java deleted file mode 100644 index 1f2fb46..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1UpdateSpeakSpeak.java +++ /dev/null @@ -1,99 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.types; - -import com.fasterxml.jackson.annotation.JsonValue; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.deser.std.StdDeserializer; -import core.ObjectMappers; -import java.io.IOException; -import java.util.List; -import java.util.Objects; -import types.SpeakSettingsV1; - -@JsonDeserialize(using = AgentV1UpdateSpeakSpeak.Deserializer.class) -public final class AgentV1UpdateSpeakSpeak { - private final Object value; - - private final int type; - - private AgentV1UpdateSpeakSpeak(Object value, int type) { - this.value = value; - this.type = type; - } - - @JsonValue - public Object get() { - return this.value; - } - - @SuppressWarnings("unchecked") - public T visit(Visitor visitor) { - if (this.type == 0) { - return visitor.visit((SpeakSettingsV1) this.value); - } else if (this.type == 1) { - return visitor.visit((List) 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 AgentV1UpdateSpeakSpeak && equalTo((AgentV1UpdateSpeakSpeak) other); - } - - private boolean equalTo(AgentV1UpdateSpeakSpeak 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 AgentV1UpdateSpeakSpeak of(SpeakSettingsV1 value) { - return new AgentV1UpdateSpeakSpeak(value, 0); - } - - public static AgentV1UpdateSpeakSpeak of(List value) { - return new AgentV1UpdateSpeakSpeak(value, 1); - } - - public interface Visitor { - T visit(SpeakSettingsV1 value); - - T visit(List value); - } - - static final class Deserializer extends StdDeserializer { - Deserializer() { - super(AgentV1UpdateSpeakSpeak.class); - } - - @java.lang.Override - public AgentV1UpdateSpeakSpeak deserialize(JsonParser p, DeserializationContext context) - throws IOException { - Object value = p.readValueAs(Object.class); - try { - return of(ObjectMappers.JSON_MAPPER.convertValue(value, SpeakSettingsV1.class)); - } catch (RuntimeException e) { - } - try { - return of( - ObjectMappers.JSON_MAPPER.convertValue( - value, new TypeReference>() {})); - } catch (RuntimeException e) { - } - throw new JsonParseException(p, "Failed to deserialize"); - } - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1UpdateThink.java b/src/main/java/resources/agent/v1/types/AgentV1UpdateThink.java deleted file mode 100644 index eed3575..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1UpdateThink.java +++ /dev/null @@ -1,124 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = AgentV1UpdateThink.Builder.class) -public final class AgentV1UpdateThink { - private final AgentV1UpdateThinkThink think; - - private final Map additionalProperties; - - private AgentV1UpdateThink( - AgentV1UpdateThinkThink think, Map additionalProperties) { - this.think = think; - this.additionalProperties = additionalProperties; - } - - /** - * @return Message type identifier for updating the think model - */ - @JsonProperty("type") - public String getType() { - return "UpdateThink"; - } - - @JsonProperty("think") - public AgentV1UpdateThinkThink getThink() { - return think; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AgentV1UpdateThink && equalTo((AgentV1UpdateThink) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(AgentV1UpdateThink other) { - return think.equals(other.think); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.think); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static ThinkStage builder() { - return new Builder(); - } - - public interface ThinkStage { - _FinalStage think(@NotNull AgentV1UpdateThinkThink think); - - Builder from(AgentV1UpdateThink other); - } - - public interface _FinalStage { - AgentV1UpdateThink build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements ThinkStage, _FinalStage { - private AgentV1UpdateThinkThink think; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(AgentV1UpdateThink other) { - think(other.getThink()); - return this; - } - - @java.lang.Override - @JsonSetter("think") - public _FinalStage think(@NotNull AgentV1UpdateThinkThink think) { - this.think = Objects.requireNonNull(think, "think must not be null"); - return this; - } - - @java.lang.Override - public AgentV1UpdateThink build() { - return new AgentV1UpdateThink(think, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1UpdateThinkThink.java b/src/main/java/resources/agent/v1/types/AgentV1UpdateThinkThink.java deleted file mode 100644 index 0dbeda9..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1UpdateThinkThink.java +++ /dev/null @@ -1,99 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.types; - -import com.fasterxml.jackson.annotation.JsonValue; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.deser.std.StdDeserializer; -import core.ObjectMappers; -import java.io.IOException; -import java.util.List; -import java.util.Objects; -import types.ThinkSettingsV1; - -@JsonDeserialize(using = AgentV1UpdateThinkThink.Deserializer.class) -public final class AgentV1UpdateThinkThink { - private final Object value; - - private final int type; - - private AgentV1UpdateThinkThink(Object value, int type) { - this.value = value; - this.type = type; - } - - @JsonValue - public Object get() { - return this.value; - } - - @SuppressWarnings("unchecked") - public T visit(Visitor visitor) { - if (this.type == 0) { - return visitor.visit((ThinkSettingsV1) this.value); - } else if (this.type == 1) { - return visitor.visit((List) 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 AgentV1UpdateThinkThink && equalTo((AgentV1UpdateThinkThink) other); - } - - private boolean equalTo(AgentV1UpdateThinkThink 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 AgentV1UpdateThinkThink of(ThinkSettingsV1 value) { - return new AgentV1UpdateThinkThink(value, 0); - } - - public static AgentV1UpdateThinkThink of(List value) { - return new AgentV1UpdateThinkThink(value, 1); - } - - public interface Visitor { - T visit(ThinkSettingsV1 value); - - T visit(List value); - } - - static final class Deserializer extends StdDeserializer { - Deserializer() { - super(AgentV1UpdateThinkThink.class); - } - - @java.lang.Override - public AgentV1UpdateThinkThink deserialize(JsonParser p, DeserializationContext context) - throws IOException { - Object value = p.readValueAs(Object.class); - try { - return of(ObjectMappers.JSON_MAPPER.convertValue(value, ThinkSettingsV1.class)); - } catch (RuntimeException e) { - } - try { - return of( - ObjectMappers.JSON_MAPPER.convertValue( - value, new TypeReference>() {})); - } catch (RuntimeException e) { - } - throw new JsonParseException(p, "Failed to deserialize"); - } - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1UserStartedSpeaking.java b/src/main/java/resources/agent/v1/types/AgentV1UserStartedSpeaking.java deleted file mode 100644 index 3109f95..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1UserStartedSpeaking.java +++ /dev/null @@ -1,75 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import core.ObjectMappers; -import java.util.HashMap; -import java.util.Map; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = AgentV1UserStartedSpeaking.Builder.class) -public final class AgentV1UserStartedSpeaking { - private final Map additionalProperties; - - private AgentV1UserStartedSpeaking(Map additionalProperties) { - this.additionalProperties = additionalProperties; - } - - /** - * @return Message type identifier indicating that the user has begun speaking - */ - @JsonProperty("type") - public String getType() { - return "UserStartedSpeaking"; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AgentV1UserStartedSpeaking; - } - - @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(AgentV1UserStartedSpeaking other) { - return this; - } - - public AgentV1UserStartedSpeaking build() { - return new AgentV1UserStartedSpeaking(additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1Warning.java b/src/main/java/resources/agent/v1/types/AgentV1Warning.java deleted file mode 100644 index ae9d0d1..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1Warning.java +++ /dev/null @@ -1,168 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = AgentV1Warning.Builder.class) -public final class AgentV1Warning { - private final String description; - - private final String code; - - private final Map additionalProperties; - - private AgentV1Warning( - String description, String code, Map additionalProperties) { - this.description = description; - this.code = code; - this.additionalProperties = additionalProperties; - } - - /** - * @return Message type identifier for warnings - */ - @JsonProperty("type") - public String getType() { - return "Warning"; - } - - /** - * @return Description of the warning - */ - @JsonProperty("description") - public String getDescription() { - return description; - } - - /** - * @return Warning code identifier - */ - @JsonProperty("code") - public String getCode() { - return code; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AgentV1Warning && equalTo((AgentV1Warning) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(AgentV1Warning other) { - return description.equals(other.description) && code.equals(other.code); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.description, this.code); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static DescriptionStage builder() { - return new Builder(); - } - - public interface DescriptionStage { - /** Description of the warning */ - CodeStage description(@NotNull String description); - - Builder from(AgentV1Warning other); - } - - public interface CodeStage { - /** Warning code identifier */ - _FinalStage code(@NotNull String code); - } - - public interface _FinalStage { - AgentV1Warning build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements DescriptionStage, CodeStage, _FinalStage { - private String description; - - private String code; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(AgentV1Warning other) { - description(other.getDescription()); - code(other.getCode()); - return this; - } - - /** - * Description of the warning - * - *

Description of the warning - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("description") - public CodeStage description(@NotNull String description) { - this.description = Objects.requireNonNull(description, "description must not be null"); - return this; - } - - /** - * Warning code identifier - * - *

Warning code identifier - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("code") - public _FinalStage code(@NotNull String code) { - this.code = Objects.requireNonNull(code, "code must not be null"); - return this; - } - - @java.lang.Override - public AgentV1Warning build() { - return new AgentV1Warning(description, code, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/agent/v1/types/AgentV1Welcome.java b/src/main/java/resources/agent/v1/types/AgentV1Welcome.java deleted file mode 100644 index 3115a60..0000000 --- a/src/main/java/resources/agent/v1/types/AgentV1Welcome.java +++ /dev/null @@ -1,134 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = AgentV1Welcome.Builder.class) -public final class AgentV1Welcome { - private final String requestId; - - private final Map additionalProperties; - - private AgentV1Welcome(String requestId, Map additionalProperties) { - this.requestId = requestId; - this.additionalProperties = additionalProperties; - } - - /** - * @return Message type identifier for welcome message - */ - @JsonProperty("type") - public String getType() { - return "Welcome"; - } - - /** - * @return Unique identifier for the request - */ - @JsonProperty("request_id") - public String getRequestId() { - return requestId; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AgentV1Welcome && equalTo((AgentV1Welcome) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(AgentV1Welcome other) { - return requestId.equals(other.requestId); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.requestId); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static RequestIdStage builder() { - return new Builder(); - } - - public interface RequestIdStage { - /** Unique identifier for the request */ - _FinalStage requestId(@NotNull String requestId); - - Builder from(AgentV1Welcome other); - } - - public interface _FinalStage { - AgentV1Welcome build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements RequestIdStage, _FinalStage { - private String requestId; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(AgentV1Welcome other) { - requestId(other.getRequestId()); - return this; - } - - /** - * Unique identifier for the request - * - *

Unique identifier for the request - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("request_id") - public _FinalStage requestId(@NotNull String requestId) { - this.requestId = Objects.requireNonNull(requestId, "requestId must not be null"); - return this; - } - - @java.lang.Override - public AgentV1Welcome build() { - return new AgentV1Welcome(requestId, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/agent/v1/websocket/V1WebSocketClient.java b/src/main/java/resources/agent/v1/websocket/V1WebSocketClient.java deleted file mode 100644 index e222bdf..0000000 --- a/src/main/java/resources/agent/v1/websocket/V1WebSocketClient.java +++ /dev/null @@ -1,707 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.agent.v1.websocket; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import core.ClientOptions; -import core.DisconnectReason; -import core.ObjectMappers; -import core.ReconnectingWebSocketListener; -import core.WebSocketReadyState; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ScheduledExecutorService; -import java.util.function.Consumer; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import okhttp3.WebSocket; -import okio.ByteString; -import resources.agent.v1.types.AgentV1AgentAudioDone; -import resources.agent.v1.types.AgentV1AgentStartedSpeaking; -import resources.agent.v1.types.AgentV1AgentThinking; -import resources.agent.v1.types.AgentV1ConversationText; -import resources.agent.v1.types.AgentV1Error; -import resources.agent.v1.types.AgentV1FunctionCallRequest; -import resources.agent.v1.types.AgentV1InjectAgentMessage; -import resources.agent.v1.types.AgentV1InjectUserMessage; -import resources.agent.v1.types.AgentV1InjectionRefused; -import resources.agent.v1.types.AgentV1KeepAlive; -import resources.agent.v1.types.AgentV1PromptUpdated; -import resources.agent.v1.types.AgentV1ReceiveFunctionCallResponse; -import resources.agent.v1.types.AgentV1SendFunctionCallResponse; -import resources.agent.v1.types.AgentV1Settings; -import resources.agent.v1.types.AgentV1SettingsApplied; -import resources.agent.v1.types.AgentV1SpeakUpdated; -import resources.agent.v1.types.AgentV1ThinkUpdated; -import resources.agent.v1.types.AgentV1UpdatePrompt; -import resources.agent.v1.types.AgentV1UpdateSpeak; -import resources.agent.v1.types.AgentV1UpdateThink; -import resources.agent.v1.types.AgentV1UserStartedSpeaking; -import resources.agent.v1.types.AgentV1Warning; -import resources.agent.v1.types.AgentV1Welcome; - -/** - * WebSocket client for the v1 channel. Provides real-time bidirectional communication with - * strongly-typed messages. - */ -public class V1WebSocketClient implements AutoCloseable { - protected final ClientOptions clientOptions; - - private final ObjectMapper objectMapper; - - private final OkHttpClient okHttpClient; - - private ScheduledExecutorService timeoutExecutor; - - private volatile WebSocketReadyState readyState = WebSocketReadyState.CLOSED; - - private volatile Runnable onConnectedHandler; - - private volatile Consumer onDisconnectedHandler; - - private volatile Consumer onErrorHandler; - - private volatile Consumer onMessageHandler; - - private volatile ReconnectingWebSocketListener.ReconnectOptions reconnectOptions; - - private CompletableFuture connectionFuture; - - private ReconnectingWebSocketListener reconnectingListener; - - private volatile Consumer onFunctionCallResponseHandler; - - private volatile Consumer promptUpdatedHandler; - - private volatile Consumer speakUpdatedHandler; - - private volatile Consumer thinkUpdatedHandler; - - private volatile Consumer injectionRefusedHandler; - - private volatile Consumer welcomeHandler; - - private volatile Consumer settingsAppliedHandler; - - private volatile Consumer conversationTextHandler; - - private volatile Consumer userStartedSpeakingHandler; - - private volatile Consumer agentThinkingHandler; - - private volatile Consumer functionCallRequestHandler; - - private volatile Consumer agentStartedSpeakingHandler; - - private volatile Consumer agentAudioDoneHandler; - - private volatile Consumer errorHandler; - - private volatile Consumer warningHandler; - - private volatile Consumer agentV1AudioHandler; - - /** Creates a new async WebSocket client for the v1 channel. */ - public V1WebSocketClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.objectMapper = ObjectMappers.JSON_MAPPER; - this.okHttpClient = clientOptions.httpClient(); - } - - /** - * Establishes the WebSocket connection asynchronously with automatic reconnection. - * - * @return a CompletableFuture that completes when the connection is established - */ - public CompletableFuture connect() { - connectionFuture = new CompletableFuture<>(); - String baseUrl = clientOptions.environment().getAgentURL(); - String fullPath = "/v1/agent/converse"; - if (baseUrl.endsWith("/") && fullPath.startsWith("/")) { - fullPath = fullPath.substring(1); - } else if (!baseUrl.endsWith("/") && !fullPath.startsWith("/")) { - fullPath = "/" + fullPath; - } - // OkHttp's HttpUrl only supports http/https schemes; convert wss/ws for URL parsing - if (baseUrl.startsWith("wss://")) { - baseUrl = "https://" + baseUrl.substring(6); - } else if (baseUrl.startsWith("ws://")) { - baseUrl = "http://" + baseUrl.substring(5); - } - HttpUrl parsedUrl = HttpUrl.parse(baseUrl + fullPath); - if (parsedUrl == null) { - throw new IllegalArgumentException("Invalid WebSocket URL: " + baseUrl + fullPath); - } - HttpUrl.Builder urlBuilder = parsedUrl.newBuilder(); - Request.Builder requestBuilder = new Request.Builder().url(urlBuilder.build()); - clientOptions.headers(null).forEach(requestBuilder::addHeader); - final Request request = requestBuilder.build(); - this.readyState = WebSocketReadyState.CONNECTING; - ReconnectingWebSocketListener.ReconnectOptions reconnectOpts = - this.reconnectOptions != null - ? this.reconnectOptions - : ReconnectingWebSocketListener.ReconnectOptions.builder().build(); - this.reconnectingListener = - new ReconnectingWebSocketListener( - reconnectOpts, - () -> { - if (clientOptions.webSocketFactory().isPresent()) { - return clientOptions - .webSocketFactory() - .get() - .create(request, this.reconnectingListener); - } else { - return okHttpClient.newWebSocket(request, this.reconnectingListener); - } - }) { - @Override - protected void onWebSocketOpen(WebSocket webSocket, Response response) { - readyState = WebSocketReadyState.OPEN; - if (onConnectedHandler != null) { - onConnectedHandler.run(); - } - connectionFuture.complete(null); - } - - @Override - protected void onWebSocketMessage(WebSocket webSocket, String text) { - handleIncomingMessage(text); - } - - @Override - protected void onWebSocketBinaryMessage(WebSocket webSocket, ByteString bytes) { - if (agentV1AudioHandler != null) { - agentV1AudioHandler.accept(bytes); - } - } - - @Override - protected void onWebSocketFailure(WebSocket webSocket, Throwable t, Response response) { - readyState = WebSocketReadyState.CLOSED; - if (onErrorHandler != null) { - onErrorHandler.accept(new RuntimeException(t)); - } - connectionFuture.completeExceptionally(t); - } - - @Override - protected void onWebSocketClosed(WebSocket webSocket, int code, String reason) { - readyState = WebSocketReadyState.CLOSED; - if (onDisconnectedHandler != null) { - onDisconnectedHandler.accept(new DisconnectReason(code, reason)); - } - } - }; - reconnectingListener.connect(); - return connectionFuture; - } - - /** Disconnects the WebSocket connection and releases resources. */ - public void disconnect() { - reconnectingListener.disconnect(); - if (timeoutExecutor != null) { - timeoutExecutor.shutdownNow(); - timeoutExecutor = null; - } - } - - /** - * Gets the current state of the WebSocket connection. - * - *

This provides the actual connection state, similar to the W3C WebSocket API. - * - * @return the current WebSocket ready state - */ - public WebSocketReadyState getReadyState() { - return readyState; - } - - /** - * Sends an AgentV1Settings message to the server asynchronously. - * - * @param message the message to send - * @return a CompletableFuture that completes when the message is sent - */ - public CompletableFuture sendSettings(AgentV1Settings message) { - return sendMessage(message); - } - - /** - * Sends an AgentV1UpdateSpeak message to the server asynchronously. - * - * @param message the message to send - * @return a CompletableFuture that completes when the message is sent - */ - public CompletableFuture sendUpdateSpeak(AgentV1UpdateSpeak message) { - return sendMessage(message); - } - - /** - * Sends an AgentV1UpdateThink message to the server asynchronously. - * - * @param message the message to send - * @return a CompletableFuture that completes when the message is sent - */ - public CompletableFuture sendUpdateThink(AgentV1UpdateThink message) { - return sendMessage(message); - } - - /** - * Sends an AgentV1InjectUserMessage message to the server asynchronously. - * - * @param message the message to send - * @return a CompletableFuture that completes when the message is sent - */ - public CompletableFuture sendInjectUserMessage(AgentV1InjectUserMessage message) { - return sendMessage(message); - } - - /** - * Sends an AgentV1InjectAgentMessage message to the server asynchronously. - * - * @param message the message to send - * @return a CompletableFuture that completes when the message is sent - */ - public CompletableFuture sendInjectAgentMessage(AgentV1InjectAgentMessage message) { - return sendMessage(message); - } - - /** - * Sends an AgentV1SendFunctionCallResponse message to the server asynchronously. - * - * @param message the message to send - * @return a CompletableFuture that completes when the message is sent - */ - public CompletableFuture sendFunctionCallResponse(AgentV1SendFunctionCallResponse message) { - return sendMessage(message); - } - - /** - * Sends an AgentV1KeepAlive message to the server asynchronously. - * - * @param message the message to send - * @return a CompletableFuture that completes when the message is sent - */ - public CompletableFuture sendKeepAlive(AgentV1KeepAlive message) { - return sendMessage(message); - } - - /** - * Sends an AgentV1UpdatePrompt message to the server asynchronously. - * - * @param message the message to send - * @return a CompletableFuture that completes when the message is sent - */ - public CompletableFuture sendUpdatePrompt(AgentV1UpdatePrompt message) { - return sendMessage(message); - } - - /** - * Sends an AgentV1Media message to the server asynchronously. - * - * @param message the message to send - * @return a CompletableFuture that completes when the message is sent - */ - public CompletableFuture sendMedia(ByteString message) { - CompletableFuture future = new CompletableFuture<>(); - try { - assertSocketIsOpen(); - // Use reconnecting listener's sendBinary method which handles queuing - reconnectingListener.sendBinary(message); - future.complete(null); - } catch (Exception e) { - future.completeExceptionally(new RuntimeException("Failed to send binary data", e)); - } - return future; - } - - /** - * Registers a handler for AgentV1ReceiveFunctionCallResponse messages from the server. - * - * @param handler the handler to invoke when a message is received - */ - public void onFunctionCallResponse(Consumer handler) { - this.onFunctionCallResponseHandler = handler; - } - - /** - * Registers a handler for AgentV1PromptUpdated messages from the server. - * - * @param handler the handler to invoke when a message is received - */ - public void onPromptUpdated(Consumer handler) { - this.promptUpdatedHandler = handler; - } - - /** - * Registers a handler for AgentV1SpeakUpdated messages from the server. - * - * @param handler the handler to invoke when a message is received - */ - public void onSpeakUpdated(Consumer handler) { - this.speakUpdatedHandler = handler; - } - - /** - * Registers a handler for AgentV1ThinkUpdated messages from the server. - * - * @param handler the handler to invoke when a message is received - */ - public void onThinkUpdated(Consumer handler) { - this.thinkUpdatedHandler = handler; - } - - /** - * Registers a handler for AgentV1InjectionRefused messages from the server. - * - * @param handler the handler to invoke when a message is received - */ - public void onInjectionRefused(Consumer handler) { - this.injectionRefusedHandler = handler; - } - - /** - * Registers a handler for AgentV1Welcome messages from the server. - * - * @param handler the handler to invoke when a message is received - */ - public void onWelcome(Consumer handler) { - this.welcomeHandler = handler; - } - - /** - * Registers a handler for AgentV1SettingsApplied messages from the server. - * - * @param handler the handler to invoke when a message is received - */ - public void onSettingsApplied(Consumer handler) { - this.settingsAppliedHandler = handler; - } - - /** - * Registers a handler for AgentV1ConversationText messages from the server. - * - * @param handler the handler to invoke when a message is received - */ - public void onConversationText(Consumer handler) { - this.conversationTextHandler = handler; - } - - /** - * Registers a handler for AgentV1UserStartedSpeaking messages from the server. - * - * @param handler the handler to invoke when a message is received - */ - public void onUserStartedSpeaking(Consumer handler) { - this.userStartedSpeakingHandler = handler; - } - - /** - * Registers a handler for AgentV1AgentThinking messages from the server. - * - * @param handler the handler to invoke when a message is received - */ - public void onAgentThinking(Consumer handler) { - this.agentThinkingHandler = handler; - } - - /** - * Registers a handler for AgentV1FunctionCallRequest messages from the server. - * - * @param handler the handler to invoke when a message is received - */ - public void onFunctionCallRequest(Consumer handler) { - this.functionCallRequestHandler = handler; - } - - /** - * Registers a handler for AgentV1AgentStartedSpeaking messages from the server. - * - * @param handler the handler to invoke when a message is received - */ - public void onAgentStartedSpeaking(Consumer handler) { - this.agentStartedSpeakingHandler = handler; - } - - /** - * Registers a handler for AgentV1AgentAudioDone messages from the server. - * - * @param handler the handler to invoke when a message is received - */ - public void onAgentAudioDone(Consumer handler) { - this.agentAudioDoneHandler = handler; - } - - /** - * Registers a handler for AgentV1Error messages from the server. - * - * @param handler the handler to invoke when a message is received - */ - public void onErrorMessage(Consumer handler) { - this.errorHandler = handler; - } - - /** - * Registers a handler for AgentV1Warning messages from the server. - * - * @param handler the handler to invoke when a message is received - */ - public void onWarning(Consumer handler) { - this.warningHandler = handler; - } - - /** - * Registers a handler for AgentV1Audio messages from the server. - * - * @param handler the handler to invoke when a message is received - */ - public void onAgentV1Audio(Consumer handler) { - this.agentV1AudioHandler = handler; - } - - /** - * Registers a handler called when the connection is established. - * - * @param handler the handler to invoke when connected - */ - public void onConnected(Runnable handler) { - this.onConnectedHandler = handler; - } - - /** - * Registers a handler called when the connection is closed. - * - * @param handler the handler to invoke when disconnected - */ - public void onDisconnected(Consumer handler) { - this.onDisconnectedHandler = handler; - } - - /** - * Registers a handler called when an error occurs. - * - * @param handler the handler to invoke on error - */ - public void onError(Consumer handler) { - this.onErrorHandler = handler; - } - - /** - * Registers a handler called for every incoming text message. The handler receives the raw JSON - * string before type-specific dispatch. - * - * @param handler the handler to invoke with the raw message JSON - */ - public void onMessage(Consumer handler) { - this.onMessageHandler = handler; - } - - /** - * Configures reconnection behavior. Must be called before {@link #connect}. - * - * @param options the reconnection options (backoff, retries, queue size) - */ - public void reconnectOptions(ReconnectingWebSocketListener.ReconnectOptions options) { - this.reconnectOptions = options; - } - - /** - * Closes this WebSocket client, releasing all resources. Equivalent to calling {@link - * #disconnect()}. - */ - @Override - public void close() { - disconnect(); - } - - /** - * Ensures the WebSocket is connected and ready to send messages. - * - * @throws IllegalStateException if the socket is not connected or not open - */ - private void assertSocketIsOpen() { - if (reconnectingListener.getWebSocket() == null) { - throw new IllegalStateException("WebSocket is not connected. Call connect() first."); - } - if (readyState != WebSocketReadyState.OPEN) { - throw new IllegalStateException("WebSocket is not open. Current state: " + readyState); - } - } - - private CompletableFuture sendMessage(Object body) { - CompletableFuture future = new CompletableFuture<>(); - try { - assertSocketIsOpen(); - String json = objectMapper.writeValueAsString(body); - // Use reconnecting listener's send method which handles queuing - reconnectingListener.send(json); - future.complete(null); - } catch (IllegalStateException e) { - future.completeExceptionally(e); - } catch (Exception e) { - future.completeExceptionally(new RuntimeException("Failed to send message", e)); - } - return future; - } - - private void handleIncomingMessage(String json) { - try { - if (onMessageHandler != null) { - onMessageHandler.accept(json); - } - JsonNode node = objectMapper.readTree(json); - if (node == null || node.isNull()) { - throw new IllegalArgumentException("Received null or invalid JSON message"); - } - JsonNode typeNode = node.get("type"); - if (typeNode == null || typeNode.isNull()) { - throw new IllegalArgumentException("Message missing 'type' field"); - } - String type = typeNode.asText(); - switch (type) { - case "FunctionCallResponse": - if (onFunctionCallResponseHandler != null) { - AgentV1ReceiveFunctionCallResponse event = - objectMapper.treeToValue(node, AgentV1ReceiveFunctionCallResponse.class); - if (event != null) { - onFunctionCallResponseHandler.accept(event); - } - } - break; - case "PromptUpdated": - if (promptUpdatedHandler != null) { - AgentV1PromptUpdated event = objectMapper.treeToValue(node, AgentV1PromptUpdated.class); - if (event != null) { - promptUpdatedHandler.accept(event); - } - } - break; - case "SpeakUpdated": - if (speakUpdatedHandler != null) { - AgentV1SpeakUpdated event = objectMapper.treeToValue(node, AgentV1SpeakUpdated.class); - if (event != null) { - speakUpdatedHandler.accept(event); - } - } - break; - case "ThinkUpdated": - if (thinkUpdatedHandler != null) { - AgentV1ThinkUpdated event = objectMapper.treeToValue(node, AgentV1ThinkUpdated.class); - if (event != null) { - thinkUpdatedHandler.accept(event); - } - } - break; - case "InjectionRefused": - if (injectionRefusedHandler != null) { - AgentV1InjectionRefused event = - objectMapper.treeToValue(node, AgentV1InjectionRefused.class); - if (event != null) { - injectionRefusedHandler.accept(event); - } - } - break; - case "Welcome": - if (welcomeHandler != null) { - AgentV1Welcome event = objectMapper.treeToValue(node, AgentV1Welcome.class); - if (event != null) { - welcomeHandler.accept(event); - } - } - break; - case "SettingsApplied": - if (settingsAppliedHandler != null) { - AgentV1SettingsApplied event = - objectMapper.treeToValue(node, AgentV1SettingsApplied.class); - if (event != null) { - settingsAppliedHandler.accept(event); - } - } - break; - case "ConversationText": - if (conversationTextHandler != null) { - AgentV1ConversationText event = - objectMapper.treeToValue(node, AgentV1ConversationText.class); - if (event != null) { - conversationTextHandler.accept(event); - } - } - break; - case "UserStartedSpeaking": - if (userStartedSpeakingHandler != null) { - AgentV1UserStartedSpeaking event = - objectMapper.treeToValue(node, AgentV1UserStartedSpeaking.class); - if (event != null) { - userStartedSpeakingHandler.accept(event); - } - } - break; - case "AgentThinking": - if (agentThinkingHandler != null) { - AgentV1AgentThinking event = objectMapper.treeToValue(node, AgentV1AgentThinking.class); - if (event != null) { - agentThinkingHandler.accept(event); - } - } - break; - case "FunctionCallRequest": - if (functionCallRequestHandler != null) { - AgentV1FunctionCallRequest event = - objectMapper.treeToValue(node, AgentV1FunctionCallRequest.class); - if (event != null) { - functionCallRequestHandler.accept(event); - } - } - break; - case "AgentStartedSpeaking": - if (agentStartedSpeakingHandler != null) { - AgentV1AgentStartedSpeaking event = - objectMapper.treeToValue(node, AgentV1AgentStartedSpeaking.class); - if (event != null) { - agentStartedSpeakingHandler.accept(event); - } - } - break; - case "AgentAudioDone": - if (agentAudioDoneHandler != null) { - AgentV1AgentAudioDone event = - objectMapper.treeToValue(node, AgentV1AgentAudioDone.class); - if (event != null) { - agentAudioDoneHandler.accept(event); - } - } - break; - case "Error": - if (errorHandler != null) { - AgentV1Error event = objectMapper.treeToValue(node, AgentV1Error.class); - if (event != null) { - errorHandler.accept(event); - } - } - break; - case "Warning": - if (warningHandler != null) { - AgentV1Warning event = objectMapper.treeToValue(node, AgentV1Warning.class); - if (event != null) { - warningHandler.accept(event); - } - } - break; - default: - if (onErrorHandler != null) { - onErrorHandler.accept( - new RuntimeException( - "Unknown WebSocket message type: '" - + type - + "'. Update your SDK version to support new message types.")); - } - break; - } - } catch (Exception e) { - if (onErrorHandler != null) { - onErrorHandler.accept(e); - } - } - } -} diff --git a/src/main/java/resources/auth/AsyncAuthClient.java b/src/main/java/resources/auth/AsyncAuthClient.java deleted file mode 100644 index 83baadc..0000000 --- a/src/main/java/resources/auth/AsyncAuthClient.java +++ /dev/null @@ -1,22 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.auth; - -import core.ClientOptions; -import core.Suppliers; -import java.util.function.Supplier; -import resources.auth.v1.AsyncV1Client; - -public class AsyncAuthClient { - protected final ClientOptions clientOptions; - - protected final Supplier v1Client; - - public AsyncAuthClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.v1Client = Suppliers.memoize(() -> new AsyncV1Client(clientOptions)); - } - - public AsyncV1Client v1() { - return this.v1Client.get(); - } -} diff --git a/src/main/java/resources/auth/AuthClient.java b/src/main/java/resources/auth/AuthClient.java deleted file mode 100644 index 104bfbf..0000000 --- a/src/main/java/resources/auth/AuthClient.java +++ /dev/null @@ -1,22 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.auth; - -import core.ClientOptions; -import core.Suppliers; -import java.util.function.Supplier; -import resources.auth.v1.V1Client; - -public class AuthClient { - protected final ClientOptions clientOptions; - - protected final Supplier v1Client; - - public AuthClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.v1Client = Suppliers.memoize(() -> new V1Client(clientOptions)); - } - - public V1Client v1() { - return this.v1Client.get(); - } -} diff --git a/src/main/java/resources/auth/v1/AsyncV1Client.java b/src/main/java/resources/auth/v1/AsyncV1Client.java deleted file mode 100644 index 3bfed3a..0000000 --- a/src/main/java/resources/auth/v1/AsyncV1Client.java +++ /dev/null @@ -1,22 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.auth.v1; - -import core.ClientOptions; -import core.Suppliers; -import java.util.function.Supplier; -import resources.auth.v1.tokens.AsyncTokensClient; - -public class AsyncV1Client { - protected final ClientOptions clientOptions; - - protected final Supplier tokensClient; - - public AsyncV1Client(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.tokensClient = Suppliers.memoize(() -> new AsyncTokensClient(clientOptions)); - } - - public AsyncTokensClient tokens() { - return this.tokensClient.get(); - } -} diff --git a/src/main/java/resources/auth/v1/V1Client.java b/src/main/java/resources/auth/v1/V1Client.java deleted file mode 100644 index e42261d..0000000 --- a/src/main/java/resources/auth/v1/V1Client.java +++ /dev/null @@ -1,22 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.auth.v1; - -import core.ClientOptions; -import core.Suppliers; -import java.util.function.Supplier; -import resources.auth.v1.tokens.TokensClient; - -public class V1Client { - protected final ClientOptions clientOptions; - - protected final Supplier tokensClient; - - public V1Client(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.tokensClient = Suppliers.memoize(() -> new TokensClient(clientOptions)); - } - - public TokensClient tokens() { - return this.tokensClient.get(); - } -} diff --git a/src/main/java/resources/auth/v1/tokens/AsyncRawTokensClient.java b/src/main/java/resources/auth/v1/tokens/AsyncRawTokensClient.java deleted file mode 100644 index 60b9a88..0000000 --- a/src/main/java/resources/auth/v1/tokens/AsyncRawTokensClient.java +++ /dev/null @@ -1,153 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.auth.v1.tokens; - -import com.fasterxml.jackson.core.JsonProcessingException; -import core.ClientOptions; -import core.DeepgramApiApiException; -import core.DeepgramApiException; -import core.DeepgramApiHttpResponse; -import core.MediaTypes; -import core.ObjectMappers; -import core.RequestOptions; -import errors.BadRequestError; -import java.io.IOException; -import java.util.concurrent.CompletableFuture; -import okhttp3.Call; -import okhttp3.Callback; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; -import okhttp3.ResponseBody; -import org.jetbrains.annotations.NotNull; -import resources.auth.v1.tokens.requests.GrantV1Request; -import types.GrantV1Response; - -public class AsyncRawTokensClient { - protected final ClientOptions clientOptions; - - public AsyncRawTokensClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** - * Generates a temporary JSON Web Token (JWT) with a 30-second (by default) TTL and usage::write - * permission for core voice APIs, requiring an API key with Member or higher authorization. - * Tokens created with this endpoint will not work with the Manage APIs. - */ - public CompletableFuture> grant() { - return grant(GrantV1Request.builder().build()); - } - - /** - * Generates a temporary JSON Web Token (JWT) with a 30-second (by default) TTL and usage::write - * permission for core voice APIs, requiring an API key with Member or higher authorization. - * Tokens created with this endpoint will not work with the Manage APIs. - */ - public CompletableFuture> grant( - RequestOptions requestOptions) { - return grant(GrantV1Request.builder().build(), requestOptions); - } - - /** - * Generates a temporary JSON Web Token (JWT) with a 30-second (by default) TTL and usage::write - * permission for core voice APIs, requiring an API key with Member or higher authorization. - * Tokens created with this endpoint will not work with the Manage APIs. - */ - public CompletableFuture> grant(GrantV1Request request) { - return grant(request, null); - } - - /** - * Generates a temporary JSON Web Token (JWT) with a 30-second (by default) TTL and usage::write - * permission for core voice APIs, requiring an API key with Member or higher authorization. - * Tokens created with this endpoint will not work with the Manage APIs. - */ - public CompletableFuture> grant( - GrantV1Request request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/auth/grant"); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - RequestBody body; - try { - body = - RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); - } catch (JsonProcessingException e) { - throw new DeepgramApiException("Failed to serialize request", e); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = new CompletableFuture<>(); - client - .newCall(okhttpRequest) - .enqueue( - new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) - throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete( - new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, GrantV1Response.class), - response)); - return; - } - try { - if (response.code() == 400) { - future.completeExceptionally( - new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally( - new DeepgramApiApiException( - "Error with status code " + response.code(), - response.code(), - errorBody, - response)); - return; - } catch (IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - }); - return future; - } -} diff --git a/src/main/java/resources/auth/v1/tokens/AsyncTokensClient.java b/src/main/java/resources/auth/v1/tokens/AsyncTokensClient.java deleted file mode 100644 index 60aeeff..0000000 --- a/src/main/java/resources/auth/v1/tokens/AsyncTokensClient.java +++ /dev/null @@ -1,61 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.auth.v1.tokens; - -import core.ClientOptions; -import core.RequestOptions; -import java.util.concurrent.CompletableFuture; -import resources.auth.v1.tokens.requests.GrantV1Request; -import types.GrantV1Response; - -public class AsyncTokensClient { - protected final ClientOptions clientOptions; - - private final AsyncRawTokensClient rawClient; - - public AsyncTokensClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new AsyncRawTokensClient(clientOptions); - } - - /** Get responses with HTTP metadata like headers */ - public AsyncRawTokensClient withRawResponse() { - return this.rawClient; - } - - /** - * Generates a temporary JSON Web Token (JWT) with a 30-second (by default) TTL and usage::write - * permission for core voice APIs, requiring an API key with Member or higher authorization. - * Tokens created with this endpoint will not work with the Manage APIs. - */ - public CompletableFuture grant() { - return this.rawClient.grant().thenApply(response -> response.body()); - } - - /** - * Generates a temporary JSON Web Token (JWT) with a 30-second (by default) TTL and usage::write - * permission for core voice APIs, requiring an API key with Member or higher authorization. - * Tokens created with this endpoint will not work with the Manage APIs. - */ - public CompletableFuture grant(RequestOptions requestOptions) { - return this.rawClient.grant(requestOptions).thenApply(response -> response.body()); - } - - /** - * Generates a temporary JSON Web Token (JWT) with a 30-second (by default) TTL and usage::write - * permission for core voice APIs, requiring an API key with Member or higher authorization. - * Tokens created with this endpoint will not work with the Manage APIs. - */ - public CompletableFuture grant(GrantV1Request request) { - return this.rawClient.grant(request).thenApply(response -> response.body()); - } - - /** - * Generates a temporary JSON Web Token (JWT) with a 30-second (by default) TTL and usage::write - * permission for core voice APIs, requiring an API key with Member or higher authorization. - * Tokens created with this endpoint will not work with the Manage APIs. - */ - public CompletableFuture grant( - GrantV1Request request, RequestOptions requestOptions) { - return this.rawClient.grant(request, requestOptions).thenApply(response -> response.body()); - } -} diff --git a/src/main/java/resources/auth/v1/tokens/RawTokensClient.java b/src/main/java/resources/auth/v1/tokens/RawTokensClient.java deleted file mode 100644 index 84aacdc..0000000 --- a/src/main/java/resources/auth/v1/tokens/RawTokensClient.java +++ /dev/null @@ -1,120 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.auth.v1.tokens; - -import com.fasterxml.jackson.core.JsonProcessingException; -import core.ClientOptions; -import core.DeepgramApiApiException; -import core.DeepgramApiException; -import core.DeepgramApiHttpResponse; -import core.MediaTypes; -import core.ObjectMappers; -import core.RequestOptions; -import errors.BadRequestError; -import java.io.IOException; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; -import okhttp3.ResponseBody; -import resources.auth.v1.tokens.requests.GrantV1Request; -import types.GrantV1Response; - -public class RawTokensClient { - protected final ClientOptions clientOptions; - - public RawTokensClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** - * Generates a temporary JSON Web Token (JWT) with a 30-second (by default) TTL and usage::write - * permission for core voice APIs, requiring an API key with Member or higher authorization. - * Tokens created with this endpoint will not work with the Manage APIs. - */ - public DeepgramApiHttpResponse grant() { - return grant(GrantV1Request.builder().build()); - } - - /** - * Generates a temporary JSON Web Token (JWT) with a 30-second (by default) TTL and usage::write - * permission for core voice APIs, requiring an API key with Member or higher authorization. - * Tokens created with this endpoint will not work with the Manage APIs. - */ - public DeepgramApiHttpResponse grant(RequestOptions requestOptions) { - return grant(GrantV1Request.builder().build(), requestOptions); - } - - /** - * Generates a temporary JSON Web Token (JWT) with a 30-second (by default) TTL and usage::write - * permission for core voice APIs, requiring an API key with Member or higher authorization. - * Tokens created with this endpoint will not work with the Manage APIs. - */ - public DeepgramApiHttpResponse grant(GrantV1Request request) { - return grant(request, null); - } - - /** - * Generates a temporary JSON Web Token (JWT) with a 30-second (by default) TTL and usage::write - * permission for core voice APIs, requiring an API key with Member or higher authorization. - * Tokens created with this endpoint will not work with the Manage APIs. - */ - public DeepgramApiHttpResponse grant( - GrantV1Request request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/auth/grant"); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - RequestBody body; - try { - body = - RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); - } catch (JsonProcessingException e) { - throw new DeepgramApiException("Failed to serialize request", e); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .addHeader("Accept", "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(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GrantV1Response.class), - response); - } - try { - if (response.code() == 400) { - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new DeepgramApiApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (IOException e) { - throw new DeepgramApiException("Network error executing HTTP request", e); - } - } -} diff --git a/src/main/java/resources/auth/v1/tokens/TokensClient.java b/src/main/java/resources/auth/v1/tokens/TokensClient.java deleted file mode 100644 index e86e6f9..0000000 --- a/src/main/java/resources/auth/v1/tokens/TokensClient.java +++ /dev/null @@ -1,59 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.auth.v1.tokens; - -import core.ClientOptions; -import core.RequestOptions; -import resources.auth.v1.tokens.requests.GrantV1Request; -import types.GrantV1Response; - -public class TokensClient { - protected final ClientOptions clientOptions; - - private final RawTokensClient rawClient; - - public TokensClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new RawTokensClient(clientOptions); - } - - /** Get responses with HTTP metadata like headers */ - public RawTokensClient withRawResponse() { - return this.rawClient; - } - - /** - * Generates a temporary JSON Web Token (JWT) with a 30-second (by default) TTL and usage::write - * permission for core voice APIs, requiring an API key with Member or higher authorization. - * Tokens created with this endpoint will not work with the Manage APIs. - */ - public GrantV1Response grant() { - return this.rawClient.grant().body(); - } - - /** - * Generates a temporary JSON Web Token (JWT) with a 30-second (by default) TTL and usage::write - * permission for core voice APIs, requiring an API key with Member or higher authorization. - * Tokens created with this endpoint will not work with the Manage APIs. - */ - public GrantV1Response grant(RequestOptions requestOptions) { - return this.rawClient.grant(requestOptions).body(); - } - - /** - * Generates a temporary JSON Web Token (JWT) with a 30-second (by default) TTL and usage::write - * permission for core voice APIs, requiring an API key with Member or higher authorization. - * Tokens created with this endpoint will not work with the Manage APIs. - */ - public GrantV1Response grant(GrantV1Request request) { - return this.rawClient.grant(request).body(); - } - - /** - * Generates a temporary JSON Web Token (JWT) with a 30-second (by default) TTL and usage::write - * permission for core voice APIs, requiring an API key with Member or higher authorization. - * Tokens created with this endpoint will not work with the Manage APIs. - */ - public GrantV1Response grant(GrantV1Request request, RequestOptions requestOptions) { - return this.rawClient.grant(request, requestOptions).body(); - } -} diff --git a/src/main/java/resources/auth/v1/tokens/requests/GrantV1Request.java b/src/main/java/resources/auth/v1/tokens/requests/GrantV1Request.java deleted file mode 100644 index 7d52a53..0000000 --- a/src/main/java/resources/auth/v1/tokens/requests/GrantV1Request.java +++ /dev/null @@ -1,106 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.auth.v1.tokens.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 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 = GrantV1Request.Builder.class) -public final class GrantV1Request { - private final Optional ttlSeconds; - - private final Map additionalProperties; - - private GrantV1Request(Optional ttlSeconds, Map additionalProperties) { - this.ttlSeconds = ttlSeconds; - this.additionalProperties = additionalProperties; - } - - /** - * @return Time to live in seconds for the token. Defaults to 30 seconds. - */ - @JsonProperty("ttl_seconds") - public Optional getTtlSeconds() { - return ttlSeconds; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof GrantV1Request && equalTo((GrantV1Request) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(GrantV1Request other) { - return ttlSeconds.equals(other.ttlSeconds); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.ttlSeconds); - } - - @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 ttlSeconds = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(GrantV1Request other) { - ttlSeconds(other.getTtlSeconds()); - return this; - } - - /** Time to live in seconds for the token. Defaults to 30 seconds. */ - @JsonSetter(value = "ttl_seconds", nulls = Nulls.SKIP) - public Builder ttlSeconds(Optional ttlSeconds) { - this.ttlSeconds = ttlSeconds; - return this; - } - - public Builder ttlSeconds(Double ttlSeconds) { - this.ttlSeconds = Optional.ofNullable(ttlSeconds); - return this; - } - - public GrantV1Request build() { - return new GrantV1Request(ttlSeconds, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/listen/AsyncListenClient.java b/src/main/java/resources/listen/AsyncListenClient.java deleted file mode 100644 index ee59f9f..0000000 --- a/src/main/java/resources/listen/AsyncListenClient.java +++ /dev/null @@ -1,30 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen; - -import core.ClientOptions; -import core.Suppliers; -import java.util.function.Supplier; -import resources.listen.v1.AsyncV1Client; -import resources.listen.v2.AsyncV2Client; - -public class AsyncListenClient { - protected final ClientOptions clientOptions; - - protected final Supplier v1Client; - - protected final Supplier v2Client; - - public AsyncListenClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.v1Client = Suppliers.memoize(() -> new AsyncV1Client(clientOptions)); - this.v2Client = Suppliers.memoize(() -> new AsyncV2Client(clientOptions)); - } - - public AsyncV1Client v1() { - return this.v1Client.get(); - } - - public AsyncV2Client v2() { - return this.v2Client.get(); - } -} diff --git a/src/main/java/resources/listen/ListenClient.java b/src/main/java/resources/listen/ListenClient.java deleted file mode 100644 index 57784d9..0000000 --- a/src/main/java/resources/listen/ListenClient.java +++ /dev/null @@ -1,30 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen; - -import core.ClientOptions; -import core.Suppliers; -import java.util.function.Supplier; -import resources.listen.v1.V1Client; -import resources.listen.v2.V2Client; - -public class ListenClient { - protected final ClientOptions clientOptions; - - protected final Supplier v1Client; - - protected final Supplier v2Client; - - public ListenClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.v1Client = Suppliers.memoize(() -> new V1Client(clientOptions)); - this.v2Client = Suppliers.memoize(() -> new V2Client(clientOptions)); - } - - public V1Client v1() { - return this.v1Client.get(); - } - - public V2Client v2() { - return this.v2Client.get(); - } -} diff --git a/src/main/java/resources/listen/v1/AsyncV1Client.java b/src/main/java/resources/listen/v1/AsyncV1Client.java deleted file mode 100644 index 31f2b12..0000000 --- a/src/main/java/resources/listen/v1/AsyncV1Client.java +++ /dev/null @@ -1,28 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v1; - -import core.ClientOptions; -import core.Suppliers; -import java.util.function.Supplier; -import resources.listen.v1.media.AsyncMediaClient; -import resources.listen.v1.websocket.V1WebSocketClient; - -public class AsyncV1Client { - protected final ClientOptions clientOptions; - - protected final Supplier mediaClient; - - public AsyncV1Client(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.mediaClient = Suppliers.memoize(() -> new AsyncMediaClient(clientOptions)); - } - - /** Creates a new WebSocket client for the v1 channel. */ - public V1WebSocketClient v1WebSocket() { - return new V1WebSocketClient(clientOptions); - } - - public AsyncMediaClient media() { - return this.mediaClient.get(); - } -} diff --git a/src/main/java/resources/listen/v1/V1Client.java b/src/main/java/resources/listen/v1/V1Client.java deleted file mode 100644 index 0bffad1..0000000 --- a/src/main/java/resources/listen/v1/V1Client.java +++ /dev/null @@ -1,28 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v1; - -import core.ClientOptions; -import core.Suppliers; -import java.util.function.Supplier; -import resources.listen.v1.media.MediaClient; -import resources.listen.v1.websocket.V1WebSocketClient; - -public class V1Client { - protected final ClientOptions clientOptions; - - protected final Supplier mediaClient; - - public V1Client(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.mediaClient = Suppliers.memoize(() -> new MediaClient(clientOptions)); - } - - /** Creates a new WebSocket client for the v1 channel. */ - public V1WebSocketClient v1WebSocket() { - return new V1WebSocketClient(clientOptions); - } - - public MediaClient media() { - return this.mediaClient.get(); - } -} diff --git a/src/main/java/resources/listen/v1/media/AsyncMediaClient.java b/src/main/java/resources/listen/v1/media/AsyncMediaClient.java deleted file mode 100644 index 77b7326..0000000 --- a/src/main/java/resources/listen/v1/media/AsyncMediaClient.java +++ /dev/null @@ -1,65 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v1.media; - -import core.ClientOptions; -import core.RequestOptions; -import java.util.concurrent.CompletableFuture; -import resources.listen.v1.media.requests.ListenV1RequestUrl; -import resources.listen.v1.media.requests.MediaTranscribeRequestOctetStream; -import resources.listen.v1.media.types.MediaTranscribeResponse; - -public class AsyncMediaClient { - protected final ClientOptions clientOptions; - - private final AsyncRawMediaClient rawClient; - - public AsyncMediaClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new AsyncRawMediaClient(clientOptions); - } - - /** Get responses with HTTP metadata like headers */ - public AsyncRawMediaClient withRawResponse() { - return this.rawClient; - } - - /** Transcribe audio and video using Deepgram's speech-to-text REST API */ - public CompletableFuture transcribeUrl(ListenV1RequestUrl request) { - return this.rawClient.transcribeUrl(request).thenApply(response -> response.body()); - } - - /** Transcribe audio and video using Deepgram's speech-to-text REST API */ - public CompletableFuture transcribeUrl( - ListenV1RequestUrl request, RequestOptions requestOptions) { - return this.rawClient - .transcribeUrl(request, requestOptions) - .thenApply(response -> response.body()); - } - - /** Transcribe audio and video using Deepgram's speech-to-text REST API */ - public CompletableFuture transcribeFile(byte[] body) { - return this.rawClient.transcribeFile(body).thenApply(response -> response.body()); - } - - /** Transcribe audio and video using Deepgram's speech-to-text REST API */ - public CompletableFuture transcribeFile( - byte[] body, RequestOptions requestOptions) { - return this.rawClient - .transcribeFile(body, requestOptions) - .thenApply(response -> response.body()); - } - - /** Transcribe audio and video using Deepgram's speech-to-text REST API */ - public CompletableFuture transcribeFile( - MediaTranscribeRequestOctetStream request) { - return this.rawClient.transcribeFile(request).thenApply(response -> response.body()); - } - - /** Transcribe audio and video using Deepgram's speech-to-text REST API */ - public CompletableFuture transcribeFile( - MediaTranscribeRequestOctetStream request, RequestOptions requestOptions) { - return this.rawClient - .transcribeFile(request, requestOptions) - .thenApply(response -> response.body()); - } -} diff --git a/src/main/java/resources/listen/v1/media/AsyncRawMediaClient.java b/src/main/java/resources/listen/v1/media/AsyncRawMediaClient.java deleted file mode 100644 index 3194b19..0000000 --- a/src/main/java/resources/listen/v1/media/AsyncRawMediaClient.java +++ /dev/null @@ -1,490 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v1.media; - -import com.fasterxml.jackson.core.JsonProcessingException; -import core.ClientOptions; -import core.DeepgramApiApiException; -import core.DeepgramApiException; -import core.DeepgramApiHttpResponse; -import core.InputStreamRequestBody; -import core.MediaTypes; -import core.ObjectMappers; -import core.QueryStringMapper; -import core.RequestOptions; -import errors.BadRequestError; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.util.concurrent.CompletableFuture; -import okhttp3.Call; -import okhttp3.Callback; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.MediaType; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; -import okhttp3.ResponseBody; -import org.jetbrains.annotations.NotNull; -import resources.listen.v1.media.requests.ListenV1RequestUrl; -import resources.listen.v1.media.requests.MediaTranscribeRequestOctetStream; -import resources.listen.v1.media.types.MediaTranscribeResponse; - -public class AsyncRawMediaClient { - protected final ClientOptions clientOptions; - - public AsyncRawMediaClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** Transcribe audio and video using Deepgram's speech-to-text REST API */ - public CompletableFuture> transcribeUrl( - ListenV1RequestUrl request) { - return transcribeUrl(request, null); - } - - /** Transcribe audio and video using Deepgram's speech-to-text REST API */ - public CompletableFuture> transcribeUrl( - ListenV1RequestUrl request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/listen"); - if (request.getCallback().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "callback", request.getCallback().get(), false); - } - if (request.getCallbackMethod().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "callback_method", request.getCallbackMethod().get(), false); - } - if (request.getSentiment().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "sentiment", request.getSentiment().get(), false); - } - if (request.getSummarize().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "summarize", request.getSummarize().get(), false); - } - if (request.getTopics().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "topics", request.getTopics().get(), false); - } - if (request.getCustomTopicMode().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "custom_topic_mode", request.getCustomTopicMode().get(), false); - } - if (request.getIntents().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "intents", request.getIntents().get(), false); - } - if (request.getCustomIntentMode().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "custom_intent_mode", request.getCustomIntentMode().get(), false); - } - if (request.getDetectEntities().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "detect_entities", request.getDetectEntities().get(), false); - } - if (request.getDetectLanguage().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "detect_language", request.getDetectLanguage().get(), false); - } - if (request.getDiarize().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "diarize", request.getDiarize().get(), false); - } - if (request.getDictation().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "dictation", request.getDictation().get(), false); - } - if (request.getEncoding().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "encoding", request.getEncoding().get(), false); - } - if (request.getFillerWords().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "filler_words", request.getFillerWords().get(), false); - } - if (request.getLanguage().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "language", request.getLanguage().get(), false); - } - if (request.getMeasurements().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "measurements", request.getMeasurements().get(), false); - } - if (request.getModel().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "model", request.getModel().get(), false); - } - if (request.getMultichannel().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "multichannel", request.getMultichannel().get(), false); - } - if (request.getNumerals().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "numerals", request.getNumerals().get(), false); - } - if (request.getParagraphs().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "paragraphs", request.getParagraphs().get(), false); - } - if (request.getProfanityFilter().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "profanity_filter", request.getProfanityFilter().get(), false); - } - if (request.getPunctuate().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "punctuate", request.getPunctuate().get(), false); - } - if (request.getRedact().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "redact", request.getRedact().get(), false); - } - if (request.getSmartFormat().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "smart_format", request.getSmartFormat().get(), false); - } - if (request.getUtterances().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "utterances", request.getUtterances().get(), false); - } - if (request.getUttSplit().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "utt_split", request.getUttSplit().get(), false); - } - if (request.getVersion().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "version", request.getVersion().get(), false); - } - if (request.getMipOptOut().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "mip_opt_out", request.getMipOptOut().get(), false); - } - if (request.getExtra().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "extra", request.getExtra().get(), true); - } - if (request.getTag().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "tag", request.getTag().get(), true); - } - if (request.getCustomTopic().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "custom_topic", request.getCustomTopic().get(), true); - } - if (request.getCustomIntent().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "custom_intent", request.getCustomIntent().get(), true); - } - if (request.getKeyterm().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "keyterm", request.getKeyterm().get(), true); - } - if (request.getKeywords().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "keywords", request.getKeywords().get(), true); - } - if (request.getReplace().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "replace", request.getReplace().get(), true); - } - if (request.getSearch().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "search", request.getSearch().get(), true); - } - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - RequestBody body; - try { - body = - RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = - new Request.Builder() - .url(httpUrl.build()) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .addHeader("Accept", "application/json"); - Request okhttpRequest = _requestBuilder.build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = - new CompletableFuture<>(); - client - .newCall(okhttpRequest) - .enqueue( - new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) - throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete( - new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, MediaTranscribeResponse.class), - response)); - return; - } - try { - if (response.code() == 400) { - future.completeExceptionally( - new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally( - new DeepgramApiApiException( - "Error with status code " + response.code(), - response.code(), - errorBody, - response)); - return; - } catch (IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - }); - return future; - } - - /** Transcribe audio and video using Deepgram's speech-to-text REST API */ - public CompletableFuture> transcribeFile( - byte[] body) { - return transcribeFile(MediaTranscribeRequestOctetStream.builder().body(body).build()); - } - - /** Transcribe audio and video using Deepgram's speech-to-text REST API */ - public CompletableFuture> transcribeFile( - byte[] body, RequestOptions requestOptions) { - return transcribeFile( - MediaTranscribeRequestOctetStream.builder().body(body).build(), requestOptions); - } - - /** Transcribe audio and video using Deepgram's speech-to-text REST API */ - public CompletableFuture> transcribeFile( - MediaTranscribeRequestOctetStream request) { - return transcribeFile(request, null); - } - - /** Transcribe audio and video using Deepgram's speech-to-text REST API */ - public CompletableFuture> transcribeFile( - MediaTranscribeRequestOctetStream request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/listen"); - if (request.getCallback().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "callback", request.getCallback().get(), false); - } - if (request.getCallbackMethod().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "callback_method", request.getCallbackMethod().get(), false); - } - if (request.getSentiment().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "sentiment", request.getSentiment().get(), false); - } - if (request.getSummarize().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "summarize", request.getSummarize().get(), false); - } - if (request.getTopics().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "topics", request.getTopics().get(), false); - } - if (request.getCustomTopicMode().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "custom_topic_mode", request.getCustomTopicMode().get(), false); - } - if (request.getIntents().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "intents", request.getIntents().get(), false); - } - if (request.getCustomIntentMode().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "custom_intent_mode", request.getCustomIntentMode().get(), false); - } - if (request.getDetectEntities().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "detect_entities", request.getDetectEntities().get(), false); - } - if (request.getDetectLanguage().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "detect_language", request.getDetectLanguage().get(), false); - } - if (request.getDiarize().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "diarize", request.getDiarize().get(), false); - } - if (request.getDictation().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "dictation", request.getDictation().get(), false); - } - if (request.getEncoding().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "encoding", request.getEncoding().get(), false); - } - if (request.getFillerWords().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "filler_words", request.getFillerWords().get(), false); - } - if (request.getLanguage().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "language", request.getLanguage().get(), false); - } - if (request.getMeasurements().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "measurements", request.getMeasurements().get(), false); - } - if (request.getModel().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "model", request.getModel().get(), false); - } - if (request.getMultichannel().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "multichannel", request.getMultichannel().get(), false); - } - if (request.getNumerals().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "numerals", request.getNumerals().get(), false); - } - if (request.getParagraphs().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "paragraphs", request.getParagraphs().get(), false); - } - if (request.getProfanityFilter().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "profanity_filter", request.getProfanityFilter().get(), false); - } - if (request.getPunctuate().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "punctuate", request.getPunctuate().get(), false); - } - if (request.getRedact().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "redact", request.getRedact().get(), false); - } - if (request.getSmartFormat().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "smart_format", request.getSmartFormat().get(), false); - } - if (request.getUtterances().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "utterances", request.getUtterances().get(), false); - } - if (request.getUttSplit().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "utt_split", request.getUttSplit().get(), false); - } - if (request.getVersion().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "version", request.getVersion().get(), false); - } - if (request.getMipOptOut().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "mip_opt_out", request.getMipOptOut().get(), false); - } - if (request.getExtra().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "extra", request.getExtra().get(), true); - } - if (request.getTag().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "tag", request.getTag().get(), true); - } - if (request.getCustomTopic().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "custom_topic", request.getCustomTopic().get(), true); - } - if (request.getCustomIntent().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "custom_intent", request.getCustomIntent().get(), true); - } - if (request.getKeyterm().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "keyterm", request.getKeyterm().get(), true); - } - if (request.getKeywords().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "keywords", request.getKeywords().get(), true); - } - if (request.getReplace().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "replace", request.getReplace().get(), true); - } - if (request.getSearch().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "search", request.getSearch().get(), true); - } - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - RequestBody body = - new InputStreamRequestBody( - MediaType.parse("application/octet-stream"), - new ByteArrayInputStream(request.getBody())); - Request.Builder _requestBuilder = - new Request.Builder() - .url(httpUrl.build()) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/octet-stream") - .addHeader("Accept", "application/json"); - Request okhttpRequest = _requestBuilder.build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = - new CompletableFuture<>(); - client - .newCall(okhttpRequest) - .enqueue( - new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) - throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete( - new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, MediaTranscribeResponse.class), - response)); - return; - } - try { - if (response.code() == 400) { - future.completeExceptionally( - new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally( - new DeepgramApiApiException( - "Error with status code " + response.code(), - response.code(), - errorBody, - response)); - return; - } catch (IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - }); - return future; - } -} diff --git a/src/main/java/resources/listen/v1/media/MediaClient.java b/src/main/java/resources/listen/v1/media/MediaClient.java deleted file mode 100644 index 7fd7a54..0000000 --- a/src/main/java/resources/listen/v1/media/MediaClient.java +++ /dev/null @@ -1,56 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v1.media; - -import core.ClientOptions; -import core.RequestOptions; -import resources.listen.v1.media.requests.ListenV1RequestUrl; -import resources.listen.v1.media.requests.MediaTranscribeRequestOctetStream; -import resources.listen.v1.media.types.MediaTranscribeResponse; - -public class MediaClient { - protected final ClientOptions clientOptions; - - private final RawMediaClient rawClient; - - public MediaClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new RawMediaClient(clientOptions); - } - - /** Get responses with HTTP metadata like headers */ - public RawMediaClient withRawResponse() { - return this.rawClient; - } - - /** Transcribe audio and video using Deepgram's speech-to-text REST API */ - public MediaTranscribeResponse transcribeUrl(ListenV1RequestUrl request) { - return this.rawClient.transcribeUrl(request).body(); - } - - /** Transcribe audio and video using Deepgram's speech-to-text REST API */ - public MediaTranscribeResponse transcribeUrl( - ListenV1RequestUrl request, RequestOptions requestOptions) { - return this.rawClient.transcribeUrl(request, requestOptions).body(); - } - - /** Transcribe audio and video using Deepgram's speech-to-text REST API */ - public MediaTranscribeResponse transcribeFile(byte[] body) { - return this.rawClient.transcribeFile(body).body(); - } - - /** Transcribe audio and video using Deepgram's speech-to-text REST API */ - public MediaTranscribeResponse transcribeFile(byte[] body, RequestOptions requestOptions) { - return this.rawClient.transcribeFile(body, requestOptions).body(); - } - - /** Transcribe audio and video using Deepgram's speech-to-text REST API */ - public MediaTranscribeResponse transcribeFile(MediaTranscribeRequestOctetStream request) { - return this.rawClient.transcribeFile(request).body(); - } - - /** Transcribe audio and video using Deepgram's speech-to-text REST API */ - public MediaTranscribeResponse transcribeFile( - MediaTranscribeRequestOctetStream request, RequestOptions requestOptions) { - return this.rawClient.transcribeFile(request, requestOptions).body(); - } -} diff --git a/src/main/java/resources/listen/v1/media/RawMediaClient.java b/src/main/java/resources/listen/v1/media/RawMediaClient.java deleted file mode 100644 index cce6990..0000000 --- a/src/main/java/resources/listen/v1/media/RawMediaClient.java +++ /dev/null @@ -1,427 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v1.media; - -import com.fasterxml.jackson.core.JsonProcessingException; -import core.ClientOptions; -import core.DeepgramApiApiException; -import core.DeepgramApiException; -import core.DeepgramApiHttpResponse; -import core.InputStreamRequestBody; -import core.MediaTypes; -import core.ObjectMappers; -import core.QueryStringMapper; -import core.RequestOptions; -import errors.BadRequestError; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.MediaType; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; -import okhttp3.ResponseBody; -import resources.listen.v1.media.requests.ListenV1RequestUrl; -import resources.listen.v1.media.requests.MediaTranscribeRequestOctetStream; -import resources.listen.v1.media.types.MediaTranscribeResponse; - -public class RawMediaClient { - protected final ClientOptions clientOptions; - - public RawMediaClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** Transcribe audio and video using Deepgram's speech-to-text REST API */ - public DeepgramApiHttpResponse transcribeUrl( - ListenV1RequestUrl request) { - return transcribeUrl(request, null); - } - - /** Transcribe audio and video using Deepgram's speech-to-text REST API */ - public DeepgramApiHttpResponse transcribeUrl( - ListenV1RequestUrl request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/listen"); - if (request.getCallback().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "callback", request.getCallback().get(), false); - } - if (request.getCallbackMethod().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "callback_method", request.getCallbackMethod().get(), false); - } - if (request.getSentiment().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "sentiment", request.getSentiment().get(), false); - } - if (request.getSummarize().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "summarize", request.getSummarize().get(), false); - } - if (request.getTopics().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "topics", request.getTopics().get(), false); - } - if (request.getCustomTopicMode().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "custom_topic_mode", request.getCustomTopicMode().get(), false); - } - if (request.getIntents().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "intents", request.getIntents().get(), false); - } - if (request.getCustomIntentMode().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "custom_intent_mode", request.getCustomIntentMode().get(), false); - } - if (request.getDetectEntities().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "detect_entities", request.getDetectEntities().get(), false); - } - if (request.getDetectLanguage().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "detect_language", request.getDetectLanguage().get(), false); - } - if (request.getDiarize().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "diarize", request.getDiarize().get(), false); - } - if (request.getDictation().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "dictation", request.getDictation().get(), false); - } - if (request.getEncoding().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "encoding", request.getEncoding().get(), false); - } - if (request.getFillerWords().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "filler_words", request.getFillerWords().get(), false); - } - if (request.getLanguage().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "language", request.getLanguage().get(), false); - } - if (request.getMeasurements().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "measurements", request.getMeasurements().get(), false); - } - if (request.getModel().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "model", request.getModel().get(), false); - } - if (request.getMultichannel().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "multichannel", request.getMultichannel().get(), false); - } - if (request.getNumerals().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "numerals", request.getNumerals().get(), false); - } - if (request.getParagraphs().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "paragraphs", request.getParagraphs().get(), false); - } - if (request.getProfanityFilter().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "profanity_filter", request.getProfanityFilter().get(), false); - } - if (request.getPunctuate().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "punctuate", request.getPunctuate().get(), false); - } - if (request.getRedact().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "redact", request.getRedact().get(), false); - } - if (request.getSmartFormat().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "smart_format", request.getSmartFormat().get(), false); - } - if (request.getUtterances().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "utterances", request.getUtterances().get(), false); - } - if (request.getUttSplit().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "utt_split", request.getUttSplit().get(), false); - } - if (request.getVersion().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "version", request.getVersion().get(), false); - } - if (request.getMipOptOut().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "mip_opt_out", request.getMipOptOut().get(), false); - } - if (request.getExtra().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "extra", request.getExtra().get(), true); - } - if (request.getTag().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "tag", request.getTag().get(), true); - } - if (request.getCustomTopic().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "custom_topic", request.getCustomTopic().get(), true); - } - if (request.getCustomIntent().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "custom_intent", request.getCustomIntent().get(), true); - } - if (request.getKeyterm().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "keyterm", request.getKeyterm().get(), true); - } - if (request.getKeywords().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "keywords", request.getKeywords().get(), true); - } - if (request.getReplace().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "replace", request.getReplace().get(), true); - } - if (request.getSearch().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "search", request.getSearch().get(), true); - } - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - RequestBody body; - try { - body = - RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = - new Request.Builder() - .url(httpUrl.build()) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .addHeader("Accept", "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(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, MediaTranscribeResponse.class), - response); - } - try { - if (response.code() == 400) { - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new DeepgramApiApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (IOException e) { - throw new DeepgramApiException("Network error executing HTTP request", e); - } - } - - /** Transcribe audio and video using Deepgram's speech-to-text REST API */ - public DeepgramApiHttpResponse transcribeFile(byte[] body) { - return transcribeFile(MediaTranscribeRequestOctetStream.builder().body(body).build()); - } - - /** Transcribe audio and video using Deepgram's speech-to-text REST API */ - public DeepgramApiHttpResponse transcribeFile( - byte[] body, RequestOptions requestOptions) { - return transcribeFile( - MediaTranscribeRequestOctetStream.builder().body(body).build(), requestOptions); - } - - /** Transcribe audio and video using Deepgram's speech-to-text REST API */ - public DeepgramApiHttpResponse transcribeFile( - MediaTranscribeRequestOctetStream request) { - return transcribeFile(request, null); - } - - /** Transcribe audio and video using Deepgram's speech-to-text REST API */ - public DeepgramApiHttpResponse transcribeFile( - MediaTranscribeRequestOctetStream request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/listen"); - if (request.getCallback().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "callback", request.getCallback().get(), false); - } - if (request.getCallbackMethod().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "callback_method", request.getCallbackMethod().get(), false); - } - if (request.getSentiment().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "sentiment", request.getSentiment().get(), false); - } - if (request.getSummarize().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "summarize", request.getSummarize().get(), false); - } - if (request.getTopics().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "topics", request.getTopics().get(), false); - } - if (request.getCustomTopicMode().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "custom_topic_mode", request.getCustomTopicMode().get(), false); - } - if (request.getIntents().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "intents", request.getIntents().get(), false); - } - if (request.getCustomIntentMode().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "custom_intent_mode", request.getCustomIntentMode().get(), false); - } - if (request.getDetectEntities().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "detect_entities", request.getDetectEntities().get(), false); - } - if (request.getDetectLanguage().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "detect_language", request.getDetectLanguage().get(), false); - } - if (request.getDiarize().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "diarize", request.getDiarize().get(), false); - } - if (request.getDictation().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "dictation", request.getDictation().get(), false); - } - if (request.getEncoding().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "encoding", request.getEncoding().get(), false); - } - if (request.getFillerWords().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "filler_words", request.getFillerWords().get(), false); - } - if (request.getLanguage().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "language", request.getLanguage().get(), false); - } - if (request.getMeasurements().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "measurements", request.getMeasurements().get(), false); - } - if (request.getModel().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "model", request.getModel().get(), false); - } - if (request.getMultichannel().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "multichannel", request.getMultichannel().get(), false); - } - if (request.getNumerals().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "numerals", request.getNumerals().get(), false); - } - if (request.getParagraphs().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "paragraphs", request.getParagraphs().get(), false); - } - if (request.getProfanityFilter().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "profanity_filter", request.getProfanityFilter().get(), false); - } - if (request.getPunctuate().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "punctuate", request.getPunctuate().get(), false); - } - if (request.getRedact().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "redact", request.getRedact().get(), false); - } - if (request.getSmartFormat().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "smart_format", request.getSmartFormat().get(), false); - } - if (request.getUtterances().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "utterances", request.getUtterances().get(), false); - } - if (request.getUttSplit().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "utt_split", request.getUttSplit().get(), false); - } - if (request.getVersion().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "version", request.getVersion().get(), false); - } - if (request.getMipOptOut().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "mip_opt_out", request.getMipOptOut().get(), false); - } - if (request.getExtra().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "extra", request.getExtra().get(), true); - } - if (request.getTag().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "tag", request.getTag().get(), true); - } - if (request.getCustomTopic().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "custom_topic", request.getCustomTopic().get(), true); - } - if (request.getCustomIntent().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "custom_intent", request.getCustomIntent().get(), true); - } - if (request.getKeyterm().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "keyterm", request.getKeyterm().get(), true); - } - if (request.getKeywords().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "keywords", request.getKeywords().get(), true); - } - if (request.getReplace().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "replace", request.getReplace().get(), true); - } - if (request.getSearch().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "search", request.getSearch().get(), true); - } - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - RequestBody body = - new InputStreamRequestBody( - MediaType.parse("application/octet-stream"), - new ByteArrayInputStream(request.getBody())); - Request.Builder _requestBuilder = - new Request.Builder() - .url(httpUrl.build()) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/octet-stream") - .addHeader("Accept", "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(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, MediaTranscribeResponse.class), - response); - } - try { - if (response.code() == 400) { - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new DeepgramApiApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (IOException e) { - throw new DeepgramApiException("Network error executing HTTP request", e); - } - } -} diff --git a/src/main/java/resources/listen/v1/media/requests/ListenV1RequestUrl.java b/src/main/java/resources/listen/v1/media/requests/ListenV1RequestUrl.java deleted file mode 100644 index 2764ddf..0000000 --- a/src/main/java/resources/listen/v1/media/requests/ListenV1RequestUrl.java +++ /dev/null @@ -1,1827 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v1.media.requests; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.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 core.ObjectMappers; -import java.util.Collections; -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; -import resources.listen.v1.media.types.MediaTranscribeRequestCallbackMethod; -import resources.listen.v1.media.types.MediaTranscribeRequestCustomIntentMode; -import resources.listen.v1.media.types.MediaTranscribeRequestCustomTopicMode; -import resources.listen.v1.media.types.MediaTranscribeRequestEncoding; -import resources.listen.v1.media.types.MediaTranscribeRequestModel; -import resources.listen.v1.media.types.MediaTranscribeRequestSummarize; -import resources.listen.v1.media.types.MediaTranscribeRequestVersion; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = ListenV1RequestUrl.Builder.class) -public final class ListenV1RequestUrl { - private final Optional> extra; - - private final Optional> tag; - - private final Optional> customTopic; - - private final Optional> customIntent; - - private final Optional> keyterm; - - private final Optional> keywords; - - private final Optional> replace; - - private final Optional> search; - - private final Optional callback; - - private final Optional callbackMethod; - - private final Optional sentiment; - - private final Optional summarize; - - private final Optional topics; - - private final Optional customTopicMode; - - private final Optional intents; - - private final Optional customIntentMode; - - private final Optional detectEntities; - - private final Optional detectLanguage; - - private final Optional diarize; - - private final Optional dictation; - - private final Optional encoding; - - private final Optional fillerWords; - - private final Optional language; - - private final Optional measurements; - - private final Optional model; - - private final Optional multichannel; - - private final Optional numerals; - - private final Optional paragraphs; - - private final Optional profanityFilter; - - private final Optional punctuate; - - private final Optional redact; - - private final Optional smartFormat; - - private final Optional utterances; - - private final Optional uttSplit; - - private final Optional version; - - private final Optional mipOptOut; - - private final String url; - - private final Map additionalProperties; - - private ListenV1RequestUrl( - Optional> extra, - Optional> tag, - Optional> customTopic, - Optional> customIntent, - Optional> keyterm, - Optional> keywords, - Optional> replace, - Optional> search, - Optional callback, - Optional callbackMethod, - Optional sentiment, - Optional summarize, - Optional topics, - Optional customTopicMode, - Optional intents, - Optional customIntentMode, - Optional detectEntities, - Optional detectLanguage, - Optional diarize, - Optional dictation, - Optional encoding, - Optional fillerWords, - Optional language, - Optional measurements, - Optional model, - Optional multichannel, - Optional numerals, - Optional paragraphs, - Optional profanityFilter, - Optional punctuate, - Optional redact, - Optional smartFormat, - Optional utterances, - Optional uttSplit, - Optional version, - Optional mipOptOut, - String url, - Map additionalProperties) { - this.extra = extra; - this.tag = tag; - this.customTopic = customTopic; - this.customIntent = customIntent; - this.keyterm = keyterm; - this.keywords = keywords; - this.replace = replace; - this.search = search; - this.callback = callback; - this.callbackMethod = callbackMethod; - this.sentiment = sentiment; - this.summarize = summarize; - this.topics = topics; - this.customTopicMode = customTopicMode; - this.intents = intents; - this.customIntentMode = customIntentMode; - this.detectEntities = detectEntities; - this.detectLanguage = detectLanguage; - this.diarize = diarize; - this.dictation = dictation; - this.encoding = encoding; - this.fillerWords = fillerWords; - this.language = language; - this.measurements = measurements; - this.model = model; - this.multichannel = multichannel; - this.numerals = numerals; - this.paragraphs = paragraphs; - this.profanityFilter = profanityFilter; - this.punctuate = punctuate; - this.redact = redact; - this.smartFormat = smartFormat; - this.utterances = utterances; - this.uttSplit = uttSplit; - this.version = version; - this.mipOptOut = mipOptOut; - this.url = url; - this.additionalProperties = additionalProperties; - } - - /** - * @return Arbitrary key-value pairs that are attached to the API response for usage in downstream - * processing - */ - @JsonIgnore - public Optional> getExtra() { - return extra; - } - - /** - * @return Label your requests for the purpose of identification during usage reporting - */ - @JsonIgnore - public Optional> getTag() { - return tag; - } - - /** - * @return Custom topics you want the model to detect within your input audio or text if present - * Submit up to 100. - */ - @JsonIgnore - public Optional> getCustomTopic() { - return customTopic; - } - - /** - * @return Custom intents you want the model to detect within your input audio if present - */ - @JsonIgnore - public Optional> getCustomIntent() { - return customIntent; - } - - /** - * @return Key term prompting can boost or suppress specialized terminology and brands. Only - * compatible with Nova-3 - */ - @JsonIgnore - public Optional> getKeyterm() { - return keyterm; - } - - /** - * @return Keywords can boost or suppress specialized terminology and brands - */ - @JsonIgnore - public Optional> getKeywords() { - return keywords; - } - - /** - * @return Search for terms or phrases in submitted audio and replaces them - */ - @JsonIgnore - public Optional> getReplace() { - return replace; - } - - /** - * @return Search for terms or phrases in submitted audio - */ - @JsonIgnore - public Optional> getSearch() { - return search; - } - - /** - * @return URL to which we'll make the callback request - */ - @JsonIgnore - public Optional getCallback() { - return callback; - } - - /** - * @return HTTP method by which the callback request will be made - */ - @JsonIgnore - public Optional getCallbackMethod() { - return callbackMethod; - } - - /** - * @return Recognizes the sentiment throughout a transcript or text - */ - @JsonIgnore - public Optional getSentiment() { - return sentiment; - } - - /** - * @return Summarize content. For Listen API, supports string version option. For Read API, - * accepts boolean only. - */ - @JsonIgnore - public Optional getSummarize() { - return summarize; - } - - /** - * @return Detect topics throughout a transcript or text - */ - @JsonIgnore - public Optional getTopics() { - return topics; - } - - /** - * @return Sets how the model will interpret strings submitted to the custom_topic - * param. When strict, the model will only return topics submitted using the - * custom_topic param. When extended, the model will return its own - * detected topics in addition to those submitted using the custom_topic param - */ - @JsonIgnore - public Optional getCustomTopicMode() { - return customTopicMode; - } - - /** - * @return Recognizes speaker intent throughout a transcript or text - */ - @JsonIgnore - public Optional getIntents() { - return intents; - } - - /** - * @return Sets how the model will interpret intents submitted to the custom_intent - * param. When strict, the model will only return intents submitted using the - * custom_intent param. When extended, the model will return its own - * detected intents in the custom_intent param. - */ - @JsonIgnore - public Optional getCustomIntentMode() { - return customIntentMode; - } - - /** - * @return Identifies and extracts key entities from content in submitted audio - */ - @JsonIgnore - public Optional getDetectEntities() { - return detectEntities; - } - - /** - * @return Identifies the dominant language spoken in submitted audio - */ - @JsonIgnore - public Optional getDetectLanguage() { - return detectLanguage; - } - - /** - * @return Recognize speaker changes. Each word in the transcript will be assigned a speaker - * number starting at 0 - */ - @JsonIgnore - public Optional getDiarize() { - return diarize; - } - - /** - * @return Dictation mode for controlling formatting with dictated speech - */ - @JsonIgnore - public Optional getDictation() { - return dictation; - } - - /** - * @return Specify the expected encoding of your submitted audio - */ - @JsonIgnore - public Optional getEncoding() { - return encoding; - } - - /** - * @return Filler Words can help transcribe interruptions in your audio, like "uh" and - * "um" - */ - @JsonIgnore - public Optional getFillerWords() { - return fillerWords; - } - - /** - * @return The BCP-47 language tag that hints at - * the primary spoken language. Depending on the Model and API endpoint you choose only - * certain languages are available - */ - @JsonIgnore - public Optional getLanguage() { - return language; - } - - /** - * @return Spoken measurements will be converted to their corresponding abbreviations - */ - @JsonIgnore - public Optional getMeasurements() { - return measurements; - } - - /** - * @return AI model used to process submitted audio - */ - @JsonIgnore - public Optional getModel() { - return model; - } - - /** - * @return Transcribe each audio channel independently - */ - @JsonIgnore - public Optional getMultichannel() { - return multichannel; - } - - /** - * @return Numerals converts numbers from written format to numerical format - */ - @JsonIgnore - public Optional getNumerals() { - return numerals; - } - - /** - * @return Splits audio into paragraphs to improve transcript readability - */ - @JsonIgnore - public Optional getParagraphs() { - return paragraphs; - } - - /** - * @return Profanity Filter looks for recognized profanity and converts it to the nearest - * recognized non-profane word or removes it from the transcript completely - */ - @JsonIgnore - public Optional getProfanityFilter() { - return profanityFilter; - } - - /** - * @return Add punctuation and capitalization to the transcript - */ - @JsonIgnore - public Optional getPunctuate() { - return punctuate; - } - - /** - * @return Redaction removes sensitive information from your transcripts - */ - @JsonIgnore - public Optional getRedact() { - return redact; - } - - /** - * @return Apply formatting to transcript output. When set to true, additional formatting will be - * applied to transcripts to improve readability - */ - @JsonIgnore - public Optional getSmartFormat() { - return smartFormat; - } - - /** - * @return Segments speech into meaningful semantic units - */ - @JsonIgnore - public Optional getUtterances() { - return utterances; - } - - /** - * @return Seconds to wait before detecting a pause between words in submitted audio - */ - @JsonIgnore - public Optional getUttSplit() { - return uttSplit; - } - - /** - * @return Version of an AI model to use - */ - @JsonIgnore - public Optional getVersion() { - return version; - } - - /** - * @return Opts out requests from the Deepgram Model Improvement Program. Refer to our Docs for - * pricing impacts before setting this to true. https://dpgr.am/deepgram-mip - */ - @JsonIgnore - public Optional getMipOptOut() { - return mipOptOut; - } - - @JsonProperty("url") - public String getUrl() { - return url; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListenV1RequestUrl && equalTo((ListenV1RequestUrl) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListenV1RequestUrl other) { - return extra.equals(other.extra) - && tag.equals(other.tag) - && customTopic.equals(other.customTopic) - && customIntent.equals(other.customIntent) - && keyterm.equals(other.keyterm) - && keywords.equals(other.keywords) - && replace.equals(other.replace) - && search.equals(other.search) - && callback.equals(other.callback) - && callbackMethod.equals(other.callbackMethod) - && sentiment.equals(other.sentiment) - && summarize.equals(other.summarize) - && topics.equals(other.topics) - && customTopicMode.equals(other.customTopicMode) - && intents.equals(other.intents) - && customIntentMode.equals(other.customIntentMode) - && detectEntities.equals(other.detectEntities) - && detectLanguage.equals(other.detectLanguage) - && diarize.equals(other.diarize) - && dictation.equals(other.dictation) - && encoding.equals(other.encoding) - && fillerWords.equals(other.fillerWords) - && language.equals(other.language) - && measurements.equals(other.measurements) - && model.equals(other.model) - && multichannel.equals(other.multichannel) - && numerals.equals(other.numerals) - && paragraphs.equals(other.paragraphs) - && profanityFilter.equals(other.profanityFilter) - && punctuate.equals(other.punctuate) - && redact.equals(other.redact) - && smartFormat.equals(other.smartFormat) - && utterances.equals(other.utterances) - && uttSplit.equals(other.uttSplit) - && version.equals(other.version) - && mipOptOut.equals(other.mipOptOut) - && url.equals(other.url); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.extra, - this.tag, - this.customTopic, - this.customIntent, - this.keyterm, - this.keywords, - this.replace, - this.search, - this.callback, - this.callbackMethod, - this.sentiment, - this.summarize, - this.topics, - this.customTopicMode, - this.intents, - this.customIntentMode, - this.detectEntities, - this.detectLanguage, - this.diarize, - this.dictation, - this.encoding, - this.fillerWords, - this.language, - this.measurements, - this.model, - this.multichannel, - this.numerals, - this.paragraphs, - this.profanityFilter, - this.punctuate, - this.redact, - this.smartFormat, - this.utterances, - this.uttSplit, - this.version, - this.mipOptOut, - this.url); - } - - @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(ListenV1RequestUrl other); - } - - public interface _FinalStage { - ListenV1RequestUrl build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** - * Arbitrary key-value pairs that are attached to the API response for usage in downstream - * processing - */ - _FinalStage extra(Optional> extra); - - _FinalStage extra(List extra); - - _FinalStage extra(String extra); - - /** Label your requests for the purpose of identification during usage reporting */ - _FinalStage tag(Optional> tag); - - _FinalStage tag(List tag); - - _FinalStage tag(String tag); - - /** - * Custom topics you want the model to detect within your input audio or text if present Submit - * up to 100. - */ - _FinalStage customTopic(Optional> customTopic); - - _FinalStage customTopic(List customTopic); - - _FinalStage customTopic(String customTopic); - - /** Custom intents you want the model to detect within your input audio if present */ - _FinalStage customIntent(Optional> customIntent); - - _FinalStage customIntent(List customIntent); - - _FinalStage customIntent(String customIntent); - - /** - * Key term prompting can boost or suppress specialized terminology and brands. Only compatible - * with Nova-3 - */ - _FinalStage keyterm(Optional> keyterm); - - _FinalStage keyterm(List keyterm); - - _FinalStage keyterm(String keyterm); - - /** Keywords can boost or suppress specialized terminology and brands */ - _FinalStage keywords(Optional> keywords); - - _FinalStage keywords(List keywords); - - _FinalStage keywords(String keywords); - - /** Search for terms or phrases in submitted audio and replaces them */ - _FinalStage replace(Optional> replace); - - _FinalStage replace(List replace); - - _FinalStage replace(String replace); - - /** Search for terms or phrases in submitted audio */ - _FinalStage search(Optional> search); - - _FinalStage search(List search); - - _FinalStage search(String search); - - /** URL to which we'll make the callback request */ - _FinalStage callback(Optional callback); - - _FinalStage callback(String callback); - - /** HTTP method by which the callback request will be made */ - _FinalStage callbackMethod(Optional callbackMethod); - - _FinalStage callbackMethod(MediaTranscribeRequestCallbackMethod callbackMethod); - - /** Recognizes the sentiment throughout a transcript or text */ - _FinalStage sentiment(Optional sentiment); - - _FinalStage sentiment(Boolean sentiment); - - /** - * Summarize content. For Listen API, supports string version option. For Read API, accepts - * boolean only. - */ - _FinalStage summarize(Optional summarize); - - _FinalStage summarize(MediaTranscribeRequestSummarize summarize); - - /** Detect topics throughout a transcript or text */ - _FinalStage topics(Optional topics); - - _FinalStage topics(Boolean topics); - - /** - * Sets how the model will interpret strings submitted to the custom_topic param. - * When strict, the model will only return topics submitted using the - * custom_topic param. When extended, the model will return its own detected - * topics in addition to those submitted using the custom_topic param - */ - _FinalStage customTopicMode(Optional customTopicMode); - - _FinalStage customTopicMode(MediaTranscribeRequestCustomTopicMode customTopicMode); - - /** Recognizes speaker intent throughout a transcript or text */ - _FinalStage intents(Optional intents); - - _FinalStage intents(Boolean intents); - - /** - * Sets how the model will interpret intents submitted to the custom_intent param. - * When strict, the model will only return intents submitted using the - * custom_intent param. When extended, the model will return its own - * detected intents in the custom_intent param. - */ - _FinalStage customIntentMode(Optional customIntentMode); - - _FinalStage customIntentMode(MediaTranscribeRequestCustomIntentMode customIntentMode); - - /** Identifies and extracts key entities from content in submitted audio */ - _FinalStage detectEntities(Optional detectEntities); - - _FinalStage detectEntities(Boolean detectEntities); - - /** Identifies the dominant language spoken in submitted audio */ - _FinalStage detectLanguage(Optional detectLanguage); - - _FinalStage detectLanguage(Boolean detectLanguage); - - /** - * Recognize speaker changes. Each word in the transcript will be assigned a speaker number - * starting at 0 - */ - _FinalStage diarize(Optional diarize); - - _FinalStage diarize(Boolean diarize); - - /** Dictation mode for controlling formatting with dictated speech */ - _FinalStage dictation(Optional dictation); - - _FinalStage dictation(Boolean dictation); - - /** Specify the expected encoding of your submitted audio */ - _FinalStage encoding(Optional encoding); - - _FinalStage encoding(MediaTranscribeRequestEncoding encoding); - - /** - * Filler Words can help transcribe interruptions in your audio, like "uh" and - * "um" - */ - _FinalStage fillerWords(Optional fillerWords); - - _FinalStage fillerWords(Boolean fillerWords); - - /** - * The BCP-47 language tag that hints at the - * primary spoken language. Depending on the Model and API endpoint you choose only certain - * languages are available - */ - _FinalStage language(Optional language); - - _FinalStage language(String language); - - /** Spoken measurements will be converted to their corresponding abbreviations */ - _FinalStage measurements(Optional measurements); - - _FinalStage measurements(Boolean measurements); - - /** AI model used to process submitted audio */ - _FinalStage model(Optional model); - - _FinalStage model(MediaTranscribeRequestModel model); - - /** Transcribe each audio channel independently */ - _FinalStage multichannel(Optional multichannel); - - _FinalStage multichannel(Boolean multichannel); - - /** Numerals converts numbers from written format to numerical format */ - _FinalStage numerals(Optional numerals); - - _FinalStage numerals(Boolean numerals); - - /** Splits audio into paragraphs to improve transcript readability */ - _FinalStage paragraphs(Optional paragraphs); - - _FinalStage paragraphs(Boolean paragraphs); - - /** - * Profanity Filter looks for recognized profanity and converts it to the nearest recognized - * non-profane word or removes it from the transcript completely - */ - _FinalStage profanityFilter(Optional profanityFilter); - - _FinalStage profanityFilter(Boolean profanityFilter); - - /** Add punctuation and capitalization to the transcript */ - _FinalStage punctuate(Optional punctuate); - - _FinalStage punctuate(Boolean punctuate); - - /** Redaction removes sensitive information from your transcripts */ - _FinalStage redact(Optional redact); - - _FinalStage redact(String redact); - - /** - * Apply formatting to transcript output. When set to true, additional formatting will be - * applied to transcripts to improve readability - */ - _FinalStage smartFormat(Optional smartFormat); - - _FinalStage smartFormat(Boolean smartFormat); - - /** Segments speech into meaningful semantic units */ - _FinalStage utterances(Optional utterances); - - _FinalStage utterances(Boolean utterances); - - /** Seconds to wait before detecting a pause between words in submitted audio */ - _FinalStage uttSplit(Optional uttSplit); - - _FinalStage uttSplit(Double uttSplit); - - /** Version of an AI model to use */ - _FinalStage version(Optional version); - - _FinalStage version(MediaTranscribeRequestVersion version); - - /** - * Opts out requests from the Deepgram Model Improvement Program. Refer to our Docs for pricing - * impacts before setting this to true. https://dpgr.am/deepgram-mip - */ - _FinalStage mipOptOut(Optional mipOptOut); - - _FinalStage mipOptOut(Boolean mipOptOut); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements UrlStage, _FinalStage { - private String url; - - private Optional mipOptOut = Optional.empty(); - - private Optional version = Optional.empty(); - - private Optional uttSplit = Optional.empty(); - - private Optional utterances = Optional.empty(); - - private Optional smartFormat = Optional.empty(); - - private Optional redact = Optional.empty(); - - private Optional punctuate = Optional.empty(); - - private Optional profanityFilter = Optional.empty(); - - private Optional paragraphs = Optional.empty(); - - private Optional numerals = Optional.empty(); - - private Optional multichannel = Optional.empty(); - - private Optional model = Optional.empty(); - - private Optional measurements = Optional.empty(); - - private Optional language = Optional.empty(); - - private Optional fillerWords = Optional.empty(); - - private Optional encoding = Optional.empty(); - - private Optional dictation = Optional.empty(); - - private Optional diarize = Optional.empty(); - - private Optional detectLanguage = Optional.empty(); - - private Optional detectEntities = Optional.empty(); - - private Optional customIntentMode = Optional.empty(); - - private Optional intents = Optional.empty(); - - private Optional customTopicMode = Optional.empty(); - - private Optional topics = Optional.empty(); - - private Optional summarize = Optional.empty(); - - private Optional sentiment = Optional.empty(); - - private Optional callbackMethod = Optional.empty(); - - private Optional callback = Optional.empty(); - - private Optional> search = Optional.empty(); - - private Optional> replace = Optional.empty(); - - private Optional> keywords = Optional.empty(); - - private Optional> keyterm = Optional.empty(); - - private Optional> customIntent = Optional.empty(); - - private Optional> customTopic = Optional.empty(); - - private Optional> tag = Optional.empty(); - - private Optional> extra = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(ListenV1RequestUrl other) { - extra(other.getExtra()); - tag(other.getTag()); - customTopic(other.getCustomTopic()); - customIntent(other.getCustomIntent()); - keyterm(other.getKeyterm()); - keywords(other.getKeywords()); - replace(other.getReplace()); - search(other.getSearch()); - callback(other.getCallback()); - callbackMethod(other.getCallbackMethod()); - sentiment(other.getSentiment()); - summarize(other.getSummarize()); - topics(other.getTopics()); - customTopicMode(other.getCustomTopicMode()); - intents(other.getIntents()); - customIntentMode(other.getCustomIntentMode()); - detectEntities(other.getDetectEntities()); - detectLanguage(other.getDetectLanguage()); - diarize(other.getDiarize()); - dictation(other.getDictation()); - encoding(other.getEncoding()); - fillerWords(other.getFillerWords()); - language(other.getLanguage()); - measurements(other.getMeasurements()); - model(other.getModel()); - multichannel(other.getMultichannel()); - numerals(other.getNumerals()); - paragraphs(other.getParagraphs()); - profanityFilter(other.getProfanityFilter()); - punctuate(other.getPunctuate()); - redact(other.getRedact()); - smartFormat(other.getSmartFormat()); - utterances(other.getUtterances()); - uttSplit(other.getUttSplit()); - version(other.getVersion()); - mipOptOut(other.getMipOptOut()); - url(other.getUrl()); - return this; - } - - @java.lang.Override - @JsonSetter("url") - public _FinalStage url(@NotNull String url) { - this.url = Objects.requireNonNull(url, "url must not be null"); - return this; - } - - /** - * Opts out requests from the Deepgram Model Improvement Program. Refer to our Docs for pricing - * impacts before setting this to true. https://dpgr.am/deepgram-mip - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage mipOptOut(Boolean mipOptOut) { - this.mipOptOut = Optional.ofNullable(mipOptOut); - return this; - } - - /** - * Opts out requests from the Deepgram Model Improvement Program. Refer to our Docs for pricing - * impacts before setting this to true. https://dpgr.am/deepgram-mip - */ - @java.lang.Override - @JsonSetter(value = "mip_opt_out", nulls = Nulls.SKIP) - public _FinalStage mipOptOut(Optional mipOptOut) { - this.mipOptOut = mipOptOut; - return this; - } - - /** - * Version of an AI model to use - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage version(MediaTranscribeRequestVersion version) { - this.version = Optional.ofNullable(version); - return this; - } - - /** Version of an AI model to use */ - @java.lang.Override - @JsonSetter(value = "version", nulls = Nulls.SKIP) - public _FinalStage version(Optional version) { - this.version = version; - return this; - } - - /** - * Seconds to wait before detecting a pause between words in submitted audio - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage uttSplit(Double uttSplit) { - this.uttSplit = Optional.ofNullable(uttSplit); - return this; - } - - /** Seconds to wait before detecting a pause between words in submitted audio */ - @java.lang.Override - @JsonSetter(value = "utt_split", nulls = Nulls.SKIP) - public _FinalStage uttSplit(Optional uttSplit) { - this.uttSplit = uttSplit; - return this; - } - - /** - * Segments speech into meaningful semantic units - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage utterances(Boolean utterances) { - this.utterances = Optional.ofNullable(utterances); - return this; - } - - /** Segments speech into meaningful semantic units */ - @java.lang.Override - @JsonSetter(value = "utterances", nulls = Nulls.SKIP) - public _FinalStage utterances(Optional utterances) { - this.utterances = utterances; - return this; - } - - /** - * Apply formatting to transcript output. When set to true, additional formatting will be - * applied to transcripts to improve readability - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage smartFormat(Boolean smartFormat) { - this.smartFormat = Optional.ofNullable(smartFormat); - return this; - } - - /** - * Apply formatting to transcript output. When set to true, additional formatting will be - * applied to transcripts to improve readability - */ - @java.lang.Override - @JsonSetter(value = "smart_format", nulls = Nulls.SKIP) - public _FinalStage smartFormat(Optional smartFormat) { - this.smartFormat = smartFormat; - return this; - } - - /** - * Redaction removes sensitive information from your transcripts - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage redact(String redact) { - this.redact = Optional.ofNullable(redact); - return this; - } - - /** Redaction removes sensitive information from your transcripts */ - @java.lang.Override - @JsonSetter(value = "redact", nulls = Nulls.SKIP) - public _FinalStage redact(Optional redact) { - this.redact = redact; - return this; - } - - /** - * Add punctuation and capitalization to the transcript - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage punctuate(Boolean punctuate) { - this.punctuate = Optional.ofNullable(punctuate); - return this; - } - - /** Add punctuation and capitalization to the transcript */ - @java.lang.Override - @JsonSetter(value = "punctuate", nulls = Nulls.SKIP) - public _FinalStage punctuate(Optional punctuate) { - this.punctuate = punctuate; - return this; - } - - /** - * Profanity Filter looks for recognized profanity and converts it to the nearest recognized - * non-profane word or removes it from the transcript completely - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage profanityFilter(Boolean profanityFilter) { - this.profanityFilter = Optional.ofNullable(profanityFilter); - return this; - } - - /** - * Profanity Filter looks for recognized profanity and converts it to the nearest recognized - * non-profane word or removes it from the transcript completely - */ - @java.lang.Override - @JsonSetter(value = "profanity_filter", nulls = Nulls.SKIP) - public _FinalStage profanityFilter(Optional profanityFilter) { - this.profanityFilter = profanityFilter; - return this; - } - - /** - * Splits audio into paragraphs to improve transcript readability - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage paragraphs(Boolean paragraphs) { - this.paragraphs = Optional.ofNullable(paragraphs); - return this; - } - - /** Splits audio into paragraphs to improve transcript readability */ - @java.lang.Override - @JsonSetter(value = "paragraphs", nulls = Nulls.SKIP) - public _FinalStage paragraphs(Optional paragraphs) { - this.paragraphs = paragraphs; - return this; - } - - /** - * Numerals converts numbers from written format to numerical format - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage numerals(Boolean numerals) { - this.numerals = Optional.ofNullable(numerals); - return this; - } - - /** Numerals converts numbers from written format to numerical format */ - @java.lang.Override - @JsonSetter(value = "numerals", nulls = Nulls.SKIP) - public _FinalStage numerals(Optional numerals) { - this.numerals = numerals; - return this; - } - - /** - * Transcribe each audio channel independently - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage multichannel(Boolean multichannel) { - this.multichannel = Optional.ofNullable(multichannel); - return this; - } - - /** Transcribe each audio channel independently */ - @java.lang.Override - @JsonSetter(value = "multichannel", nulls = Nulls.SKIP) - public _FinalStage multichannel(Optional multichannel) { - this.multichannel = multichannel; - return this; - } - - /** - * AI model used to process submitted audio - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage model(MediaTranscribeRequestModel model) { - this.model = Optional.ofNullable(model); - return this; - } - - /** AI model used to process submitted audio */ - @java.lang.Override - @JsonSetter(value = "model", nulls = Nulls.SKIP) - public _FinalStage model(Optional model) { - this.model = model; - return this; - } - - /** - * Spoken measurements will be converted to their corresponding abbreviations - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage measurements(Boolean measurements) { - this.measurements = Optional.ofNullable(measurements); - return this; - } - - /** Spoken measurements will be converted to their corresponding abbreviations */ - @java.lang.Override - @JsonSetter(value = "measurements", nulls = Nulls.SKIP) - public _FinalStage measurements(Optional measurements) { - this.measurements = measurements; - return this; - } - - /** - * The BCP-47 language tag that hints at the - * primary spoken language. Depending on the Model and API endpoint you choose only certain - * languages are available - * - * @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; - } - - /** - * The BCP-47 language tag that hints at the - * primary spoken language. Depending on the Model and API endpoint you choose only certain - * languages are available - */ - @java.lang.Override - @JsonSetter(value = "language", nulls = Nulls.SKIP) - public _FinalStage language(Optional language) { - this.language = language; - return this; - } - - /** - * Filler Words can help transcribe interruptions in your audio, like "uh" and - * "um" - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage fillerWords(Boolean fillerWords) { - this.fillerWords = Optional.ofNullable(fillerWords); - return this; - } - - /** - * Filler Words can help transcribe interruptions in your audio, like "uh" and - * "um" - */ - @java.lang.Override - @JsonSetter(value = "filler_words", nulls = Nulls.SKIP) - public _FinalStage fillerWords(Optional fillerWords) { - this.fillerWords = fillerWords; - return this; - } - - /** - * Specify the expected encoding of your submitted audio - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage encoding(MediaTranscribeRequestEncoding encoding) { - this.encoding = Optional.ofNullable(encoding); - return this; - } - - /** Specify the expected encoding of your submitted audio */ - @java.lang.Override - @JsonSetter(value = "encoding", nulls = Nulls.SKIP) - public _FinalStage encoding(Optional encoding) { - this.encoding = encoding; - return this; - } - - /** - * Dictation mode for controlling formatting with dictated speech - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage dictation(Boolean dictation) { - this.dictation = Optional.ofNullable(dictation); - return this; - } - - /** Dictation mode for controlling formatting with dictated speech */ - @java.lang.Override - @JsonSetter(value = "dictation", nulls = Nulls.SKIP) - public _FinalStage dictation(Optional dictation) { - this.dictation = dictation; - return this; - } - - /** - * Recognize speaker changes. Each word in the transcript will be assigned a speaker number - * starting at 0 - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage diarize(Boolean diarize) { - this.diarize = Optional.ofNullable(diarize); - return this; - } - - /** - * Recognize speaker changes. Each word in the transcript will be assigned a speaker number - * starting at 0 - */ - @java.lang.Override - @JsonSetter(value = "diarize", nulls = Nulls.SKIP) - public _FinalStage diarize(Optional diarize) { - this.diarize = diarize; - return this; - } - - /** - * Identifies the dominant language spoken in submitted audio - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage detectLanguage(Boolean detectLanguage) { - this.detectLanguage = Optional.ofNullable(detectLanguage); - return this; - } - - /** Identifies the dominant language spoken in submitted audio */ - @java.lang.Override - @JsonSetter(value = "detect_language", nulls = Nulls.SKIP) - public _FinalStage detectLanguage(Optional detectLanguage) { - this.detectLanguage = detectLanguage; - return this; - } - - /** - * Identifies and extracts key entities from content in submitted audio - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage detectEntities(Boolean detectEntities) { - this.detectEntities = Optional.ofNullable(detectEntities); - return this; - } - - /** Identifies and extracts key entities from content in submitted audio */ - @java.lang.Override - @JsonSetter(value = "detect_entities", nulls = Nulls.SKIP) - public _FinalStage detectEntities(Optional detectEntities) { - this.detectEntities = detectEntities; - return this; - } - - /** - * Sets how the model will interpret intents submitted to the custom_intent param. - * When strict, the model will only return intents submitted using the - * custom_intent param. When extended, the model will return its own - * detected intents in the custom_intent param. - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage customIntentMode(MediaTranscribeRequestCustomIntentMode customIntentMode) { - this.customIntentMode = Optional.ofNullable(customIntentMode); - return this; - } - - /** - * Sets how the model will interpret intents submitted to the custom_intent param. - * When strict, the model will only return intents submitted using the - * custom_intent param. When extended, the model will return its own - * detected intents in the custom_intent param. - */ - @java.lang.Override - @JsonSetter(value = "custom_intent_mode", nulls = Nulls.SKIP) - public _FinalStage customIntentMode( - Optional customIntentMode) { - this.customIntentMode = customIntentMode; - return this; - } - - /** - * Recognizes speaker intent throughout a transcript or text - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage intents(Boolean intents) { - this.intents = Optional.ofNullable(intents); - return this; - } - - /** Recognizes speaker intent throughout a transcript or text */ - @java.lang.Override - @JsonSetter(value = "intents", nulls = Nulls.SKIP) - public _FinalStage intents(Optional intents) { - this.intents = intents; - return this; - } - - /** - * Sets how the model will interpret strings submitted to the custom_topic param. - * When strict, the model will only return topics submitted using the - * custom_topic param. When extended, the model will return its own detected - * topics in addition to those submitted using the custom_topic param - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage customTopicMode(MediaTranscribeRequestCustomTopicMode customTopicMode) { - this.customTopicMode = Optional.ofNullable(customTopicMode); - return this; - } - - /** - * Sets how the model will interpret strings submitted to the custom_topic param. - * When strict, the model will only return topics submitted using the - * custom_topic param. When extended, the model will return its own detected - * topics in addition to those submitted using the custom_topic param - */ - @java.lang.Override - @JsonSetter(value = "custom_topic_mode", nulls = Nulls.SKIP) - public _FinalStage customTopicMode( - Optional customTopicMode) { - this.customTopicMode = customTopicMode; - return this; - } - - /** - * Detect topics throughout a transcript or text - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage topics(Boolean topics) { - this.topics = Optional.ofNullable(topics); - return this; - } - - /** Detect topics throughout a transcript or text */ - @java.lang.Override - @JsonSetter(value = "topics", nulls = Nulls.SKIP) - public _FinalStage topics(Optional topics) { - this.topics = topics; - return this; - } - - /** - * Summarize content. For Listen API, supports string version option. For Read API, accepts - * boolean only. - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage summarize(MediaTranscribeRequestSummarize summarize) { - this.summarize = Optional.ofNullable(summarize); - return this; - } - - /** - * Summarize content. For Listen API, supports string version option. For Read API, accepts - * boolean only. - */ - @java.lang.Override - @JsonSetter(value = "summarize", nulls = Nulls.SKIP) - public _FinalStage summarize(Optional summarize) { - this.summarize = summarize; - return this; - } - - /** - * Recognizes the sentiment throughout a transcript or text - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage sentiment(Boolean sentiment) { - this.sentiment = Optional.ofNullable(sentiment); - return this; - } - - /** Recognizes the sentiment throughout a transcript or text */ - @java.lang.Override - @JsonSetter(value = "sentiment", nulls = Nulls.SKIP) - public _FinalStage sentiment(Optional sentiment) { - this.sentiment = sentiment; - return this; - } - - /** - * HTTP method by which the callback request will be made - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage callbackMethod(MediaTranscribeRequestCallbackMethod callbackMethod) { - this.callbackMethod = Optional.ofNullable(callbackMethod); - return this; - } - - /** HTTP method by which the callback request will be made */ - @java.lang.Override - @JsonSetter(value = "callback_method", nulls = Nulls.SKIP) - public _FinalStage callbackMethod( - Optional callbackMethod) { - this.callbackMethod = callbackMethod; - return this; - } - - /** - * URL to which we'll make the callback request - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage callback(String callback) { - this.callback = Optional.ofNullable(callback); - return this; - } - - /** URL to which we'll make the callback request */ - @java.lang.Override - @JsonSetter(value = "callback", nulls = Nulls.SKIP) - public _FinalStage callback(Optional callback) { - this.callback = callback; - return this; - } - - @java.lang.Override - public _FinalStage search(String search) { - this.search = Optional.of(Collections.singletonList(search)); - return this; - } - - /** - * Search for terms or phrases in submitted audio - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage search(List search) { - this.search = Optional.ofNullable(search); - return this; - } - - /** Search for terms or phrases in submitted audio */ - @java.lang.Override - @JsonSetter(value = "search", nulls = Nulls.SKIP) - public _FinalStage search(Optional> search) { - this.search = search; - return this; - } - - @java.lang.Override - public _FinalStage replace(String replace) { - this.replace = Optional.of(Collections.singletonList(replace)); - return this; - } - - /** - * Search for terms or phrases in submitted audio and replaces them - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage replace(List replace) { - this.replace = Optional.ofNullable(replace); - return this; - } - - /** Search for terms or phrases in submitted audio and replaces them */ - @java.lang.Override - @JsonSetter(value = "replace", nulls = Nulls.SKIP) - public _FinalStage replace(Optional> replace) { - this.replace = replace; - return this; - } - - @java.lang.Override - public _FinalStage keywords(String keywords) { - this.keywords = Optional.of(Collections.singletonList(keywords)); - return this; - } - - /** - * Keywords can boost or suppress specialized terminology and brands - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage keywords(List keywords) { - this.keywords = Optional.ofNullable(keywords); - return this; - } - - /** Keywords can boost or suppress specialized terminology and brands */ - @java.lang.Override - @JsonSetter(value = "keywords", nulls = Nulls.SKIP) - public _FinalStage keywords(Optional> keywords) { - this.keywords = keywords; - return this; - } - - @java.lang.Override - public _FinalStage keyterm(String keyterm) { - this.keyterm = Optional.of(Collections.singletonList(keyterm)); - return this; - } - - /** - * Key term prompting can boost or suppress specialized terminology and brands. Only compatible - * with Nova-3 - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage keyterm(List keyterm) { - this.keyterm = Optional.ofNullable(keyterm); - return this; - } - - /** - * Key term prompting can boost or suppress specialized terminology and brands. Only compatible - * with Nova-3 - */ - @java.lang.Override - @JsonSetter(value = "keyterm", nulls = Nulls.SKIP) - public _FinalStage keyterm(Optional> keyterm) { - this.keyterm = keyterm; - return this; - } - - @java.lang.Override - public _FinalStage customIntent(String customIntent) { - this.customIntent = Optional.of(Collections.singletonList(customIntent)); - return this; - } - - /** - * Custom intents you want the model to detect within your input audio if present - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage customIntent(List customIntent) { - this.customIntent = Optional.ofNullable(customIntent); - return this; - } - - /** Custom intents you want the model to detect within your input audio if present */ - @java.lang.Override - @JsonSetter(value = "custom_intent", nulls = Nulls.SKIP) - public _FinalStage customIntent(Optional> customIntent) { - this.customIntent = customIntent; - return this; - } - - @java.lang.Override - public _FinalStage customTopic(String customTopic) { - this.customTopic = Optional.of(Collections.singletonList(customTopic)); - return this; - } - - /** - * Custom topics you want the model to detect within your input audio or text if present Submit - * up to 100. - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage customTopic(List customTopic) { - this.customTopic = Optional.ofNullable(customTopic); - return this; - } - - /** - * Custom topics you want the model to detect within your input audio or text if present Submit - * up to 100. - */ - @java.lang.Override - @JsonSetter(value = "custom_topic", nulls = Nulls.SKIP) - public _FinalStage customTopic(Optional> customTopic) { - this.customTopic = customTopic; - return this; - } - - @java.lang.Override - public _FinalStage tag(String tag) { - this.tag = Optional.of(Collections.singletonList(tag)); - return this; - } - - /** - * Label your requests for the purpose of identification during usage reporting - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage tag(List tag) { - this.tag = Optional.ofNullable(tag); - return this; - } - - /** Label your requests for the purpose of identification during usage reporting */ - @java.lang.Override - @JsonSetter(value = "tag", nulls = Nulls.SKIP) - public _FinalStage tag(Optional> tag) { - this.tag = tag; - return this; - } - - @java.lang.Override - public _FinalStage extra(String extra) { - this.extra = Optional.of(Collections.singletonList(extra)); - return this; - } - - /** - * Arbitrary key-value pairs that are attached to the API response for usage in downstream - * processing - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage extra(List extra) { - this.extra = Optional.ofNullable(extra); - return this; - } - - /** - * Arbitrary key-value pairs that are attached to the API response for usage in downstream - * processing - */ - @java.lang.Override - @JsonSetter(value = "extra", nulls = Nulls.SKIP) - public _FinalStage extra(Optional> extra) { - this.extra = extra; - return this; - } - - @java.lang.Override - public ListenV1RequestUrl build() { - return new ListenV1RequestUrl( - extra, - tag, - customTopic, - customIntent, - keyterm, - keywords, - replace, - search, - callback, - callbackMethod, - sentiment, - summarize, - topics, - customTopicMode, - intents, - customIntentMode, - detectEntities, - detectLanguage, - diarize, - dictation, - encoding, - fillerWords, - language, - measurements, - model, - multichannel, - numerals, - paragraphs, - profanityFilter, - punctuate, - redact, - smartFormat, - utterances, - uttSplit, - version, - mipOptOut, - url, - additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/listen/v1/media/requests/MediaTranscribeRequestOctetStream.java b/src/main/java/resources/listen/v1/media/requests/MediaTranscribeRequestOctetStream.java deleted file mode 100644 index 7486d49..0000000 --- a/src/main/java/resources/listen/v1/media/requests/MediaTranscribeRequestOctetStream.java +++ /dev/null @@ -1,1828 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v1.media.requests; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.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 core.ObjectMappers; -import java.util.Collections; -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; -import resources.listen.v1.media.types.MediaTranscribeRequestCallbackMethod; -import resources.listen.v1.media.types.MediaTranscribeRequestCustomIntentMode; -import resources.listen.v1.media.types.MediaTranscribeRequestCustomTopicMode; -import resources.listen.v1.media.types.MediaTranscribeRequestEncoding; -import resources.listen.v1.media.types.MediaTranscribeRequestModel; -import resources.listen.v1.media.types.MediaTranscribeRequestSummarize; -import resources.listen.v1.media.types.MediaTranscribeRequestVersion; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = MediaTranscribeRequestOctetStream.Builder.class) -public final class MediaTranscribeRequestOctetStream { - private final Optional> extra; - - private final Optional> tag; - - private final Optional> customTopic; - - private final Optional> customIntent; - - private final Optional> keyterm; - - private final Optional> keywords; - - private final Optional> replace; - - private final Optional> search; - - private final Optional callback; - - private final Optional callbackMethod; - - private final Optional sentiment; - - private final Optional summarize; - - private final Optional topics; - - private final Optional customTopicMode; - - private final Optional intents; - - private final Optional customIntentMode; - - private final Optional detectEntities; - - private final Optional detectLanguage; - - private final Optional diarize; - - private final Optional dictation; - - private final Optional encoding; - - private final Optional fillerWords; - - private final Optional language; - - private final Optional measurements; - - private final Optional model; - - private final Optional multichannel; - - private final Optional numerals; - - private final Optional paragraphs; - - private final Optional profanityFilter; - - private final Optional punctuate; - - private final Optional redact; - - private final Optional smartFormat; - - private final Optional utterances; - - private final Optional uttSplit; - - private final Optional version; - - private final Optional mipOptOut; - - private final byte[] body; - - private final Map additionalProperties; - - private MediaTranscribeRequestOctetStream( - Optional> extra, - Optional> tag, - Optional> customTopic, - Optional> customIntent, - Optional> keyterm, - Optional> keywords, - Optional> replace, - Optional> search, - Optional callback, - Optional callbackMethod, - Optional sentiment, - Optional summarize, - Optional topics, - Optional customTopicMode, - Optional intents, - Optional customIntentMode, - Optional detectEntities, - Optional detectLanguage, - Optional diarize, - Optional dictation, - Optional encoding, - Optional fillerWords, - Optional language, - Optional measurements, - Optional model, - Optional multichannel, - Optional numerals, - Optional paragraphs, - Optional profanityFilter, - Optional punctuate, - Optional redact, - Optional smartFormat, - Optional utterances, - Optional uttSplit, - Optional version, - Optional mipOptOut, - byte[] body, - Map additionalProperties) { - this.extra = extra; - this.tag = tag; - this.customTopic = customTopic; - this.customIntent = customIntent; - this.keyterm = keyterm; - this.keywords = keywords; - this.replace = replace; - this.search = search; - this.callback = callback; - this.callbackMethod = callbackMethod; - this.sentiment = sentiment; - this.summarize = summarize; - this.topics = topics; - this.customTopicMode = customTopicMode; - this.intents = intents; - this.customIntentMode = customIntentMode; - this.detectEntities = detectEntities; - this.detectLanguage = detectLanguage; - this.diarize = diarize; - this.dictation = dictation; - this.encoding = encoding; - this.fillerWords = fillerWords; - this.language = language; - this.measurements = measurements; - this.model = model; - this.multichannel = multichannel; - this.numerals = numerals; - this.paragraphs = paragraphs; - this.profanityFilter = profanityFilter; - this.punctuate = punctuate; - this.redact = redact; - this.smartFormat = smartFormat; - this.utterances = utterances; - this.uttSplit = uttSplit; - this.version = version; - this.mipOptOut = mipOptOut; - this.body = body; - this.additionalProperties = additionalProperties; - } - - /** - * @return Arbitrary key-value pairs that are attached to the API response for usage in downstream - * processing - */ - @JsonIgnore - public Optional> getExtra() { - return extra; - } - - /** - * @return Label your requests for the purpose of identification during usage reporting - */ - @JsonIgnore - public Optional> getTag() { - return tag; - } - - /** - * @return Custom topics you want the model to detect within your input audio or text if present - * Submit up to 100. - */ - @JsonIgnore - public Optional> getCustomTopic() { - return customTopic; - } - - /** - * @return Custom intents you want the model to detect within your input audio if present - */ - @JsonIgnore - public Optional> getCustomIntent() { - return customIntent; - } - - /** - * @return Key term prompting can boost or suppress specialized terminology and brands. Only - * compatible with Nova-3 - */ - @JsonIgnore - public Optional> getKeyterm() { - return keyterm; - } - - /** - * @return Keywords can boost or suppress specialized terminology and brands - */ - @JsonIgnore - public Optional> getKeywords() { - return keywords; - } - - /** - * @return Search for terms or phrases in submitted audio and replaces them - */ - @JsonIgnore - public Optional> getReplace() { - return replace; - } - - /** - * @return Search for terms or phrases in submitted audio - */ - @JsonIgnore - public Optional> getSearch() { - return search; - } - - /** - * @return URL to which we'll make the callback request - */ - @JsonIgnore - public Optional getCallback() { - return callback; - } - - /** - * @return HTTP method by which the callback request will be made - */ - @JsonIgnore - public Optional getCallbackMethod() { - return callbackMethod; - } - - /** - * @return Recognizes the sentiment throughout a transcript or text - */ - @JsonIgnore - public Optional getSentiment() { - return sentiment; - } - - /** - * @return Summarize content. For Listen API, supports string version option. For Read API, - * accepts boolean only. - */ - @JsonIgnore - public Optional getSummarize() { - return summarize; - } - - /** - * @return Detect topics throughout a transcript or text - */ - @JsonIgnore - public Optional getTopics() { - return topics; - } - - /** - * @return Sets how the model will interpret strings submitted to the custom_topic - * param. When strict, the model will only return topics submitted using the - * custom_topic param. When extended, the model will return its own - * detected topics in addition to those submitted using the custom_topic param - */ - @JsonIgnore - public Optional getCustomTopicMode() { - return customTopicMode; - } - - /** - * @return Recognizes speaker intent throughout a transcript or text - */ - @JsonIgnore - public Optional getIntents() { - return intents; - } - - /** - * @return Sets how the model will interpret intents submitted to the custom_intent - * param. When strict, the model will only return intents submitted using the - * custom_intent param. When extended, the model will return its own - * detected intents in the custom_intent param. - */ - @JsonIgnore - public Optional getCustomIntentMode() { - return customIntentMode; - } - - /** - * @return Identifies and extracts key entities from content in submitted audio - */ - @JsonIgnore - public Optional getDetectEntities() { - return detectEntities; - } - - /** - * @return Identifies the dominant language spoken in submitted audio - */ - @JsonIgnore - public Optional getDetectLanguage() { - return detectLanguage; - } - - /** - * @return Recognize speaker changes. Each word in the transcript will be assigned a speaker - * number starting at 0 - */ - @JsonIgnore - public Optional getDiarize() { - return diarize; - } - - /** - * @return Dictation mode for controlling formatting with dictated speech - */ - @JsonIgnore - public Optional getDictation() { - return dictation; - } - - /** - * @return Specify the expected encoding of your submitted audio - */ - @JsonIgnore - public Optional getEncoding() { - return encoding; - } - - /** - * @return Filler Words can help transcribe interruptions in your audio, like "uh" and - * "um" - */ - @JsonIgnore - public Optional getFillerWords() { - return fillerWords; - } - - /** - * @return The BCP-47 language tag that hints at - * the primary spoken language. Depending on the Model and API endpoint you choose only - * certain languages are available - */ - @JsonIgnore - public Optional getLanguage() { - return language; - } - - /** - * @return Spoken measurements will be converted to their corresponding abbreviations - */ - @JsonIgnore - public Optional getMeasurements() { - return measurements; - } - - /** - * @return AI model used to process submitted audio - */ - @JsonIgnore - public Optional getModel() { - return model; - } - - /** - * @return Transcribe each audio channel independently - */ - @JsonIgnore - public Optional getMultichannel() { - return multichannel; - } - - /** - * @return Numerals converts numbers from written format to numerical format - */ - @JsonIgnore - public Optional getNumerals() { - return numerals; - } - - /** - * @return Splits audio into paragraphs to improve transcript readability - */ - @JsonIgnore - public Optional getParagraphs() { - return paragraphs; - } - - /** - * @return Profanity Filter looks for recognized profanity and converts it to the nearest - * recognized non-profane word or removes it from the transcript completely - */ - @JsonIgnore - public Optional getProfanityFilter() { - return profanityFilter; - } - - /** - * @return Add punctuation and capitalization to the transcript - */ - @JsonIgnore - public Optional getPunctuate() { - return punctuate; - } - - /** - * @return Redaction removes sensitive information from your transcripts - */ - @JsonIgnore - public Optional getRedact() { - return redact; - } - - /** - * @return Apply formatting to transcript output. When set to true, additional formatting will be - * applied to transcripts to improve readability - */ - @JsonIgnore - public Optional getSmartFormat() { - return smartFormat; - } - - /** - * @return Segments speech into meaningful semantic units - */ - @JsonIgnore - public Optional getUtterances() { - return utterances; - } - - /** - * @return Seconds to wait before detecting a pause between words in submitted audio - */ - @JsonIgnore - public Optional getUttSplit() { - return uttSplit; - } - - /** - * @return Version of an AI model to use - */ - @JsonIgnore - public Optional getVersion() { - return version; - } - - /** - * @return Opts out requests from the Deepgram Model Improvement Program. Refer to our Docs for - * pricing impacts before setting this to true. https://dpgr.am/deepgram-mip - */ - @JsonIgnore - public Optional getMipOptOut() { - return mipOptOut; - } - - @JsonProperty("body") - public byte[] getBody() { - return body; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof MediaTranscribeRequestOctetStream - && equalTo((MediaTranscribeRequestOctetStream) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(MediaTranscribeRequestOctetStream other) { - return extra.equals(other.extra) - && tag.equals(other.tag) - && customTopic.equals(other.customTopic) - && customIntent.equals(other.customIntent) - && keyterm.equals(other.keyterm) - && keywords.equals(other.keywords) - && replace.equals(other.replace) - && search.equals(other.search) - && callback.equals(other.callback) - && callbackMethod.equals(other.callbackMethod) - && sentiment.equals(other.sentiment) - && summarize.equals(other.summarize) - && topics.equals(other.topics) - && customTopicMode.equals(other.customTopicMode) - && intents.equals(other.intents) - && customIntentMode.equals(other.customIntentMode) - && detectEntities.equals(other.detectEntities) - && detectLanguage.equals(other.detectLanguage) - && diarize.equals(other.diarize) - && dictation.equals(other.dictation) - && encoding.equals(other.encoding) - && fillerWords.equals(other.fillerWords) - && language.equals(other.language) - && measurements.equals(other.measurements) - && model.equals(other.model) - && multichannel.equals(other.multichannel) - && numerals.equals(other.numerals) - && paragraphs.equals(other.paragraphs) - && profanityFilter.equals(other.profanityFilter) - && punctuate.equals(other.punctuate) - && redact.equals(other.redact) - && smartFormat.equals(other.smartFormat) - && utterances.equals(other.utterances) - && uttSplit.equals(other.uttSplit) - && version.equals(other.version) - && mipOptOut.equals(other.mipOptOut) - && body.equals(other.body); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.extra, - this.tag, - this.customTopic, - this.customIntent, - this.keyterm, - this.keywords, - this.replace, - this.search, - this.callback, - this.callbackMethod, - this.sentiment, - this.summarize, - this.topics, - this.customTopicMode, - this.intents, - this.customIntentMode, - this.detectEntities, - this.detectLanguage, - this.diarize, - this.dictation, - this.encoding, - this.fillerWords, - this.language, - this.measurements, - this.model, - this.multichannel, - this.numerals, - this.paragraphs, - this.profanityFilter, - this.punctuate, - this.redact, - this.smartFormat, - this.utterances, - this.uttSplit, - this.version, - this.mipOptOut, - this.body); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static BodyStage builder() { - return new Builder(); - } - - public interface BodyStage { - _FinalStage body(@NotNull byte[] body); - - Builder from(MediaTranscribeRequestOctetStream other); - } - - public interface _FinalStage { - MediaTranscribeRequestOctetStream build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** - * Arbitrary key-value pairs that are attached to the API response for usage in downstream - * processing - */ - _FinalStage extra(Optional> extra); - - _FinalStage extra(List extra); - - _FinalStage extra(String extra); - - /** Label your requests for the purpose of identification during usage reporting */ - _FinalStage tag(Optional> tag); - - _FinalStage tag(List tag); - - _FinalStage tag(String tag); - - /** - * Custom topics you want the model to detect within your input audio or text if present Submit - * up to 100. - */ - _FinalStage customTopic(Optional> customTopic); - - _FinalStage customTopic(List customTopic); - - _FinalStage customTopic(String customTopic); - - /** Custom intents you want the model to detect within your input audio if present */ - _FinalStage customIntent(Optional> customIntent); - - _FinalStage customIntent(List customIntent); - - _FinalStage customIntent(String customIntent); - - /** - * Key term prompting can boost or suppress specialized terminology and brands. Only compatible - * with Nova-3 - */ - _FinalStage keyterm(Optional> keyterm); - - _FinalStage keyterm(List keyterm); - - _FinalStage keyterm(String keyterm); - - /** Keywords can boost or suppress specialized terminology and brands */ - _FinalStage keywords(Optional> keywords); - - _FinalStage keywords(List keywords); - - _FinalStage keywords(String keywords); - - /** Search for terms or phrases in submitted audio and replaces them */ - _FinalStage replace(Optional> replace); - - _FinalStage replace(List replace); - - _FinalStage replace(String replace); - - /** Search for terms or phrases in submitted audio */ - _FinalStage search(Optional> search); - - _FinalStage search(List search); - - _FinalStage search(String search); - - /** URL to which we'll make the callback request */ - _FinalStage callback(Optional callback); - - _FinalStage callback(String callback); - - /** HTTP method by which the callback request will be made */ - _FinalStage callbackMethod(Optional callbackMethod); - - _FinalStage callbackMethod(MediaTranscribeRequestCallbackMethod callbackMethod); - - /** Recognizes the sentiment throughout a transcript or text */ - _FinalStage sentiment(Optional sentiment); - - _FinalStage sentiment(Boolean sentiment); - - /** - * Summarize content. For Listen API, supports string version option. For Read API, accepts - * boolean only. - */ - _FinalStage summarize(Optional summarize); - - _FinalStage summarize(MediaTranscribeRequestSummarize summarize); - - /** Detect topics throughout a transcript or text */ - _FinalStage topics(Optional topics); - - _FinalStage topics(Boolean topics); - - /** - * Sets how the model will interpret strings submitted to the custom_topic param. - * When strict, the model will only return topics submitted using the - * custom_topic param. When extended, the model will return its own detected - * topics in addition to those submitted using the custom_topic param - */ - _FinalStage customTopicMode(Optional customTopicMode); - - _FinalStage customTopicMode(MediaTranscribeRequestCustomTopicMode customTopicMode); - - /** Recognizes speaker intent throughout a transcript or text */ - _FinalStage intents(Optional intents); - - _FinalStage intents(Boolean intents); - - /** - * Sets how the model will interpret intents submitted to the custom_intent param. - * When strict, the model will only return intents submitted using the - * custom_intent param. When extended, the model will return its own - * detected intents in the custom_intent param. - */ - _FinalStage customIntentMode(Optional customIntentMode); - - _FinalStage customIntentMode(MediaTranscribeRequestCustomIntentMode customIntentMode); - - /** Identifies and extracts key entities from content in submitted audio */ - _FinalStage detectEntities(Optional detectEntities); - - _FinalStage detectEntities(Boolean detectEntities); - - /** Identifies the dominant language spoken in submitted audio */ - _FinalStage detectLanguage(Optional detectLanguage); - - _FinalStage detectLanguage(Boolean detectLanguage); - - /** - * Recognize speaker changes. Each word in the transcript will be assigned a speaker number - * starting at 0 - */ - _FinalStage diarize(Optional diarize); - - _FinalStage diarize(Boolean diarize); - - /** Dictation mode for controlling formatting with dictated speech */ - _FinalStage dictation(Optional dictation); - - _FinalStage dictation(Boolean dictation); - - /** Specify the expected encoding of your submitted audio */ - _FinalStage encoding(Optional encoding); - - _FinalStage encoding(MediaTranscribeRequestEncoding encoding); - - /** - * Filler Words can help transcribe interruptions in your audio, like "uh" and - * "um" - */ - _FinalStage fillerWords(Optional fillerWords); - - _FinalStage fillerWords(Boolean fillerWords); - - /** - * The BCP-47 language tag that hints at the - * primary spoken language. Depending on the Model and API endpoint you choose only certain - * languages are available - */ - _FinalStage language(Optional language); - - _FinalStage language(String language); - - /** Spoken measurements will be converted to their corresponding abbreviations */ - _FinalStage measurements(Optional measurements); - - _FinalStage measurements(Boolean measurements); - - /** AI model used to process submitted audio */ - _FinalStage model(Optional model); - - _FinalStage model(MediaTranscribeRequestModel model); - - /** Transcribe each audio channel independently */ - _FinalStage multichannel(Optional multichannel); - - _FinalStage multichannel(Boolean multichannel); - - /** Numerals converts numbers from written format to numerical format */ - _FinalStage numerals(Optional numerals); - - _FinalStage numerals(Boolean numerals); - - /** Splits audio into paragraphs to improve transcript readability */ - _FinalStage paragraphs(Optional paragraphs); - - _FinalStage paragraphs(Boolean paragraphs); - - /** - * Profanity Filter looks for recognized profanity and converts it to the nearest recognized - * non-profane word or removes it from the transcript completely - */ - _FinalStage profanityFilter(Optional profanityFilter); - - _FinalStage profanityFilter(Boolean profanityFilter); - - /** Add punctuation and capitalization to the transcript */ - _FinalStage punctuate(Optional punctuate); - - _FinalStage punctuate(Boolean punctuate); - - /** Redaction removes sensitive information from your transcripts */ - _FinalStage redact(Optional redact); - - _FinalStage redact(String redact); - - /** - * Apply formatting to transcript output. When set to true, additional formatting will be - * applied to transcripts to improve readability - */ - _FinalStage smartFormat(Optional smartFormat); - - _FinalStage smartFormat(Boolean smartFormat); - - /** Segments speech into meaningful semantic units */ - _FinalStage utterances(Optional utterances); - - _FinalStage utterances(Boolean utterances); - - /** Seconds to wait before detecting a pause between words in submitted audio */ - _FinalStage uttSplit(Optional uttSplit); - - _FinalStage uttSplit(Double uttSplit); - - /** Version of an AI model to use */ - _FinalStage version(Optional version); - - _FinalStage version(MediaTranscribeRequestVersion version); - - /** - * Opts out requests from the Deepgram Model Improvement Program. Refer to our Docs for pricing - * impacts before setting this to true. https://dpgr.am/deepgram-mip - */ - _FinalStage mipOptOut(Optional mipOptOut); - - _FinalStage mipOptOut(Boolean mipOptOut); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements BodyStage, _FinalStage { - private byte[] body; - - private Optional mipOptOut = Optional.empty(); - - private Optional version = Optional.empty(); - - private Optional uttSplit = Optional.empty(); - - private Optional utterances = Optional.empty(); - - private Optional smartFormat = Optional.empty(); - - private Optional redact = Optional.empty(); - - private Optional punctuate = Optional.empty(); - - private Optional profanityFilter = Optional.empty(); - - private Optional paragraphs = Optional.empty(); - - private Optional numerals = Optional.empty(); - - private Optional multichannel = Optional.empty(); - - private Optional model = Optional.empty(); - - private Optional measurements = Optional.empty(); - - private Optional language = Optional.empty(); - - private Optional fillerWords = Optional.empty(); - - private Optional encoding = Optional.empty(); - - private Optional dictation = Optional.empty(); - - private Optional diarize = Optional.empty(); - - private Optional detectLanguage = Optional.empty(); - - private Optional detectEntities = Optional.empty(); - - private Optional customIntentMode = Optional.empty(); - - private Optional intents = Optional.empty(); - - private Optional customTopicMode = Optional.empty(); - - private Optional topics = Optional.empty(); - - private Optional summarize = Optional.empty(); - - private Optional sentiment = Optional.empty(); - - private Optional callbackMethod = Optional.empty(); - - private Optional callback = Optional.empty(); - - private Optional> search = Optional.empty(); - - private Optional> replace = Optional.empty(); - - private Optional> keywords = Optional.empty(); - - private Optional> keyterm = Optional.empty(); - - private Optional> customIntent = Optional.empty(); - - private Optional> customTopic = Optional.empty(); - - private Optional> tag = Optional.empty(); - - private Optional> extra = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(MediaTranscribeRequestOctetStream other) { - extra(other.getExtra()); - tag(other.getTag()); - customTopic(other.getCustomTopic()); - customIntent(other.getCustomIntent()); - keyterm(other.getKeyterm()); - keywords(other.getKeywords()); - replace(other.getReplace()); - search(other.getSearch()); - callback(other.getCallback()); - callbackMethod(other.getCallbackMethod()); - sentiment(other.getSentiment()); - summarize(other.getSummarize()); - topics(other.getTopics()); - customTopicMode(other.getCustomTopicMode()); - intents(other.getIntents()); - customIntentMode(other.getCustomIntentMode()); - detectEntities(other.getDetectEntities()); - detectLanguage(other.getDetectLanguage()); - diarize(other.getDiarize()); - dictation(other.getDictation()); - encoding(other.getEncoding()); - fillerWords(other.getFillerWords()); - language(other.getLanguage()); - measurements(other.getMeasurements()); - model(other.getModel()); - multichannel(other.getMultichannel()); - numerals(other.getNumerals()); - paragraphs(other.getParagraphs()); - profanityFilter(other.getProfanityFilter()); - punctuate(other.getPunctuate()); - redact(other.getRedact()); - smartFormat(other.getSmartFormat()); - utterances(other.getUtterances()); - uttSplit(other.getUttSplit()); - version(other.getVersion()); - mipOptOut(other.getMipOptOut()); - body(other.getBody()); - return this; - } - - @java.lang.Override - @JsonSetter("body") - public _FinalStage body(@NotNull byte[] body) { - this.body = Objects.requireNonNull(body, "body must not be null"); - return this; - } - - /** - * Opts out requests from the Deepgram Model Improvement Program. Refer to our Docs for pricing - * impacts before setting this to true. https://dpgr.am/deepgram-mip - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage mipOptOut(Boolean mipOptOut) { - this.mipOptOut = Optional.ofNullable(mipOptOut); - return this; - } - - /** - * Opts out requests from the Deepgram Model Improvement Program. Refer to our Docs for pricing - * impacts before setting this to true. https://dpgr.am/deepgram-mip - */ - @java.lang.Override - @JsonSetter(value = "mip_opt_out", nulls = Nulls.SKIP) - public _FinalStage mipOptOut(Optional mipOptOut) { - this.mipOptOut = mipOptOut; - return this; - } - - /** - * Version of an AI model to use - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage version(MediaTranscribeRequestVersion version) { - this.version = Optional.ofNullable(version); - return this; - } - - /** Version of an AI model to use */ - @java.lang.Override - @JsonSetter(value = "version", nulls = Nulls.SKIP) - public _FinalStage version(Optional version) { - this.version = version; - return this; - } - - /** - * Seconds to wait before detecting a pause between words in submitted audio - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage uttSplit(Double uttSplit) { - this.uttSplit = Optional.ofNullable(uttSplit); - return this; - } - - /** Seconds to wait before detecting a pause between words in submitted audio */ - @java.lang.Override - @JsonSetter(value = "utt_split", nulls = Nulls.SKIP) - public _FinalStage uttSplit(Optional uttSplit) { - this.uttSplit = uttSplit; - return this; - } - - /** - * Segments speech into meaningful semantic units - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage utterances(Boolean utterances) { - this.utterances = Optional.ofNullable(utterances); - return this; - } - - /** Segments speech into meaningful semantic units */ - @java.lang.Override - @JsonSetter(value = "utterances", nulls = Nulls.SKIP) - public _FinalStage utterances(Optional utterances) { - this.utterances = utterances; - return this; - } - - /** - * Apply formatting to transcript output. When set to true, additional formatting will be - * applied to transcripts to improve readability - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage smartFormat(Boolean smartFormat) { - this.smartFormat = Optional.ofNullable(smartFormat); - return this; - } - - /** - * Apply formatting to transcript output. When set to true, additional formatting will be - * applied to transcripts to improve readability - */ - @java.lang.Override - @JsonSetter(value = "smart_format", nulls = Nulls.SKIP) - public _FinalStage smartFormat(Optional smartFormat) { - this.smartFormat = smartFormat; - return this; - } - - /** - * Redaction removes sensitive information from your transcripts - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage redact(String redact) { - this.redact = Optional.ofNullable(redact); - return this; - } - - /** Redaction removes sensitive information from your transcripts */ - @java.lang.Override - @JsonSetter(value = "redact", nulls = Nulls.SKIP) - public _FinalStage redact(Optional redact) { - this.redact = redact; - return this; - } - - /** - * Add punctuation and capitalization to the transcript - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage punctuate(Boolean punctuate) { - this.punctuate = Optional.ofNullable(punctuate); - return this; - } - - /** Add punctuation and capitalization to the transcript */ - @java.lang.Override - @JsonSetter(value = "punctuate", nulls = Nulls.SKIP) - public _FinalStage punctuate(Optional punctuate) { - this.punctuate = punctuate; - return this; - } - - /** - * Profanity Filter looks for recognized profanity and converts it to the nearest recognized - * non-profane word or removes it from the transcript completely - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage profanityFilter(Boolean profanityFilter) { - this.profanityFilter = Optional.ofNullable(profanityFilter); - return this; - } - - /** - * Profanity Filter looks for recognized profanity and converts it to the nearest recognized - * non-profane word or removes it from the transcript completely - */ - @java.lang.Override - @JsonSetter(value = "profanity_filter", nulls = Nulls.SKIP) - public _FinalStage profanityFilter(Optional profanityFilter) { - this.profanityFilter = profanityFilter; - return this; - } - - /** - * Splits audio into paragraphs to improve transcript readability - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage paragraphs(Boolean paragraphs) { - this.paragraphs = Optional.ofNullable(paragraphs); - return this; - } - - /** Splits audio into paragraphs to improve transcript readability */ - @java.lang.Override - @JsonSetter(value = "paragraphs", nulls = Nulls.SKIP) - public _FinalStage paragraphs(Optional paragraphs) { - this.paragraphs = paragraphs; - return this; - } - - /** - * Numerals converts numbers from written format to numerical format - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage numerals(Boolean numerals) { - this.numerals = Optional.ofNullable(numerals); - return this; - } - - /** Numerals converts numbers from written format to numerical format */ - @java.lang.Override - @JsonSetter(value = "numerals", nulls = Nulls.SKIP) - public _FinalStage numerals(Optional numerals) { - this.numerals = numerals; - return this; - } - - /** - * Transcribe each audio channel independently - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage multichannel(Boolean multichannel) { - this.multichannel = Optional.ofNullable(multichannel); - return this; - } - - /** Transcribe each audio channel independently */ - @java.lang.Override - @JsonSetter(value = "multichannel", nulls = Nulls.SKIP) - public _FinalStage multichannel(Optional multichannel) { - this.multichannel = multichannel; - return this; - } - - /** - * AI model used to process submitted audio - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage model(MediaTranscribeRequestModel model) { - this.model = Optional.ofNullable(model); - return this; - } - - /** AI model used to process submitted audio */ - @java.lang.Override - @JsonSetter(value = "model", nulls = Nulls.SKIP) - public _FinalStage model(Optional model) { - this.model = model; - return this; - } - - /** - * Spoken measurements will be converted to their corresponding abbreviations - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage measurements(Boolean measurements) { - this.measurements = Optional.ofNullable(measurements); - return this; - } - - /** Spoken measurements will be converted to their corresponding abbreviations */ - @java.lang.Override - @JsonSetter(value = "measurements", nulls = Nulls.SKIP) - public _FinalStage measurements(Optional measurements) { - this.measurements = measurements; - return this; - } - - /** - * The BCP-47 language tag that hints at the - * primary spoken language. Depending on the Model and API endpoint you choose only certain - * languages are available - * - * @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; - } - - /** - * The BCP-47 language tag that hints at the - * primary spoken language. Depending on the Model and API endpoint you choose only certain - * languages are available - */ - @java.lang.Override - @JsonSetter(value = "language", nulls = Nulls.SKIP) - public _FinalStage language(Optional language) { - this.language = language; - return this; - } - - /** - * Filler Words can help transcribe interruptions in your audio, like "uh" and - * "um" - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage fillerWords(Boolean fillerWords) { - this.fillerWords = Optional.ofNullable(fillerWords); - return this; - } - - /** - * Filler Words can help transcribe interruptions in your audio, like "uh" and - * "um" - */ - @java.lang.Override - @JsonSetter(value = "filler_words", nulls = Nulls.SKIP) - public _FinalStage fillerWords(Optional fillerWords) { - this.fillerWords = fillerWords; - return this; - } - - /** - * Specify the expected encoding of your submitted audio - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage encoding(MediaTranscribeRequestEncoding encoding) { - this.encoding = Optional.ofNullable(encoding); - return this; - } - - /** Specify the expected encoding of your submitted audio */ - @java.lang.Override - @JsonSetter(value = "encoding", nulls = Nulls.SKIP) - public _FinalStage encoding(Optional encoding) { - this.encoding = encoding; - return this; - } - - /** - * Dictation mode for controlling formatting with dictated speech - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage dictation(Boolean dictation) { - this.dictation = Optional.ofNullable(dictation); - return this; - } - - /** Dictation mode for controlling formatting with dictated speech */ - @java.lang.Override - @JsonSetter(value = "dictation", nulls = Nulls.SKIP) - public _FinalStage dictation(Optional dictation) { - this.dictation = dictation; - return this; - } - - /** - * Recognize speaker changes. Each word in the transcript will be assigned a speaker number - * starting at 0 - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage diarize(Boolean diarize) { - this.diarize = Optional.ofNullable(diarize); - return this; - } - - /** - * Recognize speaker changes. Each word in the transcript will be assigned a speaker number - * starting at 0 - */ - @java.lang.Override - @JsonSetter(value = "diarize", nulls = Nulls.SKIP) - public _FinalStage diarize(Optional diarize) { - this.diarize = diarize; - return this; - } - - /** - * Identifies the dominant language spoken in submitted audio - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage detectLanguage(Boolean detectLanguage) { - this.detectLanguage = Optional.ofNullable(detectLanguage); - return this; - } - - /** Identifies the dominant language spoken in submitted audio */ - @java.lang.Override - @JsonSetter(value = "detect_language", nulls = Nulls.SKIP) - public _FinalStage detectLanguage(Optional detectLanguage) { - this.detectLanguage = detectLanguage; - return this; - } - - /** - * Identifies and extracts key entities from content in submitted audio - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage detectEntities(Boolean detectEntities) { - this.detectEntities = Optional.ofNullable(detectEntities); - return this; - } - - /** Identifies and extracts key entities from content in submitted audio */ - @java.lang.Override - @JsonSetter(value = "detect_entities", nulls = Nulls.SKIP) - public _FinalStage detectEntities(Optional detectEntities) { - this.detectEntities = detectEntities; - return this; - } - - /** - * Sets how the model will interpret intents submitted to the custom_intent param. - * When strict, the model will only return intents submitted using the - * custom_intent param. When extended, the model will return its own - * detected intents in the custom_intent param. - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage customIntentMode(MediaTranscribeRequestCustomIntentMode customIntentMode) { - this.customIntentMode = Optional.ofNullable(customIntentMode); - return this; - } - - /** - * Sets how the model will interpret intents submitted to the custom_intent param. - * When strict, the model will only return intents submitted using the - * custom_intent param. When extended, the model will return its own - * detected intents in the custom_intent param. - */ - @java.lang.Override - @JsonSetter(value = "custom_intent_mode", nulls = Nulls.SKIP) - public _FinalStage customIntentMode( - Optional customIntentMode) { - this.customIntentMode = customIntentMode; - return this; - } - - /** - * Recognizes speaker intent throughout a transcript or text - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage intents(Boolean intents) { - this.intents = Optional.ofNullable(intents); - return this; - } - - /** Recognizes speaker intent throughout a transcript or text */ - @java.lang.Override - @JsonSetter(value = "intents", nulls = Nulls.SKIP) - public _FinalStage intents(Optional intents) { - this.intents = intents; - return this; - } - - /** - * Sets how the model will interpret strings submitted to the custom_topic param. - * When strict, the model will only return topics submitted using the - * custom_topic param. When extended, the model will return its own detected - * topics in addition to those submitted using the custom_topic param - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage customTopicMode(MediaTranscribeRequestCustomTopicMode customTopicMode) { - this.customTopicMode = Optional.ofNullable(customTopicMode); - return this; - } - - /** - * Sets how the model will interpret strings submitted to the custom_topic param. - * When strict, the model will only return topics submitted using the - * custom_topic param. When extended, the model will return its own detected - * topics in addition to those submitted using the custom_topic param - */ - @java.lang.Override - @JsonSetter(value = "custom_topic_mode", nulls = Nulls.SKIP) - public _FinalStage customTopicMode( - Optional customTopicMode) { - this.customTopicMode = customTopicMode; - return this; - } - - /** - * Detect topics throughout a transcript or text - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage topics(Boolean topics) { - this.topics = Optional.ofNullable(topics); - return this; - } - - /** Detect topics throughout a transcript or text */ - @java.lang.Override - @JsonSetter(value = "topics", nulls = Nulls.SKIP) - public _FinalStage topics(Optional topics) { - this.topics = topics; - return this; - } - - /** - * Summarize content. For Listen API, supports string version option. For Read API, accepts - * boolean only. - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage summarize(MediaTranscribeRequestSummarize summarize) { - this.summarize = Optional.ofNullable(summarize); - return this; - } - - /** - * Summarize content. For Listen API, supports string version option. For Read API, accepts - * boolean only. - */ - @java.lang.Override - @JsonSetter(value = "summarize", nulls = Nulls.SKIP) - public _FinalStage summarize(Optional summarize) { - this.summarize = summarize; - return this; - } - - /** - * Recognizes the sentiment throughout a transcript or text - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage sentiment(Boolean sentiment) { - this.sentiment = Optional.ofNullable(sentiment); - return this; - } - - /** Recognizes the sentiment throughout a transcript or text */ - @java.lang.Override - @JsonSetter(value = "sentiment", nulls = Nulls.SKIP) - public _FinalStage sentiment(Optional sentiment) { - this.sentiment = sentiment; - return this; - } - - /** - * HTTP method by which the callback request will be made - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage callbackMethod(MediaTranscribeRequestCallbackMethod callbackMethod) { - this.callbackMethod = Optional.ofNullable(callbackMethod); - return this; - } - - /** HTTP method by which the callback request will be made */ - @java.lang.Override - @JsonSetter(value = "callback_method", nulls = Nulls.SKIP) - public _FinalStage callbackMethod( - Optional callbackMethod) { - this.callbackMethod = callbackMethod; - return this; - } - - /** - * URL to which we'll make the callback request - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage callback(String callback) { - this.callback = Optional.ofNullable(callback); - return this; - } - - /** URL to which we'll make the callback request */ - @java.lang.Override - @JsonSetter(value = "callback", nulls = Nulls.SKIP) - public _FinalStage callback(Optional callback) { - this.callback = callback; - return this; - } - - @java.lang.Override - public _FinalStage search(String search) { - this.search = Optional.of(Collections.singletonList(search)); - return this; - } - - /** - * Search for terms or phrases in submitted audio - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage search(List search) { - this.search = Optional.ofNullable(search); - return this; - } - - /** Search for terms or phrases in submitted audio */ - @java.lang.Override - @JsonSetter(value = "search", nulls = Nulls.SKIP) - public _FinalStage search(Optional> search) { - this.search = search; - return this; - } - - @java.lang.Override - public _FinalStage replace(String replace) { - this.replace = Optional.of(Collections.singletonList(replace)); - return this; - } - - /** - * Search for terms or phrases in submitted audio and replaces them - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage replace(List replace) { - this.replace = Optional.ofNullable(replace); - return this; - } - - /** Search for terms or phrases in submitted audio and replaces them */ - @java.lang.Override - @JsonSetter(value = "replace", nulls = Nulls.SKIP) - public _FinalStage replace(Optional> replace) { - this.replace = replace; - return this; - } - - @java.lang.Override - public _FinalStage keywords(String keywords) { - this.keywords = Optional.of(Collections.singletonList(keywords)); - return this; - } - - /** - * Keywords can boost or suppress specialized terminology and brands - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage keywords(List keywords) { - this.keywords = Optional.ofNullable(keywords); - return this; - } - - /** Keywords can boost or suppress specialized terminology and brands */ - @java.lang.Override - @JsonSetter(value = "keywords", nulls = Nulls.SKIP) - public _FinalStage keywords(Optional> keywords) { - this.keywords = keywords; - return this; - } - - @java.lang.Override - public _FinalStage keyterm(String keyterm) { - this.keyterm = Optional.of(Collections.singletonList(keyterm)); - return this; - } - - /** - * Key term prompting can boost or suppress specialized terminology and brands. Only compatible - * with Nova-3 - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage keyterm(List keyterm) { - this.keyterm = Optional.ofNullable(keyterm); - return this; - } - - /** - * Key term prompting can boost or suppress specialized terminology and brands. Only compatible - * with Nova-3 - */ - @java.lang.Override - @JsonSetter(value = "keyterm", nulls = Nulls.SKIP) - public _FinalStage keyterm(Optional> keyterm) { - this.keyterm = keyterm; - return this; - } - - @java.lang.Override - public _FinalStage customIntent(String customIntent) { - this.customIntent = Optional.of(Collections.singletonList(customIntent)); - return this; - } - - /** - * Custom intents you want the model to detect within your input audio if present - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage customIntent(List customIntent) { - this.customIntent = Optional.ofNullable(customIntent); - return this; - } - - /** Custom intents you want the model to detect within your input audio if present */ - @java.lang.Override - @JsonSetter(value = "custom_intent", nulls = Nulls.SKIP) - public _FinalStage customIntent(Optional> customIntent) { - this.customIntent = customIntent; - return this; - } - - @java.lang.Override - public _FinalStage customTopic(String customTopic) { - this.customTopic = Optional.of(Collections.singletonList(customTopic)); - return this; - } - - /** - * Custom topics you want the model to detect within your input audio or text if present Submit - * up to 100. - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage customTopic(List customTopic) { - this.customTopic = Optional.ofNullable(customTopic); - return this; - } - - /** - * Custom topics you want the model to detect within your input audio or text if present Submit - * up to 100. - */ - @java.lang.Override - @JsonSetter(value = "custom_topic", nulls = Nulls.SKIP) - public _FinalStage customTopic(Optional> customTopic) { - this.customTopic = customTopic; - return this; - } - - @java.lang.Override - public _FinalStage tag(String tag) { - this.tag = Optional.of(Collections.singletonList(tag)); - return this; - } - - /** - * Label your requests for the purpose of identification during usage reporting - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage tag(List tag) { - this.tag = Optional.ofNullable(tag); - return this; - } - - /** Label your requests for the purpose of identification during usage reporting */ - @java.lang.Override - @JsonSetter(value = "tag", nulls = Nulls.SKIP) - public _FinalStage tag(Optional> tag) { - this.tag = tag; - return this; - } - - @java.lang.Override - public _FinalStage extra(String extra) { - this.extra = Optional.of(Collections.singletonList(extra)); - return this; - } - - /** - * Arbitrary key-value pairs that are attached to the API response for usage in downstream - * processing - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage extra(List extra) { - this.extra = Optional.ofNullable(extra); - return this; - } - - /** - * Arbitrary key-value pairs that are attached to the API response for usage in downstream - * processing - */ - @java.lang.Override - @JsonSetter(value = "extra", nulls = Nulls.SKIP) - public _FinalStage extra(Optional> extra) { - this.extra = extra; - return this; - } - - @java.lang.Override - public MediaTranscribeRequestOctetStream build() { - return new MediaTranscribeRequestOctetStream( - extra, - tag, - customTopic, - customIntent, - keyterm, - keywords, - replace, - search, - callback, - callbackMethod, - sentiment, - summarize, - topics, - customTopicMode, - intents, - customIntentMode, - detectEntities, - detectLanguage, - diarize, - dictation, - encoding, - fillerWords, - language, - measurements, - model, - multichannel, - numerals, - paragraphs, - profanityFilter, - punctuate, - redact, - smartFormat, - utterances, - uttSplit, - version, - mipOptOut, - body, - additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/listen/v1/media/types/MediaTranscribeRequestCallbackMethod.java b/src/main/java/resources/listen/v1/media/types/MediaTranscribeRequestCallbackMethod.java deleted file mode 100644 index aaf9b61..0000000 --- a/src/main/java/resources/listen/v1/media/types/MediaTranscribeRequestCallbackMethod.java +++ /dev/null @@ -1,84 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v1.media.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class MediaTranscribeRequestCallbackMethod { - public static final MediaTranscribeRequestCallbackMethod PUT = - new MediaTranscribeRequestCallbackMethod(Value.PUT, "PUT"); - - public static final MediaTranscribeRequestCallbackMethod POST = - new MediaTranscribeRequestCallbackMethod(Value.POST, "POST"); - - private final Value value; - - private final String string; - - MediaTranscribeRequestCallbackMethod(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof MediaTranscribeRequestCallbackMethod - && this.string.equals(((MediaTranscribeRequestCallbackMethod) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case PUT: - return visitor.visitPut(); - case POST: - return visitor.visitPost(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static MediaTranscribeRequestCallbackMethod valueOf(String value) { - switch (value) { - case "PUT": - return PUT; - case "POST": - return POST; - default: - return new MediaTranscribeRequestCallbackMethod(Value.UNKNOWN, value); - } - } - - public enum Value { - POST, - - PUT, - - UNKNOWN - } - - public interface Visitor { - T visitPost(); - - T visitPut(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/resources/listen/v1/media/types/MediaTranscribeRequestCustomIntentMode.java b/src/main/java/resources/listen/v1/media/types/MediaTranscribeRequestCustomIntentMode.java deleted file mode 100644 index 450a4af..0000000 --- a/src/main/java/resources/listen/v1/media/types/MediaTranscribeRequestCustomIntentMode.java +++ /dev/null @@ -1,84 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v1.media.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class MediaTranscribeRequestCustomIntentMode { - public static final MediaTranscribeRequestCustomIntentMode STRICT = - new MediaTranscribeRequestCustomIntentMode(Value.STRICT, "strict"); - - public static final MediaTranscribeRequestCustomIntentMode EXTENDED = - new MediaTranscribeRequestCustomIntentMode(Value.EXTENDED, "extended"); - - private final Value value; - - private final String string; - - MediaTranscribeRequestCustomIntentMode(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof MediaTranscribeRequestCustomIntentMode - && this.string.equals(((MediaTranscribeRequestCustomIntentMode) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case STRICT: - return visitor.visitStrict(); - case EXTENDED: - return visitor.visitExtended(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static MediaTranscribeRequestCustomIntentMode valueOf(String value) { - switch (value) { - case "strict": - return STRICT; - case "extended": - return EXTENDED; - default: - return new MediaTranscribeRequestCustomIntentMode(Value.UNKNOWN, value); - } - } - - public enum Value { - EXTENDED, - - STRICT, - - UNKNOWN - } - - public interface Visitor { - T visitExtended(); - - T visitStrict(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/resources/listen/v1/media/types/MediaTranscribeRequestCustomTopicMode.java b/src/main/java/resources/listen/v1/media/types/MediaTranscribeRequestCustomTopicMode.java deleted file mode 100644 index 79032ee..0000000 --- a/src/main/java/resources/listen/v1/media/types/MediaTranscribeRequestCustomTopicMode.java +++ /dev/null @@ -1,84 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v1.media.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class MediaTranscribeRequestCustomTopicMode { - public static final MediaTranscribeRequestCustomTopicMode STRICT = - new MediaTranscribeRequestCustomTopicMode(Value.STRICT, "strict"); - - public static final MediaTranscribeRequestCustomTopicMode EXTENDED = - new MediaTranscribeRequestCustomTopicMode(Value.EXTENDED, "extended"); - - private final Value value; - - private final String string; - - MediaTranscribeRequestCustomTopicMode(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof MediaTranscribeRequestCustomTopicMode - && this.string.equals(((MediaTranscribeRequestCustomTopicMode) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case STRICT: - return visitor.visitStrict(); - case EXTENDED: - return visitor.visitExtended(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static MediaTranscribeRequestCustomTopicMode valueOf(String value) { - switch (value) { - case "strict": - return STRICT; - case "extended": - return EXTENDED; - default: - return new MediaTranscribeRequestCustomTopicMode(Value.UNKNOWN, value); - } - } - - public enum Value { - EXTENDED, - - STRICT, - - UNKNOWN - } - - public interface Visitor { - T visitExtended(); - - T visitStrict(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/resources/listen/v1/media/types/MediaTranscribeRequestEncoding.java b/src/main/java/resources/listen/v1/media/types/MediaTranscribeRequestEncoding.java deleted file mode 100644 index a178d46..0000000 --- a/src/main/java/resources/listen/v1/media/types/MediaTranscribeRequestEncoding.java +++ /dev/null @@ -1,150 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v1.media.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class MediaTranscribeRequestEncoding { - public static final MediaTranscribeRequestEncoding MULAW = - new MediaTranscribeRequestEncoding(Value.MULAW, "mulaw"); - - public static final MediaTranscribeRequestEncoding AMR_WB = - new MediaTranscribeRequestEncoding(Value.AMR_WB, "amr-wb"); - - public static final MediaTranscribeRequestEncoding FLAC = - new MediaTranscribeRequestEncoding(Value.FLAC, "flac"); - - public static final MediaTranscribeRequestEncoding SPEEX = - new MediaTranscribeRequestEncoding(Value.SPEEX, "speex"); - - public static final MediaTranscribeRequestEncoding LINEAR16 = - new MediaTranscribeRequestEncoding(Value.LINEAR16, "linear16"); - - public static final MediaTranscribeRequestEncoding OPUS = - new MediaTranscribeRequestEncoding(Value.OPUS, "opus"); - - public static final MediaTranscribeRequestEncoding AMR_NB = - new MediaTranscribeRequestEncoding(Value.AMR_NB, "amr-nb"); - - public static final MediaTranscribeRequestEncoding G729 = - new MediaTranscribeRequestEncoding(Value.G729, "g729"); - - private final Value value; - - private final String string; - - MediaTranscribeRequestEncoding(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof MediaTranscribeRequestEncoding - && this.string.equals(((MediaTranscribeRequestEncoding) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case MULAW: - return visitor.visitMulaw(); - case AMR_WB: - return visitor.visitAmrWb(); - case FLAC: - return visitor.visitFlac(); - case SPEEX: - return visitor.visitSpeex(); - case LINEAR16: - return visitor.visitLinear16(); - case OPUS: - return visitor.visitOpus(); - case AMR_NB: - return visitor.visitAmrNb(); - case G729: - return visitor.visitG729(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static MediaTranscribeRequestEncoding valueOf(String value) { - switch (value) { - case "mulaw": - return MULAW; - case "amr-wb": - return AMR_WB; - case "flac": - return FLAC; - case "speex": - return SPEEX; - case "linear16": - return LINEAR16; - case "opus": - return OPUS; - case "amr-nb": - return AMR_NB; - case "g729": - return G729; - default: - return new MediaTranscribeRequestEncoding(Value.UNKNOWN, value); - } - } - - public enum Value { - LINEAR16, - - FLAC, - - MULAW, - - AMR_NB, - - AMR_WB, - - OPUS, - - SPEEX, - - G729, - - UNKNOWN - } - - public interface Visitor { - T visitLinear16(); - - T visitFlac(); - - T visitMulaw(); - - T visitAmrNb(); - - T visitAmrWb(); - - T visitOpus(); - - T visitSpeex(); - - T visitG729(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/resources/listen/v1/media/types/MediaTranscribeRequestModel.java b/src/main/java/resources/listen/v1/media/types/MediaTranscribeRequestModel.java deleted file mode 100644 index 1bca6e5..0000000 --- a/src/main/java/resources/listen/v1/media/types/MediaTranscribeRequestModel.java +++ /dev/null @@ -1,381 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v1.media.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class MediaTranscribeRequestModel { - public static final MediaTranscribeRequestModel NOVA2VOICEMAIL = - new MediaTranscribeRequestModel(Value.NOVA2VOICEMAIL, "nova-2-voicemail"); - - public static final MediaTranscribeRequestModel NOVA3 = - new MediaTranscribeRequestModel(Value.NOVA3, "nova-3"); - - public static final MediaTranscribeRequestModel FINANCE = - new MediaTranscribeRequestModel(Value.FINANCE, "finance"); - - public static final MediaTranscribeRequestModel NOVA_MEDICAL = - new MediaTranscribeRequestModel(Value.NOVA_MEDICAL, "nova-medical"); - - public static final MediaTranscribeRequestModel ENHANCED_GENERAL = - new MediaTranscribeRequestModel(Value.ENHANCED_GENERAL, "enhanced-general"); - - public static final MediaTranscribeRequestModel NOVA_GENERAL = - new MediaTranscribeRequestModel(Value.NOVA_GENERAL, "nova-general"); - - public static final MediaTranscribeRequestModel NOVA3MEDICAL = - new MediaTranscribeRequestModel(Value.NOVA3MEDICAL, "nova-3-medical"); - - public static final MediaTranscribeRequestModel NOVA2 = - new MediaTranscribeRequestModel(Value.NOVA2, "nova-2"); - - public static final MediaTranscribeRequestModel VOICEMAIL = - new MediaTranscribeRequestModel(Value.VOICEMAIL, "voicemail"); - - public static final MediaTranscribeRequestModel ENHANCED_FINANCE = - new MediaTranscribeRequestModel(Value.ENHANCED_FINANCE, "enhanced-finance"); - - public static final MediaTranscribeRequestModel NOVA2FINANCE = - new MediaTranscribeRequestModel(Value.NOVA2FINANCE, "nova-2-finance"); - - public static final MediaTranscribeRequestModel MEETING = - new MediaTranscribeRequestModel(Value.MEETING, "meeting"); - - public static final MediaTranscribeRequestModel PHONECALL = - new MediaTranscribeRequestModel(Value.PHONECALL, "phonecall"); - - public static final MediaTranscribeRequestModel NOVA2CONVERSATIONALAI = - new MediaTranscribeRequestModel(Value.NOVA2CONVERSATIONALAI, "nova-2-conversationalai"); - - public static final MediaTranscribeRequestModel VIDEO = - new MediaTranscribeRequestModel(Value.VIDEO, "video"); - - public static final MediaTranscribeRequestModel CONVERSATIONALAI = - new MediaTranscribeRequestModel(Value.CONVERSATIONALAI, "conversationalai"); - - public static final MediaTranscribeRequestModel NOVA2VIDEO = - new MediaTranscribeRequestModel(Value.NOVA2VIDEO, "nova-2-video"); - - public static final MediaTranscribeRequestModel NOVA2DRIVETHRU = - new MediaTranscribeRequestModel(Value.NOVA2DRIVETHRU, "nova-2-drivethru"); - - public static final MediaTranscribeRequestModel BASE = - new MediaTranscribeRequestModel(Value.BASE, "base"); - - public static final MediaTranscribeRequestModel NOVA2GENERAL = - new MediaTranscribeRequestModel(Value.NOVA2GENERAL, "nova-2-general"); - - public static final MediaTranscribeRequestModel NOVA = - new MediaTranscribeRequestModel(Value.NOVA, "nova"); - - public static final MediaTranscribeRequestModel ENHANCED_PHONECALL = - new MediaTranscribeRequestModel(Value.ENHANCED_PHONECALL, "enhanced-phonecall"); - - public static final MediaTranscribeRequestModel NOVA2MEDICAL = - new MediaTranscribeRequestModel(Value.NOVA2MEDICAL, "nova-2-medical"); - - public static final MediaTranscribeRequestModel NOVA3GENERAL = - new MediaTranscribeRequestModel(Value.NOVA3GENERAL, "nova-3-general"); - - public static final MediaTranscribeRequestModel ENHANCED = - new MediaTranscribeRequestModel(Value.ENHANCED, "enhanced"); - - public static final MediaTranscribeRequestModel NOVA_PHONECALL = - new MediaTranscribeRequestModel(Value.NOVA_PHONECALL, "nova-phonecall"); - - public static final MediaTranscribeRequestModel NOVA2MEETING = - new MediaTranscribeRequestModel(Value.NOVA2MEETING, "nova-2-meeting"); - - public static final MediaTranscribeRequestModel NOVA2AUTOMOTIVE = - new MediaTranscribeRequestModel(Value.NOVA2AUTOMOTIVE, "nova-2-automotive"); - - public static final MediaTranscribeRequestModel ENHANCED_MEETING = - new MediaTranscribeRequestModel(Value.ENHANCED_MEETING, "enhanced-meeting"); - - private final Value value; - - private final String string; - - MediaTranscribeRequestModel(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof MediaTranscribeRequestModel - && this.string.equals(((MediaTranscribeRequestModel) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case NOVA2VOICEMAIL: - return visitor.visitNova2Voicemail(); - case NOVA3: - return visitor.visitNova3(); - case FINANCE: - return visitor.visitFinance(); - case NOVA_MEDICAL: - return visitor.visitNovaMedical(); - case ENHANCED_GENERAL: - return visitor.visitEnhancedGeneral(); - case NOVA_GENERAL: - return visitor.visitNovaGeneral(); - case NOVA3MEDICAL: - return visitor.visitNova3Medical(); - case NOVA2: - return visitor.visitNova2(); - case VOICEMAIL: - return visitor.visitVoicemail(); - case ENHANCED_FINANCE: - return visitor.visitEnhancedFinance(); - case NOVA2FINANCE: - return visitor.visitNova2Finance(); - case MEETING: - return visitor.visitMeeting(); - case PHONECALL: - return visitor.visitPhonecall(); - case NOVA2CONVERSATIONALAI: - return visitor.visitNova2Conversationalai(); - case VIDEO: - return visitor.visitVideo(); - case CONVERSATIONALAI: - return visitor.visitConversationalai(); - case NOVA2VIDEO: - return visitor.visitNova2Video(); - case NOVA2DRIVETHRU: - return visitor.visitNova2Drivethru(); - case BASE: - return visitor.visitBase(); - case NOVA2GENERAL: - return visitor.visitNova2General(); - case NOVA: - return visitor.visitNova(); - case ENHANCED_PHONECALL: - return visitor.visitEnhancedPhonecall(); - case NOVA2MEDICAL: - return visitor.visitNova2Medical(); - case NOVA3GENERAL: - return visitor.visitNova3General(); - case ENHANCED: - return visitor.visitEnhanced(); - case NOVA_PHONECALL: - return visitor.visitNovaPhonecall(); - case NOVA2MEETING: - return visitor.visitNova2Meeting(); - case NOVA2AUTOMOTIVE: - return visitor.visitNova2Automotive(); - case ENHANCED_MEETING: - return visitor.visitEnhancedMeeting(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static MediaTranscribeRequestModel valueOf(String value) { - switch (value) { - case "nova-2-voicemail": - return NOVA2VOICEMAIL; - case "nova-3": - return NOVA3; - case "finance": - return FINANCE; - case "nova-medical": - return NOVA_MEDICAL; - case "enhanced-general": - return ENHANCED_GENERAL; - case "nova-general": - return NOVA_GENERAL; - case "nova-3-medical": - return NOVA3MEDICAL; - case "nova-2": - return NOVA2; - case "voicemail": - return VOICEMAIL; - case "enhanced-finance": - return ENHANCED_FINANCE; - case "nova-2-finance": - return NOVA2FINANCE; - case "meeting": - return MEETING; - case "phonecall": - return PHONECALL; - case "nova-2-conversationalai": - return NOVA2CONVERSATIONALAI; - case "video": - return VIDEO; - case "conversationalai": - return CONVERSATIONALAI; - case "nova-2-video": - return NOVA2VIDEO; - case "nova-2-drivethru": - return NOVA2DRIVETHRU; - case "base": - return BASE; - case "nova-2-general": - return NOVA2GENERAL; - case "nova": - return NOVA; - case "enhanced-phonecall": - return ENHANCED_PHONECALL; - case "nova-2-medical": - return NOVA2MEDICAL; - case "nova-3-general": - return NOVA3GENERAL; - case "enhanced": - return ENHANCED; - case "nova-phonecall": - return NOVA_PHONECALL; - case "nova-2-meeting": - return NOVA2MEETING; - case "nova-2-automotive": - return NOVA2AUTOMOTIVE; - case "enhanced-meeting": - return ENHANCED_MEETING; - default: - return new MediaTranscribeRequestModel(Value.UNKNOWN, value); - } - } - - public enum Value { - NOVA3, - - NOVA3GENERAL, - - NOVA3MEDICAL, - - NOVA2, - - NOVA2GENERAL, - - NOVA2MEETING, - - NOVA2FINANCE, - - NOVA2CONVERSATIONALAI, - - NOVA2VOICEMAIL, - - NOVA2VIDEO, - - NOVA2MEDICAL, - - NOVA2DRIVETHRU, - - NOVA2AUTOMOTIVE, - - NOVA, - - NOVA_GENERAL, - - NOVA_PHONECALL, - - NOVA_MEDICAL, - - ENHANCED, - - ENHANCED_GENERAL, - - ENHANCED_MEETING, - - ENHANCED_PHONECALL, - - ENHANCED_FINANCE, - - BASE, - - MEETING, - - PHONECALL, - - FINANCE, - - CONVERSATIONALAI, - - VOICEMAIL, - - VIDEO, - - UNKNOWN - } - - public interface Visitor { - T visitNova3(); - - T visitNova3General(); - - T visitNova3Medical(); - - T visitNova2(); - - T visitNova2General(); - - T visitNova2Meeting(); - - T visitNova2Finance(); - - T visitNova2Conversationalai(); - - T visitNova2Voicemail(); - - T visitNova2Video(); - - T visitNova2Medical(); - - T visitNova2Drivethru(); - - T visitNova2Automotive(); - - T visitNova(); - - T visitNovaGeneral(); - - T visitNovaPhonecall(); - - T visitNovaMedical(); - - T visitEnhanced(); - - T visitEnhancedGeneral(); - - T visitEnhancedMeeting(); - - T visitEnhancedPhonecall(); - - T visitEnhancedFinance(); - - T visitBase(); - - T visitMeeting(); - - T visitPhonecall(); - - T visitFinance(); - - T visitConversationalai(); - - T visitVoicemail(); - - T visitVideo(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/resources/listen/v1/media/types/MediaTranscribeRequestSummarize.java b/src/main/java/resources/listen/v1/media/types/MediaTranscribeRequestSummarize.java deleted file mode 100644 index c01ea78..0000000 --- a/src/main/java/resources/listen/v1/media/types/MediaTranscribeRequestSummarize.java +++ /dev/null @@ -1,73 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v1.media.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class MediaTranscribeRequestSummarize { - public static final MediaTranscribeRequestSummarize V2 = - new MediaTranscribeRequestSummarize(Value.V2, "v2"); - - private final Value value; - - private final String string; - - MediaTranscribeRequestSummarize(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof MediaTranscribeRequestSummarize - && this.string.equals(((MediaTranscribeRequestSummarize) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case V2: - return visitor.visitV2(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static MediaTranscribeRequestSummarize valueOf(String value) { - switch (value) { - case "v2": - return V2; - default: - return new MediaTranscribeRequestSummarize(Value.UNKNOWN, value); - } - } - - public enum Value { - V2, - - UNKNOWN - } - - public interface Visitor { - T visitV2(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/resources/listen/v1/media/types/MediaTranscribeRequestVersion.java b/src/main/java/resources/listen/v1/media/types/MediaTranscribeRequestVersion.java deleted file mode 100644 index 37c67f2..0000000 --- a/src/main/java/resources/listen/v1/media/types/MediaTranscribeRequestVersion.java +++ /dev/null @@ -1,73 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v1.media.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class MediaTranscribeRequestVersion { - public static final MediaTranscribeRequestVersion LATEST = - new MediaTranscribeRequestVersion(Value.LATEST, "latest"); - - private final Value value; - - private final String string; - - MediaTranscribeRequestVersion(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof MediaTranscribeRequestVersion - && this.string.equals(((MediaTranscribeRequestVersion) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case LATEST: - return visitor.visitLatest(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static MediaTranscribeRequestVersion valueOf(String value) { - switch (value) { - case "latest": - return LATEST; - default: - return new MediaTranscribeRequestVersion(Value.UNKNOWN, value); - } - } - - public enum Value { - LATEST, - - UNKNOWN - } - - public interface Visitor { - T visitLatest(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/resources/listen/v1/media/types/MediaTranscribeResponse.java b/src/main/java/resources/listen/v1/media/types/MediaTranscribeResponse.java deleted file mode 100644 index 2527640..0000000 --- a/src/main/java/resources/listen/v1/media/types/MediaTranscribeResponse.java +++ /dev/null @@ -1,96 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v1.media.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 core.ObjectMappers; -import java.io.IOException; -import java.util.Objects; -import types.ListenV1AcceptedResponse; -import types.ListenV1Response; - -@JsonDeserialize(using = MediaTranscribeResponse.Deserializer.class) -public final class MediaTranscribeResponse { - private final Object value; - - private final int type; - - private MediaTranscribeResponse(Object value, int type) { - this.value = value; - this.type = type; - } - - @JsonValue - public Object get() { - return this.value; - } - - @SuppressWarnings("unchecked") - public T visit(Visitor visitor) { - if (this.type == 0) { - return visitor.visit((ListenV1Response) this.value); - } else if (this.type == 1) { - return visitor.visit((ListenV1AcceptedResponse) 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 MediaTranscribeResponse && equalTo((MediaTranscribeResponse) other); - } - - private boolean equalTo(MediaTranscribeResponse 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 MediaTranscribeResponse of(ListenV1Response value) { - return new MediaTranscribeResponse(value, 0); - } - - public static MediaTranscribeResponse of(ListenV1AcceptedResponse value) { - return new MediaTranscribeResponse(value, 1); - } - - public interface Visitor { - T visit(ListenV1Response value); - - T visit(ListenV1AcceptedResponse value); - } - - static final class Deserializer extends StdDeserializer { - Deserializer() { - super(MediaTranscribeResponse.class); - } - - @java.lang.Override - public MediaTranscribeResponse deserialize(JsonParser p, DeserializationContext context) - throws IOException { - Object value = p.readValueAs(Object.class); - try { - return of(ObjectMappers.JSON_MAPPER.convertValue(value, ListenV1Response.class)); - } catch (RuntimeException e) { - } - try { - return of(ObjectMappers.JSON_MAPPER.convertValue(value, ListenV1AcceptedResponse.class)); - } catch (RuntimeException e) { - } - throw new JsonParseException(p, "Failed to deserialize"); - } - } -} diff --git a/src/main/java/resources/listen/v1/types/ListenV1CloseStream.java b/src/main/java/resources/listen/v1/types/ListenV1CloseStream.java deleted file mode 100644 index 98ba03b..0000000 --- a/src/main/java/resources/listen/v1/types/ListenV1CloseStream.java +++ /dev/null @@ -1,127 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListenV1CloseStream.Builder.class) -public final class ListenV1CloseStream { - private final ListenV1CloseStreamType type; - - private final Map additionalProperties; - - private ListenV1CloseStream( - ListenV1CloseStreamType type, Map additionalProperties) { - this.type = type; - this.additionalProperties = additionalProperties; - } - - /** - * @return Message type identifier - */ - @JsonProperty("type") - public ListenV1CloseStreamType getType() { - return type; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListenV1CloseStream && equalTo((ListenV1CloseStream) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListenV1CloseStream other) { - return type.equals(other.type); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.type); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static TypeStage builder() { - return new Builder(); - } - - public interface TypeStage { - /** Message type identifier */ - _FinalStage type(@NotNull ListenV1CloseStreamType type); - - Builder from(ListenV1CloseStream other); - } - - public interface _FinalStage { - ListenV1CloseStream build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements TypeStage, _FinalStage { - private ListenV1CloseStreamType type; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(ListenV1CloseStream other) { - type(other.getType()); - return this; - } - - /** - * Message type identifier - * - *

Message type identifier - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("type") - public _FinalStage type(@NotNull ListenV1CloseStreamType type) { - this.type = Objects.requireNonNull(type, "type must not be null"); - return this; - } - - @java.lang.Override - public ListenV1CloseStream build() { - return new ListenV1CloseStream(type, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/listen/v1/types/ListenV1CloseStreamType.java b/src/main/java/resources/listen/v1/types/ListenV1CloseStreamType.java deleted file mode 100644 index 2452f8e..0000000 --- a/src/main/java/resources/listen/v1/types/ListenV1CloseStreamType.java +++ /dev/null @@ -1,95 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v1.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class ListenV1CloseStreamType { - public static final ListenV1CloseStreamType CLOSE_STREAM = - new ListenV1CloseStreamType(Value.CLOSE_STREAM, "CloseStream"); - - public static final ListenV1CloseStreamType FINALIZE = - new ListenV1CloseStreamType(Value.FINALIZE, "Finalize"); - - public static final ListenV1CloseStreamType KEEP_ALIVE = - new ListenV1CloseStreamType(Value.KEEP_ALIVE, "KeepAlive"); - - private final Value value; - - private final String string; - - ListenV1CloseStreamType(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof ListenV1CloseStreamType - && this.string.equals(((ListenV1CloseStreamType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case CLOSE_STREAM: - return visitor.visitCloseStream(); - case FINALIZE: - return visitor.visitFinalize(); - case KEEP_ALIVE: - return visitor.visitKeepAlive(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListenV1CloseStreamType valueOf(String value) { - switch (value) { - case "CloseStream": - return CLOSE_STREAM; - case "Finalize": - return FINALIZE; - case "KeepAlive": - return KEEP_ALIVE; - default: - return new ListenV1CloseStreamType(Value.UNKNOWN, value); - } - } - - public enum Value { - FINALIZE, - - CLOSE_STREAM, - - KEEP_ALIVE, - - UNKNOWN - } - - public interface Visitor { - T visitFinalize(); - - T visitCloseStream(); - - T visitKeepAlive(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/resources/listen/v1/types/ListenV1Finalize.java b/src/main/java/resources/listen/v1/types/ListenV1Finalize.java deleted file mode 100644 index c548488..0000000 --- a/src/main/java/resources/listen/v1/types/ListenV1Finalize.java +++ /dev/null @@ -1,126 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListenV1Finalize.Builder.class) -public final class ListenV1Finalize { - private final ListenV1FinalizeType type; - - private final Map additionalProperties; - - private ListenV1Finalize(ListenV1FinalizeType type, Map additionalProperties) { - this.type = type; - this.additionalProperties = additionalProperties; - } - - /** - * @return Message type identifier - */ - @JsonProperty("type") - public ListenV1FinalizeType getType() { - return type; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListenV1Finalize && equalTo((ListenV1Finalize) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListenV1Finalize other) { - return type.equals(other.type); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.type); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static TypeStage builder() { - return new Builder(); - } - - public interface TypeStage { - /** Message type identifier */ - _FinalStage type(@NotNull ListenV1FinalizeType type); - - Builder from(ListenV1Finalize other); - } - - public interface _FinalStage { - ListenV1Finalize build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements TypeStage, _FinalStage { - private ListenV1FinalizeType type; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(ListenV1Finalize other) { - type(other.getType()); - return this; - } - - /** - * Message type identifier - * - *

Message type identifier - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("type") - public _FinalStage type(@NotNull ListenV1FinalizeType type) { - this.type = Objects.requireNonNull(type, "type must not be null"); - return this; - } - - @java.lang.Override - public ListenV1Finalize build() { - return new ListenV1Finalize(type, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/listen/v1/types/ListenV1FinalizeType.java b/src/main/java/resources/listen/v1/types/ListenV1FinalizeType.java deleted file mode 100644 index c90ee22..0000000 --- a/src/main/java/resources/listen/v1/types/ListenV1FinalizeType.java +++ /dev/null @@ -1,95 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v1.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class ListenV1FinalizeType { - public static final ListenV1FinalizeType CLOSE_STREAM = - new ListenV1FinalizeType(Value.CLOSE_STREAM, "CloseStream"); - - public static final ListenV1FinalizeType FINALIZE = - new ListenV1FinalizeType(Value.FINALIZE, "Finalize"); - - public static final ListenV1FinalizeType KEEP_ALIVE = - new ListenV1FinalizeType(Value.KEEP_ALIVE, "KeepAlive"); - - private final Value value; - - private final String string; - - ListenV1FinalizeType(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof ListenV1FinalizeType - && this.string.equals(((ListenV1FinalizeType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case CLOSE_STREAM: - return visitor.visitCloseStream(); - case FINALIZE: - return visitor.visitFinalize(); - case KEEP_ALIVE: - return visitor.visitKeepAlive(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListenV1FinalizeType valueOf(String value) { - switch (value) { - case "CloseStream": - return CLOSE_STREAM; - case "Finalize": - return FINALIZE; - case "KeepAlive": - return KEEP_ALIVE; - default: - return new ListenV1FinalizeType(Value.UNKNOWN, value); - } - } - - public enum Value { - FINALIZE, - - CLOSE_STREAM, - - KEEP_ALIVE, - - UNKNOWN - } - - public interface Visitor { - T visitFinalize(); - - T visitCloseStream(); - - T visitKeepAlive(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/resources/listen/v1/types/ListenV1KeepAlive.java b/src/main/java/resources/listen/v1/types/ListenV1KeepAlive.java deleted file mode 100644 index d3926c6..0000000 --- a/src/main/java/resources/listen/v1/types/ListenV1KeepAlive.java +++ /dev/null @@ -1,126 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListenV1KeepAlive.Builder.class) -public final class ListenV1KeepAlive { - private final ListenV1KeepAliveType type; - - private final Map additionalProperties; - - private ListenV1KeepAlive(ListenV1KeepAliveType type, Map additionalProperties) { - this.type = type; - this.additionalProperties = additionalProperties; - } - - /** - * @return Message type identifier - */ - @JsonProperty("type") - public ListenV1KeepAliveType getType() { - return type; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListenV1KeepAlive && equalTo((ListenV1KeepAlive) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListenV1KeepAlive other) { - return type.equals(other.type); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.type); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static TypeStage builder() { - return new Builder(); - } - - public interface TypeStage { - /** Message type identifier */ - _FinalStage type(@NotNull ListenV1KeepAliveType type); - - Builder from(ListenV1KeepAlive other); - } - - public interface _FinalStage { - ListenV1KeepAlive build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements TypeStage, _FinalStage { - private ListenV1KeepAliveType type; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(ListenV1KeepAlive other) { - type(other.getType()); - return this; - } - - /** - * Message type identifier - * - *

Message type identifier - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("type") - public _FinalStage type(@NotNull ListenV1KeepAliveType type) { - this.type = Objects.requireNonNull(type, "type must not be null"); - return this; - } - - @java.lang.Override - public ListenV1KeepAlive build() { - return new ListenV1KeepAlive(type, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/listen/v1/types/ListenV1KeepAliveType.java b/src/main/java/resources/listen/v1/types/ListenV1KeepAliveType.java deleted file mode 100644 index a8dbd61..0000000 --- a/src/main/java/resources/listen/v1/types/ListenV1KeepAliveType.java +++ /dev/null @@ -1,95 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v1.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class ListenV1KeepAliveType { - public static final ListenV1KeepAliveType CLOSE_STREAM = - new ListenV1KeepAliveType(Value.CLOSE_STREAM, "CloseStream"); - - public static final ListenV1KeepAliveType FINALIZE = - new ListenV1KeepAliveType(Value.FINALIZE, "Finalize"); - - public static final ListenV1KeepAliveType KEEP_ALIVE = - new ListenV1KeepAliveType(Value.KEEP_ALIVE, "KeepAlive"); - - private final Value value; - - private final String string; - - ListenV1KeepAliveType(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof ListenV1KeepAliveType - && this.string.equals(((ListenV1KeepAliveType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case CLOSE_STREAM: - return visitor.visitCloseStream(); - case FINALIZE: - return visitor.visitFinalize(); - case KEEP_ALIVE: - return visitor.visitKeepAlive(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListenV1KeepAliveType valueOf(String value) { - switch (value) { - case "CloseStream": - return CLOSE_STREAM; - case "Finalize": - return FINALIZE; - case "KeepAlive": - return KEEP_ALIVE; - default: - return new ListenV1KeepAliveType(Value.UNKNOWN, value); - } - } - - public enum Value { - FINALIZE, - - CLOSE_STREAM, - - KEEP_ALIVE, - - UNKNOWN - } - - public interface Visitor { - T visitFinalize(); - - T visitCloseStream(); - - T visitKeepAlive(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/resources/listen/v1/types/ListenV1Metadata.java b/src/main/java/resources/listen/v1/types/ListenV1Metadata.java deleted file mode 100644 index 5c7622f..0000000 --- a/src/main/java/resources/listen/v1/types/ListenV1Metadata.java +++ /dev/null @@ -1,326 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListenV1Metadata.Builder.class) -public final class ListenV1Metadata { - private final String transactionKey; - - private final String requestId; - - private final String sha256; - - private final String created; - - private final double duration; - - private final double channels; - - private final Map additionalProperties; - - private ListenV1Metadata( - String transactionKey, - String requestId, - String sha256, - String created, - double duration, - double channels, - Map additionalProperties) { - this.transactionKey = transactionKey; - this.requestId = requestId; - this.sha256 = sha256; - this.created = created; - this.duration = duration; - this.channels = channels; - this.additionalProperties = additionalProperties; - } - - /** - * @return Message type identifier - */ - @JsonProperty("type") - public String getType() { - return "Metadata"; - } - - /** - * @return The transaction key - */ - @JsonProperty("transaction_key") - public String getTransactionKey() { - return transactionKey; - } - - /** - * @return The request ID - */ - @JsonProperty("request_id") - public String getRequestId() { - return requestId; - } - - /** - * @return The sha256 - */ - @JsonProperty("sha256") - public String getSha256() { - return sha256; - } - - /** - * @return The created - */ - @JsonProperty("created") - public String getCreated() { - return created; - } - - /** - * @return The duration - */ - @JsonProperty("duration") - public double getDuration() { - return duration; - } - - /** - * @return The channels - */ - @JsonProperty("channels") - public double getChannels() { - return channels; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListenV1Metadata && equalTo((ListenV1Metadata) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListenV1Metadata other) { - return transactionKey.equals(other.transactionKey) - && requestId.equals(other.requestId) - && sha256.equals(other.sha256) - && created.equals(other.created) - && duration == other.duration - && channels == other.channels; - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.transactionKey, - this.requestId, - this.sha256, - this.created, - this.duration, - this.channels); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static TransactionKeyStage builder() { - return new Builder(); - } - - public interface TransactionKeyStage { - /** The transaction key */ - RequestIdStage transactionKey(@NotNull String transactionKey); - - Builder from(ListenV1Metadata other); - } - - public interface RequestIdStage { - /** The request ID */ - Sha256Stage requestId(@NotNull String requestId); - } - - public interface Sha256Stage { - /** The sha256 */ - CreatedStage sha256(@NotNull String sha256); - } - - public interface CreatedStage { - /** The created */ - DurationStage created(@NotNull String created); - } - - public interface DurationStage { - /** The duration */ - ChannelsStage duration(double duration); - } - - public interface ChannelsStage { - /** The channels */ - _FinalStage channels(double channels); - } - - public interface _FinalStage { - ListenV1Metadata build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements TransactionKeyStage, - RequestIdStage, - Sha256Stage, - CreatedStage, - DurationStage, - ChannelsStage, - _FinalStage { - private String transactionKey; - - private String requestId; - - private String sha256; - - private String created; - - private double duration; - - private double channels; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(ListenV1Metadata other) { - transactionKey(other.getTransactionKey()); - requestId(other.getRequestId()); - sha256(other.getSha256()); - created(other.getCreated()); - duration(other.getDuration()); - channels(other.getChannels()); - return this; - } - - /** - * The transaction key - * - *

The transaction key - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("transaction_key") - public RequestIdStage transactionKey(@NotNull String transactionKey) { - this.transactionKey = - Objects.requireNonNull(transactionKey, "transactionKey must not be null"); - return this; - } - - /** - * The request ID - * - *

The request ID - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("request_id") - public Sha256Stage requestId(@NotNull String requestId) { - this.requestId = Objects.requireNonNull(requestId, "requestId must not be null"); - return this; - } - - /** - * The sha256 - * - *

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

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

The duration - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("duration") - public ChannelsStage duration(double duration) { - this.duration = duration; - return this; - } - - /** - * The channels - * - *

The channels - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("channels") - public _FinalStage channels(double channels) { - this.channels = channels; - return this; - } - - @java.lang.Override - public ListenV1Metadata build() { - return new ListenV1Metadata( - transactionKey, requestId, sha256, created, duration, channels, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/listen/v1/types/ListenV1Results.java b/src/main/java/resources/listen/v1/types/ListenV1Results.java deleted file mode 100644 index e9736d1..0000000 --- a/src/main/java/resources/listen/v1/types/ListenV1Results.java +++ /dev/null @@ -1,469 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListenV1Results.Builder.class) -public final class ListenV1Results { - private final List channelIndex; - - private final double duration; - - private final double start; - - private final Optional isFinal; - - private final Optional speechFinal; - - private final ListenV1ResultsChannel channel; - - private final ListenV1ResultsMetadata metadata; - - private final Optional fromFinalize; - - private final Optional> entities; - - private final Map additionalProperties; - - private ListenV1Results( - List channelIndex, - double duration, - double start, - Optional isFinal, - Optional speechFinal, - ListenV1ResultsChannel channel, - ListenV1ResultsMetadata metadata, - Optional fromFinalize, - Optional> entities, - Map additionalProperties) { - this.channelIndex = channelIndex; - this.duration = duration; - this.start = start; - this.isFinal = isFinal; - this.speechFinal = speechFinal; - this.channel = channel; - this.metadata = metadata; - this.fromFinalize = fromFinalize; - this.entities = entities; - this.additionalProperties = additionalProperties; - } - - /** - * @return Message type identifier - */ - @JsonProperty("type") - public String getType() { - return "Results"; - } - - /** - * @return The index of the channel - */ - @JsonProperty("channel_index") - public List getChannelIndex() { - return channelIndex; - } - - /** - * @return The duration of the transcription - */ - @JsonProperty("duration") - public double getDuration() { - return duration; - } - - /** - * @return The start time of the transcription - */ - @JsonProperty("start") - public double getStart() { - return start; - } - - /** - * @return Whether the transcription is final - */ - @JsonProperty("is_final") - public Optional getIsFinal() { - return isFinal; - } - - /** - * @return Whether the transcription is speech final - */ - @JsonProperty("speech_final") - public Optional getSpeechFinal() { - return speechFinal; - } - - @JsonProperty("channel") - public ListenV1ResultsChannel getChannel() { - return channel; - } - - @JsonProperty("metadata") - public ListenV1ResultsMetadata getMetadata() { - return metadata; - } - - /** - * @return Whether the transcription is from a finalize message - */ - @JsonProperty("from_finalize") - public Optional getFromFinalize() { - return fromFinalize; - } - - /** - * @return Extracted entities from the audio when detect_entities is enabled. Only present in - * is_final messages. Returns an empty array if no entities are detected - */ - @JsonProperty("entities") - public Optional> getEntities() { - return entities; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListenV1Results && equalTo((ListenV1Results) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListenV1Results other) { - return channelIndex.equals(other.channelIndex) - && duration == other.duration - && start == other.start - && isFinal.equals(other.isFinal) - && speechFinal.equals(other.speechFinal) - && channel.equals(other.channel) - && metadata.equals(other.metadata) - && fromFinalize.equals(other.fromFinalize) - && entities.equals(other.entities); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.channelIndex, - this.duration, - this.start, - this.isFinal, - this.speechFinal, - this.channel, - this.metadata, - this.fromFinalize, - this.entities); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static DurationStage builder() { - return new Builder(); - } - - public interface DurationStage { - /** The duration of the transcription */ - StartStage duration(double duration); - - Builder from(ListenV1Results other); - } - - public interface StartStage { - /** The start time of the transcription */ - ChannelStage start(double start); - } - - public interface ChannelStage { - MetadataStage channel(@NotNull ListenV1ResultsChannel channel); - } - - public interface MetadataStage { - _FinalStage metadata(@NotNull ListenV1ResultsMetadata metadata); - } - - public interface _FinalStage { - ListenV1Results build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** The index of the channel */ - _FinalStage channelIndex(List channelIndex); - - _FinalStage addChannelIndex(Double channelIndex); - - _FinalStage addAllChannelIndex(List channelIndex); - - /** Whether the transcription is final */ - _FinalStage isFinal(Optional isFinal); - - _FinalStage isFinal(Boolean isFinal); - - /** Whether the transcription is speech final */ - _FinalStage speechFinal(Optional speechFinal); - - _FinalStage speechFinal(Boolean speechFinal); - - /** Whether the transcription is from a finalize message */ - _FinalStage fromFinalize(Optional fromFinalize); - - _FinalStage fromFinalize(Boolean fromFinalize); - - /** - * Extracted entities from the audio when detect_entities is enabled. Only present in is_final - * messages. Returns an empty array if no entities are detected - */ - _FinalStage entities(Optional> entities); - - _FinalStage entities(List entities); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements DurationStage, StartStage, ChannelStage, MetadataStage, _FinalStage { - private double duration; - - private double start; - - private ListenV1ResultsChannel channel; - - private ListenV1ResultsMetadata metadata; - - private Optional> entities = Optional.empty(); - - private Optional fromFinalize = Optional.empty(); - - private Optional speechFinal = Optional.empty(); - - private Optional isFinal = Optional.empty(); - - private List channelIndex = new ArrayList<>(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(ListenV1Results other) { - channelIndex(other.getChannelIndex()); - duration(other.getDuration()); - start(other.getStart()); - isFinal(other.getIsFinal()); - speechFinal(other.getSpeechFinal()); - channel(other.getChannel()); - metadata(other.getMetadata()); - fromFinalize(other.getFromFinalize()); - entities(other.getEntities()); - return this; - } - - /** - * The duration of the transcription - * - *

The duration of the transcription - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("duration") - public StartStage duration(double duration) { - this.duration = duration; - return this; - } - - /** - * The start time of the transcription - * - *

The start time of the transcription - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("start") - public ChannelStage start(double start) { - this.start = start; - return this; - } - - @java.lang.Override - @JsonSetter("channel") - public MetadataStage channel(@NotNull ListenV1ResultsChannel channel) { - this.channel = Objects.requireNonNull(channel, "channel must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("metadata") - public _FinalStage metadata(@NotNull ListenV1ResultsMetadata metadata) { - this.metadata = Objects.requireNonNull(metadata, "metadata must not be null"); - return this; - } - - /** - * Extracted entities from the audio when detect_entities is enabled. Only present in is_final - * messages. Returns an empty array if no entities are detected - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage entities(List entities) { - this.entities = Optional.ofNullable(entities); - return this; - } - - /** - * Extracted entities from the audio when detect_entities is enabled. Only present in is_final - * messages. Returns an empty array if no entities are detected - */ - @java.lang.Override - @JsonSetter(value = "entities", nulls = Nulls.SKIP) - public _FinalStage entities(Optional> entities) { - this.entities = entities; - return this; - } - - /** - * Whether the transcription is from a finalize message - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage fromFinalize(Boolean fromFinalize) { - this.fromFinalize = Optional.ofNullable(fromFinalize); - return this; - } - - /** Whether the transcription is from a finalize message */ - @java.lang.Override - @JsonSetter(value = "from_finalize", nulls = Nulls.SKIP) - public _FinalStage fromFinalize(Optional fromFinalize) { - this.fromFinalize = fromFinalize; - return this; - } - - /** - * Whether the transcription is speech final - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage speechFinal(Boolean speechFinal) { - this.speechFinal = Optional.ofNullable(speechFinal); - return this; - } - - /** Whether the transcription is speech final */ - @java.lang.Override - @JsonSetter(value = "speech_final", nulls = Nulls.SKIP) - public _FinalStage speechFinal(Optional speechFinal) { - this.speechFinal = speechFinal; - return this; - } - - /** - * Whether the transcription is final - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage isFinal(Boolean isFinal) { - this.isFinal = Optional.ofNullable(isFinal); - return this; - } - - /** Whether the transcription is final */ - @java.lang.Override - @JsonSetter(value = "is_final", nulls = Nulls.SKIP) - public _FinalStage isFinal(Optional isFinal) { - this.isFinal = isFinal; - return this; - } - - /** - * The index of the channel - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage addAllChannelIndex(List channelIndex) { - if (channelIndex != null) { - this.channelIndex.addAll(channelIndex); - } - return this; - } - - /** - * The index of the channel - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage addChannelIndex(Double channelIndex) { - this.channelIndex.add(channelIndex); - return this; - } - - /** The index of the channel */ - @java.lang.Override - @JsonSetter(value = "channel_index", nulls = Nulls.SKIP) - public _FinalStage channelIndex(List channelIndex) { - this.channelIndex.clear(); - if (channelIndex != null) { - this.channelIndex.addAll(channelIndex); - } - return this; - } - - @java.lang.Override - public ListenV1Results build() { - return new ListenV1Results( - channelIndex, - duration, - start, - isFinal, - speechFinal, - channel, - metadata, - fromFinalize, - entities, - additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/listen/v1/types/ListenV1ResultsChannel.java b/src/main/java/resources/listen/v1/types/ListenV1ResultsChannel.java deleted file mode 100644 index 10d90b2..0000000 --- a/src/main/java/resources/listen/v1/types/ListenV1ResultsChannel.java +++ /dev/null @@ -1,115 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListenV1ResultsChannel.Builder.class) -public final class ListenV1ResultsChannel { - private final List alternatives; - - private final Map additionalProperties; - - private ListenV1ResultsChannel( - List alternatives, - Map additionalProperties) { - this.alternatives = alternatives; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("alternatives") - public List getAlternatives() { - return alternatives; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListenV1ResultsChannel && equalTo((ListenV1ResultsChannel) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListenV1ResultsChannel other) { - return alternatives.equals(other.alternatives); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.alternatives); - } - - @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 alternatives = new ArrayList<>(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListenV1ResultsChannel other) { - alternatives(other.getAlternatives()); - return this; - } - - @JsonSetter(value = "alternatives", nulls = Nulls.SKIP) - public Builder alternatives(List alternatives) { - this.alternatives.clear(); - if (alternatives != null) { - this.alternatives.addAll(alternatives); - } - return this; - } - - public Builder addAlternatives(ListenV1ResultsChannelAlternativesItem alternatives) { - this.alternatives.add(alternatives); - return this; - } - - public Builder addAllAlternatives(List alternatives) { - if (alternatives != null) { - this.alternatives.addAll(alternatives); - } - return this; - } - - public ListenV1ResultsChannel build() { - return new ListenV1ResultsChannel(alternatives, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/listen/v1/types/ListenV1ResultsChannelAlternativesItem.java b/src/main/java/resources/listen/v1/types/ListenV1ResultsChannelAlternativesItem.java deleted file mode 100644 index e65a6ee..0000000 --- a/src/main/java/resources/listen/v1/types/ListenV1ResultsChannelAlternativesItem.java +++ /dev/null @@ -1,242 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListenV1ResultsChannelAlternativesItem.Builder.class) -public final class ListenV1ResultsChannelAlternativesItem { - private final String transcript; - - private final double confidence; - - private final Optional> languages; - - private final List words; - - private final Map additionalProperties; - - private ListenV1ResultsChannelAlternativesItem( - String transcript, - double confidence, - Optional> languages, - List words, - Map additionalProperties) { - this.transcript = transcript; - this.confidence = confidence; - this.languages = languages; - this.words = words; - this.additionalProperties = additionalProperties; - } - - /** - * @return The transcript of the transcription - */ - @JsonProperty("transcript") - public String getTranscript() { - return transcript; - } - - /** - * @return The confidence of the transcription - */ - @JsonProperty("confidence") - public double getConfidence() { - return confidence; - } - - @JsonProperty("languages") - public Optional> getLanguages() { - return languages; - } - - @JsonProperty("words") - public List getWords() { - return words; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListenV1ResultsChannelAlternativesItem - && equalTo((ListenV1ResultsChannelAlternativesItem) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListenV1ResultsChannelAlternativesItem other) { - return transcript.equals(other.transcript) - && confidence == other.confidence - && languages.equals(other.languages) - && words.equals(other.words); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.transcript, this.confidence, this.languages, this.words); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static TranscriptStage builder() { - return new Builder(); - } - - public interface TranscriptStage { - /** The transcript of the transcription */ - ConfidenceStage transcript(@NotNull String transcript); - - Builder from(ListenV1ResultsChannelAlternativesItem other); - } - - public interface ConfidenceStage { - /** The confidence of the transcription */ - _FinalStage confidence(double confidence); - } - - public interface _FinalStage { - ListenV1ResultsChannelAlternativesItem build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - _FinalStage languages(Optional> languages); - - _FinalStage languages(List languages); - - _FinalStage words(List words); - - _FinalStage addWords(ListenV1ResultsChannelAlternativesItemWordsItem words); - - _FinalStage addAllWords(List words); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements TranscriptStage, ConfidenceStage, _FinalStage { - private String transcript; - - private double confidence; - - private List words = new ArrayList<>(); - - private Optional> languages = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(ListenV1ResultsChannelAlternativesItem other) { - transcript(other.getTranscript()); - confidence(other.getConfidence()); - languages(other.getLanguages()); - words(other.getWords()); - return this; - } - - /** - * The transcript of the transcription - * - *

The transcript of the transcription - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("transcript") - public ConfidenceStage transcript(@NotNull String transcript) { - this.transcript = Objects.requireNonNull(transcript, "transcript must not be null"); - return this; - } - - /** - * The confidence of the transcription - * - *

The confidence of the transcription - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("confidence") - public _FinalStage confidence(double confidence) { - this.confidence = confidence; - return this; - } - - @java.lang.Override - public _FinalStage addAllWords(List words) { - if (words != null) { - this.words.addAll(words); - } - return this; - } - - @java.lang.Override - public _FinalStage addWords(ListenV1ResultsChannelAlternativesItemWordsItem words) { - this.words.add(words); - return this; - } - - @java.lang.Override - @JsonSetter(value = "words", nulls = Nulls.SKIP) - public _FinalStage words(List words) { - this.words.clear(); - if (words != null) { - this.words.addAll(words); - } - return this; - } - - @java.lang.Override - public _FinalStage languages(List languages) { - this.languages = Optional.ofNullable(languages); - return this; - } - - @java.lang.Override - @JsonSetter(value = "languages", nulls = Nulls.SKIP) - public _FinalStage languages(Optional> languages) { - this.languages = languages; - return this; - } - - @java.lang.Override - public ListenV1ResultsChannelAlternativesItem build() { - return new ListenV1ResultsChannelAlternativesItem( - transcript, confidence, languages, words, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/listen/v1/types/ListenV1ResultsChannelAlternativesItemWordsItem.java b/src/main/java/resources/listen/v1/types/ListenV1ResultsChannelAlternativesItemWordsItem.java deleted file mode 100644 index 3c642ed..0000000 --- a/src/main/java/resources/listen/v1/types/ListenV1ResultsChannelAlternativesItemWordsItem.java +++ /dev/null @@ -1,365 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListenV1ResultsChannelAlternativesItemWordsItem.Builder.class) -public final class ListenV1ResultsChannelAlternativesItemWordsItem { - private final String word; - - private final double start; - - private final double end; - - private final double confidence; - - private final Optional language; - - private final Optional punctuatedWord; - - private final Optional speaker; - - private final Map additionalProperties; - - private ListenV1ResultsChannelAlternativesItemWordsItem( - String word, - double start, - double end, - double confidence, - Optional language, - Optional punctuatedWord, - Optional speaker, - Map additionalProperties) { - this.word = word; - this.start = start; - this.end = end; - this.confidence = confidence; - this.language = language; - this.punctuatedWord = punctuatedWord; - this.speaker = speaker; - this.additionalProperties = additionalProperties; - } - - /** - * @return The word of the transcription - */ - @JsonProperty("word") - public String getWord() { - return word; - } - - /** - * @return The start time of the word - */ - @JsonProperty("start") - public double getStart() { - return start; - } - - /** - * @return The end time of the word - */ - @JsonProperty("end") - public double getEnd() { - return end; - } - - /** - * @return The confidence of the word - */ - @JsonProperty("confidence") - public double getConfidence() { - return confidence; - } - - /** - * @return The language of the word - */ - @JsonProperty("language") - public Optional getLanguage() { - return language; - } - - /** - * @return The punctuated word of the word - */ - @JsonProperty("punctuated_word") - public Optional getPunctuatedWord() { - return punctuatedWord; - } - - /** - * @return The speaker of the word - */ - @JsonProperty("speaker") - public Optional getSpeaker() { - return speaker; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListenV1ResultsChannelAlternativesItemWordsItem - && equalTo((ListenV1ResultsChannelAlternativesItemWordsItem) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListenV1ResultsChannelAlternativesItemWordsItem other) { - return word.equals(other.word) - && start == other.start - && end == other.end - && confidence == other.confidence - && language.equals(other.language) - && punctuatedWord.equals(other.punctuatedWord) - && speaker.equals(other.speaker); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.word, - this.start, - this.end, - this.confidence, - this.language, - this.punctuatedWord, - this.speaker); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static WordStage builder() { - return new Builder(); - } - - public interface WordStage { - /** The word of the transcription */ - StartStage word(@NotNull String word); - - Builder from(ListenV1ResultsChannelAlternativesItemWordsItem other); - } - - public interface StartStage { - /** The start time of the word */ - EndStage start(double start); - } - - public interface EndStage { - /** The end time of the word */ - ConfidenceStage end(double end); - } - - public interface ConfidenceStage { - /** The confidence of the word */ - _FinalStage confidence(double confidence); - } - - public interface _FinalStage { - ListenV1ResultsChannelAlternativesItemWordsItem build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** The language of the word */ - _FinalStage language(Optional language); - - _FinalStage language(String language); - - /** The punctuated word of the word */ - _FinalStage punctuatedWord(Optional punctuatedWord); - - _FinalStage punctuatedWord(String punctuatedWord); - - /** The speaker of the word */ - _FinalStage speaker(Optional speaker); - - _FinalStage speaker(Double speaker); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements WordStage, StartStage, EndStage, ConfidenceStage, _FinalStage { - private String word; - - private double start; - - private double end; - - private double confidence; - - private Optional speaker = Optional.empty(); - - private Optional punctuatedWord = Optional.empty(); - - private Optional language = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(ListenV1ResultsChannelAlternativesItemWordsItem other) { - word(other.getWord()); - start(other.getStart()); - end(other.getEnd()); - confidence(other.getConfidence()); - language(other.getLanguage()); - punctuatedWord(other.getPunctuatedWord()); - speaker(other.getSpeaker()); - return this; - } - - /** - * The word of the transcription - * - *

The word of the transcription - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("word") - public StartStage word(@NotNull String word) { - this.word = Objects.requireNonNull(word, "word must not be null"); - return this; - } - - /** - * The start time of the word - * - *

The start time of the word - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("start") - public EndStage start(double start) { - this.start = start; - return this; - } - - /** - * The end time of the word - * - *

The end time of the word - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("end") - public ConfidenceStage end(double end) { - this.end = end; - return this; - } - - /** - * The confidence of the word - * - *

The confidence of the word - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("confidence") - public _FinalStage confidence(double confidence) { - this.confidence = confidence; - return this; - } - - /** - * The speaker of the word - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage speaker(Double speaker) { - this.speaker = Optional.ofNullable(speaker); - return this; - } - - /** The speaker of the word */ - @java.lang.Override - @JsonSetter(value = "speaker", nulls = Nulls.SKIP) - public _FinalStage speaker(Optional speaker) { - this.speaker = speaker; - return this; - } - - /** - * The punctuated word of the word - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage punctuatedWord(String punctuatedWord) { - this.punctuatedWord = Optional.ofNullable(punctuatedWord); - return this; - } - - /** The punctuated word of the word */ - @java.lang.Override - @JsonSetter(value = "punctuated_word", nulls = Nulls.SKIP) - public _FinalStage punctuatedWord(Optional punctuatedWord) { - this.punctuatedWord = punctuatedWord; - return this; - } - - /** - * The language of the word - * - * @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; - } - - /** The language of the word */ - @java.lang.Override - @JsonSetter(value = "language", nulls = Nulls.SKIP) - public _FinalStage language(Optional language) { - this.language = language; - return this; - } - - @java.lang.Override - public ListenV1ResultsChannelAlternativesItemWordsItem build() { - return new ListenV1ResultsChannelAlternativesItemWordsItem( - word, start, end, confidence, language, punctuatedWord, speaker, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/listen/v1/types/ListenV1ResultsEntitiesItem.java b/src/main/java/resources/listen/v1/types/ListenV1ResultsEntitiesItem.java deleted file mode 100644 index 9485756..0000000 --- a/src/main/java/resources/listen/v1/types/ListenV1ResultsEntitiesItem.java +++ /dev/null @@ -1,319 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListenV1ResultsEntitiesItem.Builder.class) -public final class ListenV1ResultsEntitiesItem { - private final String label; - - private final String value; - - private final String rawValue; - - private final double confidence; - - private final int startWord; - - private final int endWord; - - private final Map additionalProperties; - - private ListenV1ResultsEntitiesItem( - String label, - String value, - String rawValue, - double confidence, - int startWord, - int endWord, - Map additionalProperties) { - this.label = label; - this.value = value; - this.rawValue = rawValue; - this.confidence = confidence; - this.startWord = startWord; - this.endWord = endWord; - this.additionalProperties = additionalProperties; - } - - /** - * @return The type/category of the entity (e.g., NAME, PHONE_NUMBER, EMAIL_ADDRESS, ORGANIZATION, - * CARDINAL) - */ - @JsonProperty("label") - public String getLabel() { - return label; - } - - /** - * @return The formatted text representation of the entity - */ - @JsonProperty("value") - public String getValue() { - return value; - } - - /** - * @return The original spoken text of the entity (present when formatting is enabled) - */ - @JsonProperty("raw_value") - public String getRawValue() { - return rawValue; - } - - /** - * @return The confidence score of the entity detection - */ - @JsonProperty("confidence") - public double getConfidence() { - return confidence; - } - - /** - * @return The index of the first word of the entity in the transcript (inclusive) - */ - @JsonProperty("start_word") - public int getStartWord() { - return startWord; - } - - /** - * @return The index of the last word of the entity in the transcript (exclusive) - */ - @JsonProperty("end_word") - public int getEndWord() { - return endWord; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListenV1ResultsEntitiesItem - && equalTo((ListenV1ResultsEntitiesItem) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListenV1ResultsEntitiesItem other) { - return label.equals(other.label) - && value.equals(other.value) - && rawValue.equals(other.rawValue) - && confidence == other.confidence - && startWord == other.startWord - && endWord == other.endWord; - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.label, this.value, this.rawValue, this.confidence, this.startWord, this.endWord); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static LabelStage builder() { - return new Builder(); - } - - public interface LabelStage { - /** - * The type/category of the entity (e.g., NAME, PHONE_NUMBER, EMAIL_ADDRESS, ORGANIZATION, - * CARDINAL) - */ - ValueStage label(@NotNull String label); - - Builder from(ListenV1ResultsEntitiesItem other); - } - - public interface ValueStage { - /** The formatted text representation of the entity */ - RawValueStage value(@NotNull String value); - } - - public interface RawValueStage { - /** The original spoken text of the entity (present when formatting is enabled) */ - ConfidenceStage rawValue(@NotNull String rawValue); - } - - public interface ConfidenceStage { - /** The confidence score of the entity detection */ - StartWordStage confidence(double confidence); - } - - public interface StartWordStage { - /** The index of the first word of the entity in the transcript (inclusive) */ - EndWordStage startWord(int startWord); - } - - public interface EndWordStage { - /** The index of the last word of the entity in the transcript (exclusive) */ - _FinalStage endWord(int endWord); - } - - public interface _FinalStage { - ListenV1ResultsEntitiesItem build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements LabelStage, - ValueStage, - RawValueStage, - ConfidenceStage, - StartWordStage, - EndWordStage, - _FinalStage { - private String label; - - private String value; - - private String rawValue; - - private double confidence; - - private int startWord; - - private int endWord; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(ListenV1ResultsEntitiesItem other) { - label(other.getLabel()); - value(other.getValue()); - rawValue(other.getRawValue()); - confidence(other.getConfidence()); - startWord(other.getStartWord()); - endWord(other.getEndWord()); - return this; - } - - /** - * The type/category of the entity (e.g., NAME, PHONE_NUMBER, EMAIL_ADDRESS, ORGANIZATION, - * CARDINAL) - * - *

The type/category of the entity (e.g., NAME, PHONE_NUMBER, EMAIL_ADDRESS, ORGANIZATION, - * CARDINAL) - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("label") - public ValueStage label(@NotNull String label) { - this.label = Objects.requireNonNull(label, "label must not be null"); - return this; - } - - /** - * The formatted text representation of the entity - * - *

The formatted text representation of the entity - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("value") - public RawValueStage value(@NotNull String value) { - this.value = Objects.requireNonNull(value, "value must not be null"); - return this; - } - - /** - * The original spoken text of the entity (present when formatting is enabled) - * - *

The original spoken text of the entity (present when formatting is enabled) - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("raw_value") - public ConfidenceStage rawValue(@NotNull String rawValue) { - this.rawValue = Objects.requireNonNull(rawValue, "rawValue must not be null"); - return this; - } - - /** - * The confidence score of the entity detection - * - *

The confidence score of the entity detection - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("confidence") - public StartWordStage confidence(double confidence) { - this.confidence = confidence; - return this; - } - - /** - * The index of the first word of the entity in the transcript (inclusive) - * - *

The index of the first word of the entity in the transcript (inclusive) - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("start_word") - public EndWordStage startWord(int startWord) { - this.startWord = startWord; - return this; - } - - /** - * The index of the last word of the entity in the transcript (exclusive) - * - *

The index of the last word of the entity in the transcript (exclusive) - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("end_word") - public _FinalStage endWord(int endWord) { - this.endWord = endWord; - return this; - } - - @java.lang.Override - public ListenV1ResultsEntitiesItem build() { - return new ListenV1ResultsEntitiesItem( - label, value, rawValue, confidence, startWord, endWord, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/listen/v1/types/ListenV1ResultsMetadata.java b/src/main/java/resources/listen/v1/types/ListenV1ResultsMetadata.java deleted file mode 100644 index ada02a5..0000000 --- a/src/main/java/resources/listen/v1/types/ListenV1ResultsMetadata.java +++ /dev/null @@ -1,188 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListenV1ResultsMetadata.Builder.class) -public final class ListenV1ResultsMetadata { - private final String requestId; - - private final ListenV1ResultsMetadataModelInfo modelInfo; - - private final String modelUuid; - - private final Map additionalProperties; - - private ListenV1ResultsMetadata( - String requestId, - ListenV1ResultsMetadataModelInfo modelInfo, - String modelUuid, - Map additionalProperties) { - this.requestId = requestId; - this.modelInfo = modelInfo; - this.modelUuid = modelUuid; - this.additionalProperties = additionalProperties; - } - - /** - * @return The request ID - */ - @JsonProperty("request_id") - public String getRequestId() { - return requestId; - } - - @JsonProperty("model_info") - public ListenV1ResultsMetadataModelInfo getModelInfo() { - return modelInfo; - } - - /** - * @return The model UUID - */ - @JsonProperty("model_uuid") - public String getModelUuid() { - return modelUuid; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListenV1ResultsMetadata && equalTo((ListenV1ResultsMetadata) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListenV1ResultsMetadata other) { - return requestId.equals(other.requestId) - && modelInfo.equals(other.modelInfo) - && modelUuid.equals(other.modelUuid); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.requestId, this.modelInfo, this.modelUuid); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static RequestIdStage builder() { - return new Builder(); - } - - public interface RequestIdStage { - /** The request ID */ - ModelInfoStage requestId(@NotNull String requestId); - - Builder from(ListenV1ResultsMetadata other); - } - - public interface ModelInfoStage { - ModelUuidStage modelInfo(@NotNull ListenV1ResultsMetadataModelInfo modelInfo); - } - - public interface ModelUuidStage { - /** The model UUID */ - _FinalStage modelUuid(@NotNull String modelUuid); - } - - public interface _FinalStage { - ListenV1ResultsMetadata build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements RequestIdStage, ModelInfoStage, ModelUuidStage, _FinalStage { - private String requestId; - - private ListenV1ResultsMetadataModelInfo modelInfo; - - private String modelUuid; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(ListenV1ResultsMetadata other) { - requestId(other.getRequestId()); - modelInfo(other.getModelInfo()); - modelUuid(other.getModelUuid()); - return this; - } - - /** - * The request ID - * - *

The request ID - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("request_id") - public ModelInfoStage requestId(@NotNull String requestId) { - this.requestId = Objects.requireNonNull(requestId, "requestId must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("model_info") - public ModelUuidStage modelInfo(@NotNull ListenV1ResultsMetadataModelInfo modelInfo) { - this.modelInfo = Objects.requireNonNull(modelInfo, "modelInfo must not be null"); - return this; - } - - /** - * The model UUID - * - *

The model UUID - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("model_uuid") - public _FinalStage modelUuid(@NotNull String modelUuid) { - this.modelUuid = Objects.requireNonNull(modelUuid, "modelUuid must not be null"); - return this; - } - - @java.lang.Override - public ListenV1ResultsMetadata build() { - return new ListenV1ResultsMetadata(requestId, modelInfo, modelUuid, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/listen/v1/types/ListenV1ResultsMetadataModelInfo.java b/src/main/java/resources/listen/v1/types/ListenV1ResultsMetadataModelInfo.java deleted file mode 100644 index 9156d67..0000000 --- a/src/main/java/resources/listen/v1/types/ListenV1ResultsMetadataModelInfo.java +++ /dev/null @@ -1,194 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListenV1ResultsMetadataModelInfo.Builder.class) -public final class ListenV1ResultsMetadataModelInfo { - private final String name; - - private final String version; - - private final String arch; - - private final Map additionalProperties; - - private ListenV1ResultsMetadataModelInfo( - String name, String version, String arch, Map additionalProperties) { - this.name = name; - this.version = version; - this.arch = arch; - this.additionalProperties = additionalProperties; - } - - /** - * @return The name of the model - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * @return The version of the model - */ - @JsonProperty("version") - public String getVersion() { - return version; - } - - /** - * @return The arch of the model - */ - @JsonProperty("arch") - public String getArch() { - return arch; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListenV1ResultsMetadataModelInfo - && equalTo((ListenV1ResultsMetadataModelInfo) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListenV1ResultsMetadataModelInfo other) { - return name.equals(other.name) && version.equals(other.version) && arch.equals(other.arch); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.name, this.version, this.arch); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static NameStage builder() { - return new Builder(); - } - - public interface NameStage { - /** The name of the model */ - VersionStage name(@NotNull String name); - - Builder from(ListenV1ResultsMetadataModelInfo other); - } - - public interface VersionStage { - /** The version of the model */ - ArchStage version(@NotNull String version); - } - - public interface ArchStage { - /** The arch of the model */ - _FinalStage arch(@NotNull String arch); - } - - public interface _FinalStage { - ListenV1ResultsMetadataModelInfo build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements NameStage, VersionStage, ArchStage, _FinalStage { - private String name; - - private String version; - - private String arch; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(ListenV1ResultsMetadataModelInfo other) { - name(other.getName()); - version(other.getVersion()); - arch(other.getArch()); - return this; - } - - /** - * The name of the model - * - *

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

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

The arch of the model - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("arch") - public _FinalStage arch(@NotNull String arch) { - this.arch = Objects.requireNonNull(arch, "arch must not be null"); - return this; - } - - @java.lang.Override - public ListenV1ResultsMetadataModelInfo build() { - return new ListenV1ResultsMetadataModelInfo(name, version, arch, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/listen/v1/types/ListenV1SpeechStarted.java b/src/main/java/resources/listen/v1/types/ListenV1SpeechStarted.java deleted file mode 100644 index 0efc20a..0000000 --- a/src/main/java/resources/listen/v1/types/ListenV1SpeechStarted.java +++ /dev/null @@ -1,193 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListenV1SpeechStarted.Builder.class) -public final class ListenV1SpeechStarted { - private final List channel; - - private final double timestamp; - - private final Map additionalProperties; - - private ListenV1SpeechStarted( - List channel, double timestamp, Map additionalProperties) { - this.channel = channel; - this.timestamp = timestamp; - this.additionalProperties = additionalProperties; - } - - /** - * @return Message type identifier - */ - @JsonProperty("type") - public String getType() { - return "SpeechStarted"; - } - - /** - * @return The channel - */ - @JsonProperty("channel") - public List getChannel() { - return channel; - } - - /** - * @return The timestamp - */ - @JsonProperty("timestamp") - public double getTimestamp() { - return timestamp; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListenV1SpeechStarted && equalTo((ListenV1SpeechStarted) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListenV1SpeechStarted other) { - return channel.equals(other.channel) && timestamp == other.timestamp; - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.channel, this.timestamp); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static TimestampStage builder() { - return new Builder(); - } - - public interface TimestampStage { - /** The timestamp */ - _FinalStage timestamp(double timestamp); - - Builder from(ListenV1SpeechStarted other); - } - - public interface _FinalStage { - ListenV1SpeechStarted build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** The channel */ - _FinalStage channel(List channel); - - _FinalStage addChannel(Double channel); - - _FinalStage addAllChannel(List channel); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements TimestampStage, _FinalStage { - private double timestamp; - - private List channel = new ArrayList<>(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(ListenV1SpeechStarted other) { - channel(other.getChannel()); - timestamp(other.getTimestamp()); - return this; - } - - /** - * The timestamp - * - *

The timestamp - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("timestamp") - public _FinalStage timestamp(double timestamp) { - this.timestamp = timestamp; - return this; - } - - /** - * The channel - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage addAllChannel(List channel) { - if (channel != null) { - this.channel.addAll(channel); - } - return this; - } - - /** - * The channel - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage addChannel(Double channel) { - this.channel.add(channel); - return this; - } - - /** The channel */ - @java.lang.Override - @JsonSetter(value = "channel", nulls = Nulls.SKIP) - public _FinalStage channel(List channel) { - this.channel.clear(); - if (channel != null) { - this.channel.addAll(channel); - } - return this; - } - - @java.lang.Override - public ListenV1SpeechStarted build() { - return new ListenV1SpeechStarted(channel, timestamp, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/listen/v1/types/ListenV1UtteranceEnd.java b/src/main/java/resources/listen/v1/types/ListenV1UtteranceEnd.java deleted file mode 100644 index cd0ef65..0000000 --- a/src/main/java/resources/listen/v1/types/ListenV1UtteranceEnd.java +++ /dev/null @@ -1,193 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListenV1UtteranceEnd.Builder.class) -public final class ListenV1UtteranceEnd { - private final List channel; - - private final double lastWordEnd; - - private final Map additionalProperties; - - private ListenV1UtteranceEnd( - List channel, double lastWordEnd, Map additionalProperties) { - this.channel = channel; - this.lastWordEnd = lastWordEnd; - this.additionalProperties = additionalProperties; - } - - /** - * @return Message type identifier - */ - @JsonProperty("type") - public String getType() { - return "UtteranceEnd"; - } - - /** - * @return The channel - */ - @JsonProperty("channel") - public List getChannel() { - return channel; - } - - /** - * @return The last word end - */ - @JsonProperty("last_word_end") - public double getLastWordEnd() { - return lastWordEnd; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListenV1UtteranceEnd && equalTo((ListenV1UtteranceEnd) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListenV1UtteranceEnd other) { - return channel.equals(other.channel) && lastWordEnd == other.lastWordEnd; - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.channel, this.lastWordEnd); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static LastWordEndStage builder() { - return new Builder(); - } - - public interface LastWordEndStage { - /** The last word end */ - _FinalStage lastWordEnd(double lastWordEnd); - - Builder from(ListenV1UtteranceEnd other); - } - - public interface _FinalStage { - ListenV1UtteranceEnd build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** The channel */ - _FinalStage channel(List channel); - - _FinalStage addChannel(Double channel); - - _FinalStage addAllChannel(List channel); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements LastWordEndStage, _FinalStage { - private double lastWordEnd; - - private List channel = new ArrayList<>(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(ListenV1UtteranceEnd other) { - channel(other.getChannel()); - lastWordEnd(other.getLastWordEnd()); - return this; - } - - /** - * The last word end - * - *

The last word end - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("last_word_end") - public _FinalStage lastWordEnd(double lastWordEnd) { - this.lastWordEnd = lastWordEnd; - return this; - } - - /** - * The channel - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage addAllChannel(List channel) { - if (channel != null) { - this.channel.addAll(channel); - } - return this; - } - - /** - * The channel - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage addChannel(Double channel) { - this.channel.add(channel); - return this; - } - - /** The channel */ - @java.lang.Override - @JsonSetter(value = "channel", nulls = Nulls.SKIP) - public _FinalStage channel(List channel) { - this.channel.clear(); - if (channel != null) { - this.channel.addAll(channel); - } - return this; - } - - @java.lang.Override - public ListenV1UtteranceEnd build() { - return new ListenV1UtteranceEnd(channel, lastWordEnd, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/listen/v1/websocket/V1ConnectOptions.java b/src/main/java/resources/listen/v1/websocket/V1ConnectOptions.java deleted file mode 100644 index 32fa646..0000000 --- a/src/main/java/resources/listen/v1/websocket/V1ConnectOptions.java +++ /dev/null @@ -1,1025 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v1.websocket; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 core.ObjectMappers; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.jetbrains.annotations.NotNull; -import types.ListenV1Callback; -import types.ListenV1CallbackMethod; -import types.ListenV1Channels; -import types.ListenV1DetectEntities; -import types.ListenV1Diarize; -import types.ListenV1Dictation; -import types.ListenV1Encoding; -import types.ListenV1Endpointing; -import types.ListenV1Extra; -import types.ListenV1InterimResults; -import types.ListenV1Keyterm; -import types.ListenV1Keywords; -import types.ListenV1Language; -import types.ListenV1MipOptOut; -import types.ListenV1Model; -import types.ListenV1Multichannel; -import types.ListenV1Numerals; -import types.ListenV1ProfanityFilter; -import types.ListenV1Punctuate; -import types.ListenV1Redact; -import types.ListenV1Replace; -import types.ListenV1SampleRate; -import types.ListenV1Search; -import types.ListenV1SmartFormat; -import types.ListenV1Tag; -import types.ListenV1UtteranceEndMs; -import types.ListenV1VadEvents; -import types.ListenV1Version; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = V1ConnectOptions.Builder.class) -public final class V1ConnectOptions { - private final Optional callback; - - private final Optional callbackMethod; - - private final Optional channels; - - private final Optional detectEntities; - - private final Optional diarize; - - private final Optional dictation; - - private final Optional encoding; - - private final Optional endpointing; - - private final Optional extra; - - private final Optional interimResults; - - private final Optional keyterm; - - private final Optional keywords; - - private final Optional language; - - private final Optional mipOptOut; - - private final ListenV1Model model; - - private final Optional multichannel; - - private final Optional numerals; - - private final Optional profanityFilter; - - private final Optional punctuate; - - private final Optional redact; - - private final Optional replace; - - private final Optional sampleRate; - - private final Optional search; - - private final Optional smartFormat; - - private final Optional tag; - - private final Optional utteranceEndMs; - - private final Optional vadEvents; - - private final Optional version; - - private final Map additionalProperties; - - private V1ConnectOptions( - Optional callback, - Optional callbackMethod, - Optional channels, - Optional detectEntities, - Optional diarize, - Optional dictation, - Optional encoding, - Optional endpointing, - Optional extra, - Optional interimResults, - Optional keyterm, - Optional keywords, - Optional language, - Optional mipOptOut, - ListenV1Model model, - Optional multichannel, - Optional numerals, - Optional profanityFilter, - Optional punctuate, - Optional redact, - Optional replace, - Optional sampleRate, - Optional search, - Optional smartFormat, - Optional tag, - Optional utteranceEndMs, - Optional vadEvents, - Optional version, - Map additionalProperties) { - this.callback = callback; - this.callbackMethod = callbackMethod; - this.channels = channels; - this.detectEntities = detectEntities; - this.diarize = diarize; - this.dictation = dictation; - this.encoding = encoding; - this.endpointing = endpointing; - this.extra = extra; - this.interimResults = interimResults; - this.keyterm = keyterm; - this.keywords = keywords; - this.language = language; - this.mipOptOut = mipOptOut; - this.model = model; - this.multichannel = multichannel; - this.numerals = numerals; - this.profanityFilter = profanityFilter; - this.punctuate = punctuate; - this.redact = redact; - this.replace = replace; - this.sampleRate = sampleRate; - this.search = search; - this.smartFormat = smartFormat; - this.tag = tag; - this.utteranceEndMs = utteranceEndMs; - this.vadEvents = vadEvents; - this.version = version; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("callback") - public Optional getCallback() { - return callback; - } - - @JsonProperty("callback_method") - public Optional getCallbackMethod() { - return callbackMethod; - } - - @JsonProperty("channels") - public Optional getChannels() { - return channels; - } - - @JsonProperty("detect_entities") - public Optional getDetectEntities() { - return detectEntities; - } - - @JsonProperty("diarize") - public Optional getDiarize() { - return diarize; - } - - @JsonProperty("dictation") - public Optional getDictation() { - return dictation; - } - - @JsonProperty("encoding") - public Optional getEncoding() { - return encoding; - } - - @JsonProperty("endpointing") - public Optional getEndpointing() { - return endpointing; - } - - @JsonProperty("extra") - public Optional getExtra() { - return extra; - } - - @JsonProperty("interim_results") - public Optional getInterimResults() { - return interimResults; - } - - @JsonProperty("keyterm") - public Optional getKeyterm() { - return keyterm; - } - - @JsonProperty("keywords") - public Optional getKeywords() { - return keywords; - } - - @JsonProperty("language") - public Optional getLanguage() { - return language; - } - - @JsonProperty("mip_opt_out") - public Optional getMipOptOut() { - return mipOptOut; - } - - /** - * @return AI model to use for the transcription - */ - @JsonProperty("model") - public ListenV1Model getModel() { - return model; - } - - @JsonProperty("multichannel") - public Optional getMultichannel() { - return multichannel; - } - - @JsonProperty("numerals") - public Optional getNumerals() { - return numerals; - } - - @JsonProperty("profanity_filter") - public Optional getProfanityFilter() { - return profanityFilter; - } - - @JsonProperty("punctuate") - public Optional getPunctuate() { - return punctuate; - } - - @JsonProperty("redact") - public Optional getRedact() { - return redact; - } - - @JsonProperty("replace") - public Optional getReplace() { - return replace; - } - - @JsonProperty("sample_rate") - public Optional getSampleRate() { - return sampleRate; - } - - @JsonProperty("search") - public Optional getSearch() { - return search; - } - - @JsonProperty("smart_format") - public Optional getSmartFormat() { - return smartFormat; - } - - @JsonProperty("tag") - public Optional getTag() { - return tag; - } - - @JsonProperty("utterance_end_ms") - public Optional getUtteranceEndMs() { - return utteranceEndMs; - } - - @JsonProperty("vad_events") - public Optional getVadEvents() { - return vadEvents; - } - - @JsonProperty("version") - public Optional getVersion() { - return version; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof V1ConnectOptions && equalTo((V1ConnectOptions) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(V1ConnectOptions other) { - return callback.equals(other.callback) - && callbackMethod.equals(other.callbackMethod) - && channels.equals(other.channels) - && detectEntities.equals(other.detectEntities) - && diarize.equals(other.diarize) - && dictation.equals(other.dictation) - && encoding.equals(other.encoding) - && endpointing.equals(other.endpointing) - && extra.equals(other.extra) - && interimResults.equals(other.interimResults) - && keyterm.equals(other.keyterm) - && keywords.equals(other.keywords) - && language.equals(other.language) - && mipOptOut.equals(other.mipOptOut) - && model.equals(other.model) - && multichannel.equals(other.multichannel) - && numerals.equals(other.numerals) - && profanityFilter.equals(other.profanityFilter) - && punctuate.equals(other.punctuate) - && redact.equals(other.redact) - && replace.equals(other.replace) - && sampleRate.equals(other.sampleRate) - && search.equals(other.search) - && smartFormat.equals(other.smartFormat) - && tag.equals(other.tag) - && utteranceEndMs.equals(other.utteranceEndMs) - && vadEvents.equals(other.vadEvents) - && version.equals(other.version); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.callback, - this.callbackMethod, - this.channels, - this.detectEntities, - this.diarize, - this.dictation, - this.encoding, - this.endpointing, - this.extra, - this.interimResults, - this.keyterm, - this.keywords, - this.language, - this.mipOptOut, - this.model, - this.multichannel, - this.numerals, - this.profanityFilter, - this.punctuate, - this.redact, - this.replace, - this.sampleRate, - this.search, - this.smartFormat, - this.tag, - this.utteranceEndMs, - this.vadEvents, - this.version); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static ModelStage builder() { - return new Builder(); - } - - public interface ModelStage { - /** AI model to use for the transcription */ - _FinalStage model(@NotNull ListenV1Model model); - - Builder from(V1ConnectOptions other); - } - - public interface _FinalStage { - V1ConnectOptions build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - _FinalStage callback(Optional callback); - - _FinalStage callback(ListenV1Callback callback); - - _FinalStage callbackMethod(Optional callbackMethod); - - _FinalStage callbackMethod(ListenV1CallbackMethod callbackMethod); - - _FinalStage channels(Optional channels); - - _FinalStage channels(ListenV1Channels channels); - - _FinalStage detectEntities(Optional detectEntities); - - _FinalStage detectEntities(ListenV1DetectEntities detectEntities); - - _FinalStage diarize(Optional diarize); - - _FinalStage diarize(ListenV1Diarize diarize); - - _FinalStage dictation(Optional dictation); - - _FinalStage dictation(ListenV1Dictation dictation); - - _FinalStage encoding(Optional encoding); - - _FinalStage encoding(ListenV1Encoding encoding); - - _FinalStage endpointing(Optional endpointing); - - _FinalStage endpointing(ListenV1Endpointing endpointing); - - _FinalStage extra(Optional extra); - - _FinalStage extra(ListenV1Extra extra); - - _FinalStage interimResults(Optional interimResults); - - _FinalStage interimResults(ListenV1InterimResults interimResults); - - _FinalStage keyterm(Optional keyterm); - - _FinalStage keyterm(ListenV1Keyterm keyterm); - - _FinalStage keywords(Optional keywords); - - _FinalStage keywords(ListenV1Keywords keywords); - - _FinalStage language(Optional language); - - _FinalStage language(ListenV1Language language); - - _FinalStage mipOptOut(Optional mipOptOut); - - _FinalStage mipOptOut(ListenV1MipOptOut mipOptOut); - - _FinalStage multichannel(Optional multichannel); - - _FinalStage multichannel(ListenV1Multichannel multichannel); - - _FinalStage numerals(Optional numerals); - - _FinalStage numerals(ListenV1Numerals numerals); - - _FinalStage profanityFilter(Optional profanityFilter); - - _FinalStage profanityFilter(ListenV1ProfanityFilter profanityFilter); - - _FinalStage punctuate(Optional punctuate); - - _FinalStage punctuate(ListenV1Punctuate punctuate); - - _FinalStage redact(Optional redact); - - _FinalStage redact(ListenV1Redact redact); - - _FinalStage replace(Optional replace); - - _FinalStage replace(ListenV1Replace replace); - - _FinalStage sampleRate(Optional sampleRate); - - _FinalStage sampleRate(ListenV1SampleRate sampleRate); - - _FinalStage search(Optional search); - - _FinalStage search(ListenV1Search search); - - _FinalStage smartFormat(Optional smartFormat); - - _FinalStage smartFormat(ListenV1SmartFormat smartFormat); - - _FinalStage tag(Optional tag); - - _FinalStage tag(ListenV1Tag tag); - - _FinalStage utteranceEndMs(Optional utteranceEndMs); - - _FinalStage utteranceEndMs(ListenV1UtteranceEndMs utteranceEndMs); - - _FinalStage vadEvents(Optional vadEvents); - - _FinalStage vadEvents(ListenV1VadEvents vadEvents); - - _FinalStage version(Optional version); - - _FinalStage version(ListenV1Version version); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements ModelStage, _FinalStage { - private ListenV1Model model; - - private Optional version = Optional.empty(); - - private Optional vadEvents = Optional.empty(); - - private Optional utteranceEndMs = Optional.empty(); - - private Optional tag = Optional.empty(); - - private Optional smartFormat = Optional.empty(); - - private Optional search = Optional.empty(); - - private Optional sampleRate = Optional.empty(); - - private Optional replace = Optional.empty(); - - private Optional redact = Optional.empty(); - - private Optional punctuate = Optional.empty(); - - private Optional profanityFilter = Optional.empty(); - - private Optional numerals = Optional.empty(); - - private Optional multichannel = Optional.empty(); - - private Optional mipOptOut = Optional.empty(); - - private Optional language = Optional.empty(); - - private Optional keywords = Optional.empty(); - - private Optional keyterm = Optional.empty(); - - private Optional interimResults = Optional.empty(); - - private Optional extra = Optional.empty(); - - private Optional endpointing = Optional.empty(); - - private Optional encoding = Optional.empty(); - - private Optional dictation = Optional.empty(); - - private Optional diarize = Optional.empty(); - - private Optional detectEntities = Optional.empty(); - - private Optional channels = Optional.empty(); - - private Optional callbackMethod = Optional.empty(); - - private Optional callback = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(V1ConnectOptions other) { - callback(other.getCallback()); - callbackMethod(other.getCallbackMethod()); - channels(other.getChannels()); - detectEntities(other.getDetectEntities()); - diarize(other.getDiarize()); - dictation(other.getDictation()); - encoding(other.getEncoding()); - endpointing(other.getEndpointing()); - extra(other.getExtra()); - interimResults(other.getInterimResults()); - keyterm(other.getKeyterm()); - keywords(other.getKeywords()); - language(other.getLanguage()); - mipOptOut(other.getMipOptOut()); - model(other.getModel()); - multichannel(other.getMultichannel()); - numerals(other.getNumerals()); - profanityFilter(other.getProfanityFilter()); - punctuate(other.getPunctuate()); - redact(other.getRedact()); - replace(other.getReplace()); - sampleRate(other.getSampleRate()); - search(other.getSearch()); - smartFormat(other.getSmartFormat()); - tag(other.getTag()); - utteranceEndMs(other.getUtteranceEndMs()); - vadEvents(other.getVadEvents()); - version(other.getVersion()); - return this; - } - - /** - * AI model to use for the transcription - * - *

AI model to use for the transcription - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("model") - public _FinalStage model(@NotNull ListenV1Model model) { - this.model = Objects.requireNonNull(model, "model must not be null"); - return this; - } - - @java.lang.Override - public _FinalStage version(ListenV1Version version) { - this.version = Optional.ofNullable(version); - return this; - } - - @java.lang.Override - @JsonSetter(value = "version", nulls = Nulls.SKIP) - public _FinalStage version(Optional version) { - this.version = version; - return this; - } - - @java.lang.Override - public _FinalStage vadEvents(ListenV1VadEvents vadEvents) { - this.vadEvents = Optional.ofNullable(vadEvents); - return this; - } - - @java.lang.Override - @JsonSetter(value = "vad_events", nulls = Nulls.SKIP) - public _FinalStage vadEvents(Optional vadEvents) { - this.vadEvents = vadEvents; - return this; - } - - @java.lang.Override - public _FinalStage utteranceEndMs(ListenV1UtteranceEndMs utteranceEndMs) { - this.utteranceEndMs = Optional.ofNullable(utteranceEndMs); - return this; - } - - @java.lang.Override - @JsonSetter(value = "utterance_end_ms", nulls = Nulls.SKIP) - public _FinalStage utteranceEndMs(Optional utteranceEndMs) { - this.utteranceEndMs = utteranceEndMs; - return this; - } - - @java.lang.Override - public _FinalStage tag(ListenV1Tag 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 _FinalStage smartFormat(ListenV1SmartFormat smartFormat) { - this.smartFormat = Optional.ofNullable(smartFormat); - return this; - } - - @java.lang.Override - @JsonSetter(value = "smart_format", nulls = Nulls.SKIP) - public _FinalStage smartFormat(Optional smartFormat) { - this.smartFormat = smartFormat; - return this; - } - - @java.lang.Override - public _FinalStage search(ListenV1Search search) { - this.search = Optional.ofNullable(search); - return this; - } - - @java.lang.Override - @JsonSetter(value = "search", nulls = Nulls.SKIP) - public _FinalStage search(Optional search) { - this.search = search; - return this; - } - - @java.lang.Override - public _FinalStage sampleRate(ListenV1SampleRate sampleRate) { - this.sampleRate = Optional.ofNullable(sampleRate); - return this; - } - - @java.lang.Override - @JsonSetter(value = "sample_rate", nulls = Nulls.SKIP) - public _FinalStage sampleRate(Optional sampleRate) { - this.sampleRate = sampleRate; - return this; - } - - @java.lang.Override - public _FinalStage replace(ListenV1Replace replace) { - this.replace = Optional.ofNullable(replace); - return this; - } - - @java.lang.Override - @JsonSetter(value = "replace", nulls = Nulls.SKIP) - public _FinalStage replace(Optional replace) { - this.replace = replace; - return this; - } - - @java.lang.Override - public _FinalStage redact(ListenV1Redact redact) { - this.redact = Optional.ofNullable(redact); - return this; - } - - @java.lang.Override - @JsonSetter(value = "redact", nulls = Nulls.SKIP) - public _FinalStage redact(Optional redact) { - this.redact = redact; - return this; - } - - @java.lang.Override - public _FinalStage punctuate(ListenV1Punctuate punctuate) { - this.punctuate = Optional.ofNullable(punctuate); - return this; - } - - @java.lang.Override - @JsonSetter(value = "punctuate", nulls = Nulls.SKIP) - public _FinalStage punctuate(Optional punctuate) { - this.punctuate = punctuate; - return this; - } - - @java.lang.Override - public _FinalStage profanityFilter(ListenV1ProfanityFilter profanityFilter) { - this.profanityFilter = Optional.ofNullable(profanityFilter); - return this; - } - - @java.lang.Override - @JsonSetter(value = "profanity_filter", nulls = Nulls.SKIP) - public _FinalStage profanityFilter(Optional profanityFilter) { - this.profanityFilter = profanityFilter; - return this; - } - - @java.lang.Override - public _FinalStage numerals(ListenV1Numerals numerals) { - this.numerals = Optional.ofNullable(numerals); - return this; - } - - @java.lang.Override - @JsonSetter(value = "numerals", nulls = Nulls.SKIP) - public _FinalStage numerals(Optional numerals) { - this.numerals = numerals; - return this; - } - - @java.lang.Override - public _FinalStage multichannel(ListenV1Multichannel multichannel) { - this.multichannel = Optional.ofNullable(multichannel); - return this; - } - - @java.lang.Override - @JsonSetter(value = "multichannel", nulls = Nulls.SKIP) - public _FinalStage multichannel(Optional multichannel) { - this.multichannel = multichannel; - return this; - } - - @java.lang.Override - public _FinalStage mipOptOut(ListenV1MipOptOut mipOptOut) { - this.mipOptOut = Optional.ofNullable(mipOptOut); - return this; - } - - @java.lang.Override - @JsonSetter(value = "mip_opt_out", nulls = Nulls.SKIP) - public _FinalStage mipOptOut(Optional mipOptOut) { - this.mipOptOut = mipOptOut; - return this; - } - - @java.lang.Override - public _FinalStage language(ListenV1Language 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; - } - - @java.lang.Override - public _FinalStage keywords(ListenV1Keywords keywords) { - this.keywords = Optional.ofNullable(keywords); - return this; - } - - @java.lang.Override - @JsonSetter(value = "keywords", nulls = Nulls.SKIP) - public _FinalStage keywords(Optional keywords) { - this.keywords = keywords; - return this; - } - - @java.lang.Override - public _FinalStage keyterm(ListenV1Keyterm keyterm) { - this.keyterm = Optional.ofNullable(keyterm); - return this; - } - - @java.lang.Override - @JsonSetter(value = "keyterm", nulls = Nulls.SKIP) - public _FinalStage keyterm(Optional keyterm) { - this.keyterm = keyterm; - return this; - } - - @java.lang.Override - public _FinalStage interimResults(ListenV1InterimResults interimResults) { - this.interimResults = Optional.ofNullable(interimResults); - return this; - } - - @java.lang.Override - @JsonSetter(value = "interim_results", nulls = Nulls.SKIP) - public _FinalStage interimResults(Optional interimResults) { - this.interimResults = interimResults; - return this; - } - - @java.lang.Override - public _FinalStage extra(ListenV1Extra extra) { - this.extra = Optional.ofNullable(extra); - return this; - } - - @java.lang.Override - @JsonSetter(value = "extra", nulls = Nulls.SKIP) - public _FinalStage extra(Optional extra) { - this.extra = extra; - return this; - } - - @java.lang.Override - public _FinalStage endpointing(ListenV1Endpointing endpointing) { - this.endpointing = Optional.ofNullable(endpointing); - return this; - } - - @java.lang.Override - @JsonSetter(value = "endpointing", nulls = Nulls.SKIP) - public _FinalStage endpointing(Optional endpointing) { - this.endpointing = endpointing; - return this; - } - - @java.lang.Override - public _FinalStage encoding(ListenV1Encoding encoding) { - this.encoding = Optional.ofNullable(encoding); - return this; - } - - @java.lang.Override - @JsonSetter(value = "encoding", nulls = Nulls.SKIP) - public _FinalStage encoding(Optional encoding) { - this.encoding = encoding; - return this; - } - - @java.lang.Override - public _FinalStage dictation(ListenV1Dictation dictation) { - this.dictation = Optional.ofNullable(dictation); - return this; - } - - @java.lang.Override - @JsonSetter(value = "dictation", nulls = Nulls.SKIP) - public _FinalStage dictation(Optional dictation) { - this.dictation = dictation; - return this; - } - - @java.lang.Override - public _FinalStage diarize(ListenV1Diarize diarize) { - this.diarize = Optional.ofNullable(diarize); - return this; - } - - @java.lang.Override - @JsonSetter(value = "diarize", nulls = Nulls.SKIP) - public _FinalStage diarize(Optional diarize) { - this.diarize = diarize; - return this; - } - - @java.lang.Override - public _FinalStage detectEntities(ListenV1DetectEntities detectEntities) { - this.detectEntities = Optional.ofNullable(detectEntities); - return this; - } - - @java.lang.Override - @JsonSetter(value = "detect_entities", nulls = Nulls.SKIP) - public _FinalStage detectEntities(Optional detectEntities) { - this.detectEntities = detectEntities; - return this; - } - - @java.lang.Override - public _FinalStage channels(ListenV1Channels channels) { - this.channels = Optional.ofNullable(channels); - return this; - } - - @java.lang.Override - @JsonSetter(value = "channels", nulls = Nulls.SKIP) - public _FinalStage channels(Optional channels) { - this.channels = channels; - return this; - } - - @java.lang.Override - public _FinalStage callbackMethod(ListenV1CallbackMethod callbackMethod) { - this.callbackMethod = Optional.ofNullable(callbackMethod); - return this; - } - - @java.lang.Override - @JsonSetter(value = "callback_method", nulls = Nulls.SKIP) - public _FinalStage callbackMethod(Optional callbackMethod) { - this.callbackMethod = callbackMethod; - return this; - } - - @java.lang.Override - public _FinalStage callback(ListenV1Callback callback) { - this.callback = Optional.ofNullable(callback); - return this; - } - - @java.lang.Override - @JsonSetter(value = "callback", nulls = Nulls.SKIP) - public _FinalStage callback(Optional callback) { - this.callback = callback; - return this; - } - - @java.lang.Override - public V1ConnectOptions build() { - return new V1ConnectOptions( - callback, - callbackMethod, - channels, - detectEntities, - diarize, - dictation, - encoding, - endpointing, - extra, - interimResults, - keyterm, - keywords, - language, - mipOptOut, - model, - multichannel, - numerals, - profanityFilter, - punctuate, - redact, - replace, - sampleRate, - search, - smartFormat, - tag, - utteranceEndMs, - vadEvents, - version, - additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/listen/v1/websocket/V1WebSocketClient.java b/src/main/java/resources/listen/v1/websocket/V1WebSocketClient.java deleted file mode 100644 index 0cd01a1..0000000 --- a/src/main/java/resources/listen/v1/websocket/V1WebSocketClient.java +++ /dev/null @@ -1,498 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v1.websocket; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import core.ClientOptions; -import core.DisconnectReason; -import core.ObjectMappers; -import core.ReconnectingWebSocketListener; -import core.WebSocketReadyState; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ScheduledExecutorService; -import java.util.function.Consumer; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import okhttp3.WebSocket; -import okio.ByteString; -import resources.listen.v1.types.ListenV1CloseStream; -import resources.listen.v1.types.ListenV1Finalize; -import resources.listen.v1.types.ListenV1KeepAlive; -import resources.listen.v1.types.ListenV1Metadata; -import resources.listen.v1.types.ListenV1Results; -import resources.listen.v1.types.ListenV1SpeechStarted; -import resources.listen.v1.types.ListenV1UtteranceEnd; - -/** - * WebSocket client for the v1 channel. Provides real-time bidirectional communication with - * strongly-typed messages. - */ -public class V1WebSocketClient implements AutoCloseable { - protected final ClientOptions clientOptions; - - private final ObjectMapper objectMapper; - - private final OkHttpClient okHttpClient; - - private ScheduledExecutorService timeoutExecutor; - - private volatile WebSocketReadyState readyState = WebSocketReadyState.CLOSED; - - private volatile Runnable onConnectedHandler; - - private volatile Consumer onDisconnectedHandler; - - private volatile Consumer onErrorHandler; - - private volatile Consumer onMessageHandler; - - private volatile ReconnectingWebSocketListener.ReconnectOptions reconnectOptions; - - private CompletableFuture connectionFuture; - - private ReconnectingWebSocketListener reconnectingListener; - - private volatile Consumer resultsHandler; - - private volatile Consumer metadataHandler; - - private volatile Consumer utteranceEndHandler; - - private volatile Consumer speechStartedHandler; - - /** Creates a new async WebSocket client for the v1 channel. */ - public V1WebSocketClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.objectMapper = ObjectMappers.JSON_MAPPER; - this.okHttpClient = clientOptions.httpClient(); - } - - /** - * Establishes the WebSocket connection asynchronously with automatic reconnection. - * - * @return a CompletableFuture that completes when the connection is established - * @param options connection options including query parameters - */ - public CompletableFuture connect(V1ConnectOptions options) { - connectionFuture = new CompletableFuture<>(); - String baseUrl = clientOptions.environment().getProductionURL(); - String fullPath = "/v1/listen"; - if (baseUrl.endsWith("/") && fullPath.startsWith("/")) { - fullPath = fullPath.substring(1); - } else if (!baseUrl.endsWith("/") && !fullPath.startsWith("/")) { - fullPath = "/" + fullPath; - } - // OkHttp's HttpUrl only supports http/https schemes; convert wss/ws for URL parsing - if (baseUrl.startsWith("wss://")) { - baseUrl = "https://" + baseUrl.substring(6); - } else if (baseUrl.startsWith("ws://")) { - baseUrl = "http://" + baseUrl.substring(5); - } - HttpUrl parsedUrl = HttpUrl.parse(baseUrl + fullPath); - if (parsedUrl == null) { - throw new IllegalArgumentException("Invalid WebSocket URL: " + baseUrl + fullPath); - } - HttpUrl.Builder urlBuilder = parsedUrl.newBuilder(); - if (options.getCallback() != null && options.getCallback().isPresent()) { - urlBuilder.addQueryParameter("callback", String.valueOf(options.getCallback().get())); - } - if (options.getCallbackMethod() != null && options.getCallbackMethod().isPresent()) { - urlBuilder.addQueryParameter( - "callback_method", String.valueOf(options.getCallbackMethod().get())); - } - if (options.getChannels() != null && options.getChannels().isPresent()) { - urlBuilder.addQueryParameter("channels", String.valueOf(options.getChannels().get())); - } - if (options.getDetectEntities() != null && options.getDetectEntities().isPresent()) { - urlBuilder.addQueryParameter( - "detect_entities", String.valueOf(options.getDetectEntities().get())); - } - if (options.getDiarize() != null && options.getDiarize().isPresent()) { - urlBuilder.addQueryParameter("diarize", String.valueOf(options.getDiarize().get())); - } - if (options.getDictation() != null && options.getDictation().isPresent()) { - urlBuilder.addQueryParameter("dictation", String.valueOf(options.getDictation().get())); - } - if (options.getEncoding() != null && options.getEncoding().isPresent()) { - urlBuilder.addQueryParameter("encoding", String.valueOf(options.getEncoding().get())); - } - if (options.getEndpointing() != null && options.getEndpointing().isPresent()) { - urlBuilder.addQueryParameter("endpointing", String.valueOf(options.getEndpointing().get())); - } - if (options.getExtra() != null && options.getExtra().isPresent()) { - urlBuilder.addQueryParameter("extra", String.valueOf(options.getExtra().get())); - } - if (options.getInterimResults() != null && options.getInterimResults().isPresent()) { - urlBuilder.addQueryParameter( - "interim_results", String.valueOf(options.getInterimResults().get())); - } - if (options.getKeyterm() != null && options.getKeyterm().isPresent()) { - urlBuilder.addQueryParameter("keyterm", String.valueOf(options.getKeyterm().get())); - } - if (options.getKeywords() != null && options.getKeywords().isPresent()) { - urlBuilder.addQueryParameter("keywords", String.valueOf(options.getKeywords().get())); - } - if (options.getLanguage() != null && options.getLanguage().isPresent()) { - urlBuilder.addQueryParameter("language", String.valueOf(options.getLanguage().get())); - } - if (options.getMipOptOut() != null && options.getMipOptOut().isPresent()) { - urlBuilder.addQueryParameter("mip_opt_out", String.valueOf(options.getMipOptOut().get())); - } - urlBuilder.addQueryParameter("model", String.valueOf(options.getModel())); - if (options.getMultichannel() != null && options.getMultichannel().isPresent()) { - urlBuilder.addQueryParameter("multichannel", String.valueOf(options.getMultichannel().get())); - } - if (options.getNumerals() != null && options.getNumerals().isPresent()) { - urlBuilder.addQueryParameter("numerals", String.valueOf(options.getNumerals().get())); - } - if (options.getProfanityFilter() != null && options.getProfanityFilter().isPresent()) { - urlBuilder.addQueryParameter( - "profanity_filter", String.valueOf(options.getProfanityFilter().get())); - } - if (options.getPunctuate() != null && options.getPunctuate().isPresent()) { - urlBuilder.addQueryParameter("punctuate", String.valueOf(options.getPunctuate().get())); - } - if (options.getRedact() != null && options.getRedact().isPresent()) { - urlBuilder.addQueryParameter("redact", String.valueOf(options.getRedact().get())); - } - if (options.getReplace() != null && options.getReplace().isPresent()) { - urlBuilder.addQueryParameter("replace", String.valueOf(options.getReplace().get())); - } - if (options.getSampleRate() != null && options.getSampleRate().isPresent()) { - urlBuilder.addQueryParameter("sample_rate", String.valueOf(options.getSampleRate().get())); - } - if (options.getSearch() != null && options.getSearch().isPresent()) { - urlBuilder.addQueryParameter("search", String.valueOf(options.getSearch().get())); - } - if (options.getSmartFormat() != null && options.getSmartFormat().isPresent()) { - urlBuilder.addQueryParameter("smart_format", String.valueOf(options.getSmartFormat().get())); - } - if (options.getTag() != null && options.getTag().isPresent()) { - urlBuilder.addQueryParameter("tag", String.valueOf(options.getTag().get())); - } - if (options.getUtteranceEndMs() != null && options.getUtteranceEndMs().isPresent()) { - urlBuilder.addQueryParameter( - "utterance_end_ms", String.valueOf(options.getUtteranceEndMs().get())); - } - if (options.getVadEvents() != null && options.getVadEvents().isPresent()) { - urlBuilder.addQueryParameter("vad_events", String.valueOf(options.getVadEvents().get())); - } - if (options.getVersion() != null && options.getVersion().isPresent()) { - urlBuilder.addQueryParameter("version", String.valueOf(options.getVersion().get())); - } - Request.Builder requestBuilder = new Request.Builder().url(urlBuilder.build()); - clientOptions.headers(null).forEach(requestBuilder::addHeader); - final Request request = requestBuilder.build(); - this.readyState = WebSocketReadyState.CONNECTING; - ReconnectingWebSocketListener.ReconnectOptions reconnectOpts = - this.reconnectOptions != null - ? this.reconnectOptions - : ReconnectingWebSocketListener.ReconnectOptions.builder().build(); - this.reconnectingListener = - new ReconnectingWebSocketListener( - reconnectOpts, - () -> { - if (clientOptions.webSocketFactory().isPresent()) { - return clientOptions - .webSocketFactory() - .get() - .create(request, this.reconnectingListener); - } else { - return okHttpClient.newWebSocket(request, this.reconnectingListener); - } - }) { - @Override - protected void onWebSocketOpen(WebSocket webSocket, Response response) { - readyState = WebSocketReadyState.OPEN; - if (onConnectedHandler != null) { - onConnectedHandler.run(); - } - connectionFuture.complete(null); - } - - @Override - protected void onWebSocketMessage(WebSocket webSocket, String text) { - handleIncomingMessage(text); - } - - @Override - protected void onWebSocketBinaryMessage(WebSocket webSocket, ByteString bytes) {} - - @Override - protected void onWebSocketFailure(WebSocket webSocket, Throwable t, Response response) { - readyState = WebSocketReadyState.CLOSED; - if (onErrorHandler != null) { - onErrorHandler.accept(new RuntimeException(t)); - } - connectionFuture.completeExceptionally(t); - } - - @Override - protected void onWebSocketClosed(WebSocket webSocket, int code, String reason) { - readyState = WebSocketReadyState.CLOSED; - if (onDisconnectedHandler != null) { - onDisconnectedHandler.accept(new DisconnectReason(code, reason)); - } - } - }; - reconnectingListener.connect(); - return connectionFuture; - } - - /** Disconnects the WebSocket connection and releases resources. */ - public void disconnect() { - reconnectingListener.disconnect(); - if (timeoutExecutor != null) { - timeoutExecutor.shutdownNow(); - timeoutExecutor = null; - } - } - - /** - * Gets the current state of the WebSocket connection. - * - *

This provides the actual connection state, similar to the W3C WebSocket API. - * - * @return the current WebSocket ready state - */ - public WebSocketReadyState getReadyState() { - return readyState; - } - - /** - * Sends a ListenV1Media message to the server asynchronously. - * - * @param message the message to send - * @return a CompletableFuture that completes when the message is sent - */ - public CompletableFuture sendMedia(ByteString message) { - CompletableFuture future = new CompletableFuture<>(); - try { - assertSocketIsOpen(); - // Use reconnecting listener's sendBinary method which handles queuing - reconnectingListener.sendBinary(message); - future.complete(null); - } catch (Exception e) { - future.completeExceptionally(new RuntimeException("Failed to send binary data", e)); - } - return future; - } - - /** - * Sends a ListenV1Finalize message to the server asynchronously. - * - * @param message the message to send - * @return a CompletableFuture that completes when the message is sent - */ - public CompletableFuture sendFinalize(ListenV1Finalize message) { - return sendMessage(message); - } - - /** - * Sends a ListenV1CloseStream message to the server asynchronously. - * - * @param message the message to send - * @return a CompletableFuture that completes when the message is sent - */ - public CompletableFuture sendCloseStream(ListenV1CloseStream message) { - return sendMessage(message); - } - - /** - * Sends a ListenV1KeepAlive message to the server asynchronously. - * - * @param message the message to send - * @return a CompletableFuture that completes when the message is sent - */ - public CompletableFuture sendKeepAlive(ListenV1KeepAlive message) { - return sendMessage(message); - } - - /** - * Registers a handler for ListenV1Results messages from the server. - * - * @param handler the handler to invoke when a message is received - */ - public void onResults(Consumer handler) { - this.resultsHandler = handler; - } - - /** - * Registers a handler for ListenV1Metadata messages from the server. - * - * @param handler the handler to invoke when a message is received - */ - public void onMetadata(Consumer handler) { - this.metadataHandler = handler; - } - - /** - * Registers a handler for ListenV1UtteranceEnd messages from the server. - * - * @param handler the handler to invoke when a message is received - */ - public void onUtteranceEnd(Consumer handler) { - this.utteranceEndHandler = handler; - } - - /** - * Registers a handler for ListenV1SpeechStarted messages from the server. - * - * @param handler the handler to invoke when a message is received - */ - public void onSpeechStarted(Consumer handler) { - this.speechStartedHandler = handler; - } - - /** - * Registers a handler called when the connection is established. - * - * @param handler the handler to invoke when connected - */ - public void onConnected(Runnable handler) { - this.onConnectedHandler = handler; - } - - /** - * Registers a handler called when the connection is closed. - * - * @param handler the handler to invoke when disconnected - */ - public void onDisconnected(Consumer handler) { - this.onDisconnectedHandler = handler; - } - - /** - * Registers a handler called when an error occurs. - * - * @param handler the handler to invoke on error - */ - public void onError(Consumer handler) { - this.onErrorHandler = handler; - } - - /** - * Registers a handler called for every incoming text message. The handler receives the raw JSON - * string before type-specific dispatch. - * - * @param handler the handler to invoke with the raw message JSON - */ - public void onMessage(Consumer handler) { - this.onMessageHandler = handler; - } - - /** - * Configures reconnection behavior. Must be called before {@link #connect}. - * - * @param options the reconnection options (backoff, retries, queue size) - */ - public void reconnectOptions(ReconnectingWebSocketListener.ReconnectOptions options) { - this.reconnectOptions = options; - } - - /** - * Closes this WebSocket client, releasing all resources. Equivalent to calling {@link - * #disconnect()}. - */ - @Override - public void close() { - disconnect(); - } - - /** - * Ensures the WebSocket is connected and ready to send messages. - * - * @throws IllegalStateException if the socket is not connected or not open - */ - private void assertSocketIsOpen() { - if (reconnectingListener.getWebSocket() == null) { - throw new IllegalStateException("WebSocket is not connected. Call connect() first."); - } - if (readyState != WebSocketReadyState.OPEN) { - throw new IllegalStateException("WebSocket is not open. Current state: " + readyState); - } - } - - private CompletableFuture sendMessage(Object body) { - CompletableFuture future = new CompletableFuture<>(); - try { - assertSocketIsOpen(); - String json = objectMapper.writeValueAsString(body); - // Use reconnecting listener's send method which handles queuing - reconnectingListener.send(json); - future.complete(null); - } catch (IllegalStateException e) { - future.completeExceptionally(e); - } catch (Exception e) { - future.completeExceptionally(new RuntimeException("Failed to send message", e)); - } - return future; - } - - private void handleIncomingMessage(String json) { - try { - if (onMessageHandler != null) { - onMessageHandler.accept(json); - } - JsonNode node = objectMapper.readTree(json); - if (node == null || node.isNull()) { - throw new IllegalArgumentException("Received null or invalid JSON message"); - } - JsonNode typeNode = node.get("type"); - if (typeNode == null || typeNode.isNull()) { - throw new IllegalArgumentException("Message missing 'type' field"); - } - String type = typeNode.asText(); - switch (type) { - case "Results": - if (resultsHandler != null) { - ListenV1Results event = objectMapper.treeToValue(node, ListenV1Results.class); - if (event != null) { - resultsHandler.accept(event); - } - } - break; - case "Metadata": - if (metadataHandler != null) { - ListenV1Metadata event = objectMapper.treeToValue(node, ListenV1Metadata.class); - if (event != null) { - metadataHandler.accept(event); - } - } - break; - case "UtteranceEnd": - if (utteranceEndHandler != null) { - ListenV1UtteranceEnd event = objectMapper.treeToValue(node, ListenV1UtteranceEnd.class); - if (event != null) { - utteranceEndHandler.accept(event); - } - } - break; - case "SpeechStarted": - if (speechStartedHandler != null) { - ListenV1SpeechStarted event = - objectMapper.treeToValue(node, ListenV1SpeechStarted.class); - if (event != null) { - speechStartedHandler.accept(event); - } - } - break; - default: - if (onErrorHandler != null) { - onErrorHandler.accept( - new RuntimeException( - "Unknown WebSocket message type: '" - + type - + "'. Update your SDK version to support new message types.")); - } - break; - } - } catch (Exception e) { - if (onErrorHandler != null) { - onErrorHandler.accept(e); - } - } - } -} diff --git a/src/main/java/resources/listen/v2/AsyncV2Client.java b/src/main/java/resources/listen/v2/AsyncV2Client.java deleted file mode 100644 index 4d79661..0000000 --- a/src/main/java/resources/listen/v2/AsyncV2Client.java +++ /dev/null @@ -1,18 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v2; - -import core.ClientOptions; -import resources.listen.v2.websocket.V2WebSocketClient; - -public class AsyncV2Client { - protected final ClientOptions clientOptions; - - public AsyncV2Client(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** Creates a new WebSocket client for the v2 channel. */ - public V2WebSocketClient v2WebSocket() { - return new V2WebSocketClient(clientOptions); - } -} diff --git a/src/main/java/resources/listen/v2/V2Client.java b/src/main/java/resources/listen/v2/V2Client.java deleted file mode 100644 index d4c5b2c..0000000 --- a/src/main/java/resources/listen/v2/V2Client.java +++ /dev/null @@ -1,18 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v2; - -import core.ClientOptions; -import resources.listen.v2.websocket.V2WebSocketClient; - -public class V2Client { - protected final ClientOptions clientOptions; - - public V2Client(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** Creates a new WebSocket client for the v2 channel. */ - public V2WebSocketClient v2WebSocket() { - return new V2WebSocketClient(clientOptions); - } -} diff --git a/src/main/java/resources/listen/v2/types/ListenV2CloseStream.java b/src/main/java/resources/listen/v2/types/ListenV2CloseStream.java deleted file mode 100644 index b1a8f58..0000000 --- a/src/main/java/resources/listen/v2/types/ListenV2CloseStream.java +++ /dev/null @@ -1,127 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v2.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListenV2CloseStream.Builder.class) -public final class ListenV2CloseStream { - private final ListenV2CloseStreamType type; - - private final Map additionalProperties; - - private ListenV2CloseStream( - ListenV2CloseStreamType type, Map additionalProperties) { - this.type = type; - this.additionalProperties = additionalProperties; - } - - /** - * @return Message type identifier - */ - @JsonProperty("type") - public ListenV2CloseStreamType getType() { - return type; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListenV2CloseStream && equalTo((ListenV2CloseStream) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListenV2CloseStream other) { - return type.equals(other.type); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.type); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static TypeStage builder() { - return new Builder(); - } - - public interface TypeStage { - /** Message type identifier */ - _FinalStage type(@NotNull ListenV2CloseStreamType type); - - Builder from(ListenV2CloseStream other); - } - - public interface _FinalStage { - ListenV2CloseStream build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements TypeStage, _FinalStage { - private ListenV2CloseStreamType type; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(ListenV2CloseStream other) { - type(other.getType()); - return this; - } - - /** - * Message type identifier - * - *

Message type identifier - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("type") - public _FinalStage type(@NotNull ListenV2CloseStreamType type) { - this.type = Objects.requireNonNull(type, "type must not be null"); - return this; - } - - @java.lang.Override - public ListenV2CloseStream build() { - return new ListenV2CloseStream(type, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/listen/v2/types/ListenV2CloseStreamType.java b/src/main/java/resources/listen/v2/types/ListenV2CloseStreamType.java deleted file mode 100644 index f307955..0000000 --- a/src/main/java/resources/listen/v2/types/ListenV2CloseStreamType.java +++ /dev/null @@ -1,95 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v2.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class ListenV2CloseStreamType { - public static final ListenV2CloseStreamType CLOSE_STREAM = - new ListenV2CloseStreamType(Value.CLOSE_STREAM, "CloseStream"); - - public static final ListenV2CloseStreamType FINALIZE = - new ListenV2CloseStreamType(Value.FINALIZE, "Finalize"); - - public static final ListenV2CloseStreamType KEEP_ALIVE = - new ListenV2CloseStreamType(Value.KEEP_ALIVE, "KeepAlive"); - - private final Value value; - - private final String string; - - ListenV2CloseStreamType(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof ListenV2CloseStreamType - && this.string.equals(((ListenV2CloseStreamType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case CLOSE_STREAM: - return visitor.visitCloseStream(); - case FINALIZE: - return visitor.visitFinalize(); - case KEEP_ALIVE: - return visitor.visitKeepAlive(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListenV2CloseStreamType valueOf(String value) { - switch (value) { - case "CloseStream": - return CLOSE_STREAM; - case "Finalize": - return FINALIZE; - case "KeepAlive": - return KEEP_ALIVE; - default: - return new ListenV2CloseStreamType(Value.UNKNOWN, value); - } - } - - public enum Value { - FINALIZE, - - CLOSE_STREAM, - - KEEP_ALIVE, - - UNKNOWN - } - - public interface Visitor { - T visitFinalize(); - - T visitCloseStream(); - - T visitKeepAlive(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/resources/listen/v2/types/ListenV2Configure.java b/src/main/java/resources/listen/v2/types/ListenV2Configure.java deleted file mode 100644 index 50ff88e..0000000 --- a/src/main/java/resources/listen/v2/types/ListenV2Configure.java +++ /dev/null @@ -1,144 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v2.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 core.ObjectMappers; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import types.ListenV2Keyterm; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = ListenV2Configure.Builder.class) -public final class ListenV2Configure { - private final Optional thresholds; - - private final Optional keyterms; - - private final Map additionalProperties; - - private ListenV2Configure( - Optional thresholds, - Optional keyterms, - Map additionalProperties) { - this.thresholds = thresholds; - this.keyterms = keyterms; - this.additionalProperties = additionalProperties; - } - - /** - * @return Message type identifier - */ - @JsonProperty("type") - public String getType() { - return "Configure"; - } - - /** - * @return Updates each parameter, if it is supplied. If a particular threshold parameter is not - * supplied, the configuration continues using the currently configured value. - */ - @JsonProperty("thresholds") - public Optional getThresholds() { - return thresholds; - } - - @JsonProperty("keyterms") - public Optional getKeyterms() { - return keyterms; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListenV2Configure && equalTo((ListenV2Configure) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListenV2Configure other) { - return thresholds.equals(other.thresholds) && keyterms.equals(other.keyterms); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.thresholds, this.keyterms); - } - - @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 thresholds = Optional.empty(); - - private Optional keyterms = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListenV2Configure other) { - thresholds(other.getThresholds()); - keyterms(other.getKeyterms()); - return this; - } - - /** - * Updates each parameter, if it is supplied. If a particular threshold parameter is not - * supplied, the configuration continues using the currently configured value. - */ - @JsonSetter(value = "thresholds", nulls = Nulls.SKIP) - public Builder thresholds(Optional thresholds) { - this.thresholds = thresholds; - return this; - } - - public Builder thresholds(ListenV2ConfigureThresholds thresholds) { - this.thresholds = Optional.ofNullable(thresholds); - return this; - } - - @JsonSetter(value = "keyterms", nulls = Nulls.SKIP) - public Builder keyterms(Optional keyterms) { - this.keyterms = keyterms; - return this; - } - - public Builder keyterms(ListenV2Keyterm keyterms) { - this.keyterms = Optional.ofNullable(keyterms); - return this; - } - - public ListenV2Configure build() { - return new ListenV2Configure(thresholds, keyterms, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/listen/v2/types/ListenV2ConfigureFailure.java b/src/main/java/resources/listen/v2/types/ListenV2ConfigureFailure.java deleted file mode 100644 index c7c273f..0000000 --- a/src/main/java/resources/listen/v2/types/ListenV2ConfigureFailure.java +++ /dev/null @@ -1,174 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v2.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListenV2ConfigureFailure.Builder.class) -public final class ListenV2ConfigureFailure { - private final String requestId; - - private final double sequenceId; - - private final Map additionalProperties; - - private ListenV2ConfigureFailure( - String requestId, double sequenceId, Map additionalProperties) { - this.requestId = requestId; - this.sequenceId = sequenceId; - this.additionalProperties = additionalProperties; - } - - /** - * @return Message type identifier - */ - @JsonProperty("type") - public String getType() { - return "ConfigureFailure"; - } - - /** - * @return The unique identifier of the request - */ - @JsonProperty("request_id") - public String getRequestId() { - return requestId; - } - - /** - * @return Starts at 0 and increments for each message the server sends to the - * client. This includes messages of other types, like TurnInfo messages. - */ - @JsonProperty("sequence_id") - public double getSequenceId() { - return sequenceId; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListenV2ConfigureFailure && equalTo((ListenV2ConfigureFailure) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListenV2ConfigureFailure other) { - return requestId.equals(other.requestId) && sequenceId == other.sequenceId; - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.requestId, this.sequenceId); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static RequestIdStage builder() { - return new Builder(); - } - - public interface RequestIdStage { - /** The unique identifier of the request */ - SequenceIdStage requestId(@NotNull String requestId); - - Builder from(ListenV2ConfigureFailure other); - } - - public interface SequenceIdStage { - /** - * Starts at 0 and increments for each message the server sends to the client. This - * includes messages of other types, like TurnInfo messages. - */ - _FinalStage sequenceId(double sequenceId); - } - - public interface _FinalStage { - ListenV2ConfigureFailure build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements RequestIdStage, SequenceIdStage, _FinalStage { - private String requestId; - - private double sequenceId; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(ListenV2ConfigureFailure other) { - requestId(other.getRequestId()); - sequenceId(other.getSequenceId()); - return this; - } - - /** - * The unique identifier of the request - * - *

The unique identifier of the request - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("request_id") - public SequenceIdStage requestId(@NotNull String requestId) { - this.requestId = Objects.requireNonNull(requestId, "requestId must not be null"); - return this; - } - - /** - * Starts at 0 and increments for each message the server sends to the client. This - * includes messages of other types, like TurnInfo messages. - * - *

Starts at 0 and increments for each message the server sends to the client. - * This includes messages of other types, like TurnInfo messages. - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("sequence_id") - public _FinalStage sequenceId(double sequenceId) { - this.sequenceId = sequenceId; - return this; - } - - @java.lang.Override - public ListenV2ConfigureFailure build() { - return new ListenV2ConfigureFailure(requestId, sequenceId, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/listen/v2/types/ListenV2ConfigureSuccess.java b/src/main/java/resources/listen/v2/types/ListenV2ConfigureSuccess.java deleted file mode 100644 index b55af3d..0000000 --- a/src/main/java/resources/listen/v2/types/ListenV2ConfigureSuccess.java +++ /dev/null @@ -1,245 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v2.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 core.ObjectMappers; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import org.jetbrains.annotations.NotNull; -import types.ListenV2Keyterm; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = ListenV2ConfigureSuccess.Builder.class) -public final class ListenV2ConfigureSuccess { - private final String requestId; - - private final ListenV2ConfigureSuccessThresholds thresholds; - - private final ListenV2Keyterm keyterms; - - private final double sequenceId; - - private final Map additionalProperties; - - private ListenV2ConfigureSuccess( - String requestId, - ListenV2ConfigureSuccessThresholds thresholds, - ListenV2Keyterm keyterms, - double sequenceId, - Map additionalProperties) { - this.requestId = requestId; - this.thresholds = thresholds; - this.keyterms = keyterms; - this.sequenceId = sequenceId; - this.additionalProperties = additionalProperties; - } - - /** - * @return Message type identifier - */ - @JsonProperty("type") - public String getType() { - return "ConfigureSuccess"; - } - - /** - * @return The unique identifier of the request - */ - @JsonProperty("request_id") - public String getRequestId() { - return requestId; - } - - /** - * @return Updates each parameter, if it is supplied. If a particular threshold parameter is not - * supplied, the configuration continues using the currently configured value. - */ - @JsonProperty("thresholds") - public ListenV2ConfigureSuccessThresholds getThresholds() { - return thresholds; - } - - @JsonProperty("keyterms") - public ListenV2Keyterm getKeyterms() { - return keyterms; - } - - /** - * @return Starts at 0 and increments for each message the server sends to the - * client. This includes messages of other types, like TurnInfo messages. - */ - @JsonProperty("sequence_id") - public double getSequenceId() { - return sequenceId; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListenV2ConfigureSuccess && equalTo((ListenV2ConfigureSuccess) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListenV2ConfigureSuccess other) { - return requestId.equals(other.requestId) - && thresholds.equals(other.thresholds) - && keyterms.equals(other.keyterms) - && sequenceId == other.sequenceId; - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.requestId, this.thresholds, this.keyterms, this.sequenceId); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static RequestIdStage builder() { - return new Builder(); - } - - public interface RequestIdStage { - /** The unique identifier of the request */ - ThresholdsStage requestId(@NotNull String requestId); - - Builder from(ListenV2ConfigureSuccess other); - } - - public interface ThresholdsStage { - /** - * Updates each parameter, if it is supplied. If a particular threshold parameter is not - * supplied, the configuration continues using the currently configured value. - */ - KeytermsStage thresholds(@NotNull ListenV2ConfigureSuccessThresholds thresholds); - } - - public interface KeytermsStage { - SequenceIdStage keyterms(@NotNull ListenV2Keyterm keyterms); - } - - public interface SequenceIdStage { - /** - * Starts at 0 and increments for each message the server sends to the client. This - * includes messages of other types, like TurnInfo messages. - */ - _FinalStage sequenceId(double sequenceId); - } - - public interface _FinalStage { - ListenV2ConfigureSuccess build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements RequestIdStage, ThresholdsStage, KeytermsStage, SequenceIdStage, _FinalStage { - private String requestId; - - private ListenV2ConfigureSuccessThresholds thresholds; - - private ListenV2Keyterm keyterms; - - private double sequenceId; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(ListenV2ConfigureSuccess other) { - requestId(other.getRequestId()); - thresholds(other.getThresholds()); - keyterms(other.getKeyterms()); - sequenceId(other.getSequenceId()); - return this; - } - - /** - * The unique identifier of the request - * - *

The unique identifier of the request - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("request_id") - public ThresholdsStage requestId(@NotNull String requestId) { - this.requestId = Objects.requireNonNull(requestId, "requestId must not be null"); - return this; - } - - /** - * Updates each parameter, if it is supplied. If a particular threshold parameter is not - * supplied, the configuration continues using the currently configured value. - * - *

Updates each parameter, if it is supplied. If a particular threshold parameter is not - * supplied, the configuration continues using the currently configured value. - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("thresholds") - public KeytermsStage thresholds(@NotNull ListenV2ConfigureSuccessThresholds thresholds) { - this.thresholds = Objects.requireNonNull(thresholds, "thresholds must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("keyterms") - public SequenceIdStage keyterms(@NotNull ListenV2Keyterm keyterms) { - this.keyterms = Objects.requireNonNull(keyterms, "keyterms must not be null"); - return this; - } - - /** - * Starts at 0 and increments for each message the server sends to the client. This - * includes messages of other types, like TurnInfo messages. - * - *

Starts at 0 and increments for each message the server sends to the client. - * This includes messages of other types, like TurnInfo messages. - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("sequence_id") - public _FinalStage sequenceId(double sequenceId) { - this.sequenceId = sequenceId; - return this; - } - - @java.lang.Override - public ListenV2ConfigureSuccess build() { - return new ListenV2ConfigureSuccess( - requestId, thresholds, keyterms, sequenceId, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/listen/v2/types/ListenV2ConfigureSuccessThresholds.java b/src/main/java/resources/listen/v2/types/ListenV2ConfigureSuccessThresholds.java deleted file mode 100644 index 0b73f72..0000000 --- a/src/main/java/resources/listen/v2/types/ListenV2ConfigureSuccessThresholds.java +++ /dev/null @@ -1,157 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v2.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 core.ObjectMappers; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import types.ListenV2EagerEotThreshold; -import types.ListenV2EotThreshold; -import types.ListenV2EotTimeoutMs; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = ListenV2ConfigureSuccessThresholds.Builder.class) -public final class ListenV2ConfigureSuccessThresholds { - private final Optional eagerEotThreshold; - - private final Optional eotThreshold; - - private final Optional eotTimeoutMs; - - private final Map additionalProperties; - - private ListenV2ConfigureSuccessThresholds( - Optional eagerEotThreshold, - Optional eotThreshold, - Optional eotTimeoutMs, - Map additionalProperties) { - this.eagerEotThreshold = eagerEotThreshold; - this.eotThreshold = eotThreshold; - this.eotTimeoutMs = eotTimeoutMs; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("eager_eot_threshold") - public Optional getEagerEotThreshold() { - return eagerEotThreshold; - } - - @JsonProperty("eot_threshold") - public Optional getEotThreshold() { - return eotThreshold; - } - - @JsonProperty("eot_timeout_ms") - public Optional getEotTimeoutMs() { - return eotTimeoutMs; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListenV2ConfigureSuccessThresholds - && equalTo((ListenV2ConfigureSuccessThresholds) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListenV2ConfigureSuccessThresholds other) { - return eagerEotThreshold.equals(other.eagerEotThreshold) - && eotThreshold.equals(other.eotThreshold) - && eotTimeoutMs.equals(other.eotTimeoutMs); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.eagerEotThreshold, this.eotThreshold, this.eotTimeoutMs); - } - - @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 eagerEotThreshold = Optional.empty(); - - private Optional eotThreshold = Optional.empty(); - - private Optional eotTimeoutMs = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListenV2ConfigureSuccessThresholds other) { - eagerEotThreshold(other.getEagerEotThreshold()); - eotThreshold(other.getEotThreshold()); - eotTimeoutMs(other.getEotTimeoutMs()); - return this; - } - - @JsonSetter(value = "eager_eot_threshold", nulls = Nulls.SKIP) - public Builder eagerEotThreshold(Optional eagerEotThreshold) { - this.eagerEotThreshold = eagerEotThreshold; - return this; - } - - public Builder eagerEotThreshold(ListenV2EagerEotThreshold eagerEotThreshold) { - this.eagerEotThreshold = Optional.ofNullable(eagerEotThreshold); - return this; - } - - @JsonSetter(value = "eot_threshold", nulls = Nulls.SKIP) - public Builder eotThreshold(Optional eotThreshold) { - this.eotThreshold = eotThreshold; - return this; - } - - public Builder eotThreshold(ListenV2EotThreshold eotThreshold) { - this.eotThreshold = Optional.ofNullable(eotThreshold); - return this; - } - - @JsonSetter(value = "eot_timeout_ms", nulls = Nulls.SKIP) - public Builder eotTimeoutMs(Optional eotTimeoutMs) { - this.eotTimeoutMs = eotTimeoutMs; - return this; - } - - public Builder eotTimeoutMs(ListenV2EotTimeoutMs eotTimeoutMs) { - this.eotTimeoutMs = Optional.ofNullable(eotTimeoutMs); - return this; - } - - public ListenV2ConfigureSuccessThresholds build() { - return new ListenV2ConfigureSuccessThresholds( - eagerEotThreshold, eotThreshold, eotTimeoutMs, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/listen/v2/types/ListenV2ConfigureThresholds.java b/src/main/java/resources/listen/v2/types/ListenV2ConfigureThresholds.java deleted file mode 100644 index c3c7dd6..0000000 --- a/src/main/java/resources/listen/v2/types/ListenV2ConfigureThresholds.java +++ /dev/null @@ -1,157 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v2.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 core.ObjectMappers; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import types.ListenV2EagerEotThreshold; -import types.ListenV2EotThreshold; -import types.ListenV2EotTimeoutMs; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = ListenV2ConfigureThresholds.Builder.class) -public final class ListenV2ConfigureThresholds { - private final Optional eagerEotThreshold; - - private final Optional eotThreshold; - - private final Optional eotTimeoutMs; - - private final Map additionalProperties; - - private ListenV2ConfigureThresholds( - Optional eagerEotThreshold, - Optional eotThreshold, - Optional eotTimeoutMs, - Map additionalProperties) { - this.eagerEotThreshold = eagerEotThreshold; - this.eotThreshold = eotThreshold; - this.eotTimeoutMs = eotTimeoutMs; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("eager_eot_threshold") - public Optional getEagerEotThreshold() { - return eagerEotThreshold; - } - - @JsonProperty("eot_threshold") - public Optional getEotThreshold() { - return eotThreshold; - } - - @JsonProperty("eot_timeout_ms") - public Optional getEotTimeoutMs() { - return eotTimeoutMs; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListenV2ConfigureThresholds - && equalTo((ListenV2ConfigureThresholds) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListenV2ConfigureThresholds other) { - return eagerEotThreshold.equals(other.eagerEotThreshold) - && eotThreshold.equals(other.eotThreshold) - && eotTimeoutMs.equals(other.eotTimeoutMs); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.eagerEotThreshold, this.eotThreshold, this.eotTimeoutMs); - } - - @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 eagerEotThreshold = Optional.empty(); - - private Optional eotThreshold = Optional.empty(); - - private Optional eotTimeoutMs = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListenV2ConfigureThresholds other) { - eagerEotThreshold(other.getEagerEotThreshold()); - eotThreshold(other.getEotThreshold()); - eotTimeoutMs(other.getEotTimeoutMs()); - return this; - } - - @JsonSetter(value = "eager_eot_threshold", nulls = Nulls.SKIP) - public Builder eagerEotThreshold(Optional eagerEotThreshold) { - this.eagerEotThreshold = eagerEotThreshold; - return this; - } - - public Builder eagerEotThreshold(ListenV2EagerEotThreshold eagerEotThreshold) { - this.eagerEotThreshold = Optional.ofNullable(eagerEotThreshold); - return this; - } - - @JsonSetter(value = "eot_threshold", nulls = Nulls.SKIP) - public Builder eotThreshold(Optional eotThreshold) { - this.eotThreshold = eotThreshold; - return this; - } - - public Builder eotThreshold(ListenV2EotThreshold eotThreshold) { - this.eotThreshold = Optional.ofNullable(eotThreshold); - return this; - } - - @JsonSetter(value = "eot_timeout_ms", nulls = Nulls.SKIP) - public Builder eotTimeoutMs(Optional eotTimeoutMs) { - this.eotTimeoutMs = eotTimeoutMs; - return this; - } - - public Builder eotTimeoutMs(ListenV2EotTimeoutMs eotTimeoutMs) { - this.eotTimeoutMs = Optional.ofNullable(eotTimeoutMs); - return this; - } - - public ListenV2ConfigureThresholds build() { - return new ListenV2ConfigureThresholds( - eagerEotThreshold, eotThreshold, eotTimeoutMs, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/listen/v2/types/ListenV2Connected.java b/src/main/java/resources/listen/v2/types/ListenV2Connected.java deleted file mode 100644 index a4119b0..0000000 --- a/src/main/java/resources/listen/v2/types/ListenV2Connected.java +++ /dev/null @@ -1,174 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v2.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListenV2Connected.Builder.class) -public final class ListenV2Connected { - private final String requestId; - - private final double sequenceId; - - private final Map additionalProperties; - - private ListenV2Connected( - String requestId, double sequenceId, Map additionalProperties) { - this.requestId = requestId; - this.sequenceId = sequenceId; - this.additionalProperties = additionalProperties; - } - - /** - * @return Message type identifier - */ - @JsonProperty("type") - public String getType() { - return "Connected"; - } - - /** - * @return The unique identifier of the request - */ - @JsonProperty("request_id") - public String getRequestId() { - return requestId; - } - - /** - * @return Starts at 0 and increments for each message the server sends to the - * client. This includes messages of other types, like TurnInfo messages. - */ - @JsonProperty("sequence_id") - public double getSequenceId() { - return sequenceId; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListenV2Connected && equalTo((ListenV2Connected) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListenV2Connected other) { - return requestId.equals(other.requestId) && sequenceId == other.sequenceId; - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.requestId, this.sequenceId); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static RequestIdStage builder() { - return new Builder(); - } - - public interface RequestIdStage { - /** The unique identifier of the request */ - SequenceIdStage requestId(@NotNull String requestId); - - Builder from(ListenV2Connected other); - } - - public interface SequenceIdStage { - /** - * Starts at 0 and increments for each message the server sends to the client. This - * includes messages of other types, like TurnInfo messages. - */ - _FinalStage sequenceId(double sequenceId); - } - - public interface _FinalStage { - ListenV2Connected build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements RequestIdStage, SequenceIdStage, _FinalStage { - private String requestId; - - private double sequenceId; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(ListenV2Connected other) { - requestId(other.getRequestId()); - sequenceId(other.getSequenceId()); - return this; - } - - /** - * The unique identifier of the request - * - *

The unique identifier of the request - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("request_id") - public SequenceIdStage requestId(@NotNull String requestId) { - this.requestId = Objects.requireNonNull(requestId, "requestId must not be null"); - return this; - } - - /** - * Starts at 0 and increments for each message the server sends to the client. This - * includes messages of other types, like TurnInfo messages. - * - *

Starts at 0 and increments for each message the server sends to the client. - * This includes messages of other types, like TurnInfo messages. - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("sequence_id") - public _FinalStage sequenceId(double sequenceId) { - this.sequenceId = sequenceId; - return this; - } - - @java.lang.Override - public ListenV2Connected build() { - return new ListenV2Connected(requestId, sequenceId, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/listen/v2/types/ListenV2FatalError.java b/src/main/java/resources/listen/v2/types/ListenV2FatalError.java deleted file mode 100644 index 9b2ee7f..0000000 --- a/src/main/java/resources/listen/v2/types/ListenV2FatalError.java +++ /dev/null @@ -1,213 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v2.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListenV2FatalError.Builder.class) -public final class ListenV2FatalError { - private final double sequenceId; - - private final String code; - - private final String description; - - private final Map additionalProperties; - - private ListenV2FatalError( - double sequenceId, - String code, - String description, - Map additionalProperties) { - this.sequenceId = sequenceId; - this.code = code; - this.description = description; - this.additionalProperties = additionalProperties; - } - - /** - * @return Message type identifier - */ - @JsonProperty("type") - public String getType() { - return "Error"; - } - - /** - * @return Starts at 0 and increments for each message the server sends to the - * client. This includes messages of other types, like Connected messages. - */ - @JsonProperty("sequence_id") - public double getSequenceId() { - return sequenceId; - } - - /** - * @return A string code describing the error, e.g. INTERNAL_SERVER_ERROR - */ - @JsonProperty("code") - public String getCode() { - return code; - } - - /** - * @return Prose description of the error - */ - @JsonProperty("description") - public String getDescription() { - return description; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListenV2FatalError && equalTo((ListenV2FatalError) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListenV2FatalError other) { - return sequenceId == other.sequenceId - && code.equals(other.code) - && description.equals(other.description); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.sequenceId, this.code, this.description); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static SequenceIdStage builder() { - return new Builder(); - } - - public interface SequenceIdStage { - /** - * Starts at 0 and increments for each message the server sends to the client. This - * includes messages of other types, like Connected messages. - */ - CodeStage sequenceId(double sequenceId); - - Builder from(ListenV2FatalError other); - } - - public interface CodeStage { - /** A string code describing the error, e.g. INTERNAL_SERVER_ERROR */ - DescriptionStage code(@NotNull String code); - } - - public interface DescriptionStage { - /** Prose description of the error */ - _FinalStage description(@NotNull String description); - } - - public interface _FinalStage { - ListenV2FatalError build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements SequenceIdStage, CodeStage, DescriptionStage, _FinalStage { - private double sequenceId; - - private String code; - - private String description; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(ListenV2FatalError other) { - sequenceId(other.getSequenceId()); - code(other.getCode()); - description(other.getDescription()); - return this; - } - - /** - * Starts at 0 and increments for each message the server sends to the client. This - * includes messages of other types, like Connected messages. - * - *

Starts at 0 and increments for each message the server sends to the client. - * This includes messages of other types, like Connected messages. - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("sequence_id") - public CodeStage sequenceId(double sequenceId) { - this.sequenceId = sequenceId; - return this; - } - - /** - * A string code describing the error, e.g. INTERNAL_SERVER_ERROR - * - *

A string code describing the error, e.g. INTERNAL_SERVER_ERROR - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("code") - public DescriptionStage code(@NotNull String code) { - this.code = Objects.requireNonNull(code, "code must not be null"); - return this; - } - - /** - * Prose description of the error - * - *

Prose description of the error - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("description") - public _FinalStage description(@NotNull String description) { - this.description = Objects.requireNonNull(description, "description must not be null"); - return this; - } - - @java.lang.Override - public ListenV2FatalError build() { - return new ListenV2FatalError(sequenceId, code, description, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/listen/v2/types/ListenV2TurnInfo.java b/src/main/java/resources/listen/v2/types/ListenV2TurnInfo.java deleted file mode 100644 index 3277dde..0000000 --- a/src/main/java/resources/listen/v2/types/ListenV2TurnInfo.java +++ /dev/null @@ -1,530 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v2.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListenV2TurnInfo.Builder.class) -public final class ListenV2TurnInfo { - private final String requestId; - - private final double sequenceId; - - private final ListenV2TurnInfoEvent event; - - private final double turnIndex; - - private final float audioWindowStart; - - private final float audioWindowEnd; - - private final String transcript; - - private final List words; - - private final float endOfTurnConfidence; - - private final Map additionalProperties; - - private ListenV2TurnInfo( - String requestId, - double sequenceId, - ListenV2TurnInfoEvent event, - double turnIndex, - float audioWindowStart, - float audioWindowEnd, - String transcript, - List words, - float endOfTurnConfidence, - Map additionalProperties) { - this.requestId = requestId; - this.sequenceId = sequenceId; - this.event = event; - this.turnIndex = turnIndex; - this.audioWindowStart = audioWindowStart; - this.audioWindowEnd = audioWindowEnd; - this.transcript = transcript; - this.words = words; - this.endOfTurnConfidence = endOfTurnConfidence; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("type") - public String getType() { - return "TurnInfo"; - } - - /** - * @return The unique identifier of the request - */ - @JsonProperty("request_id") - public String getRequestId() { - return requestId; - } - - /** - * @return Starts at 0 and increments for each message the server sends to the - * client. This includes messages of other types, like Connected messages. - */ - @JsonProperty("sequence_id") - public double getSequenceId() { - return sequenceId; - } - - /** - * @return The type of event being reported. - *

    - *
  • Update - Additional audio has been transcribed, but the turn state - * hasn't changed - *
  • StartOfTurn - The user has begun speaking for the first time in the - * turn - *
  • EagerEndOfTurn - The system has moderate confidence that the user - * has finished speaking for the turn. This is an opportunity to begin preparing an - * agent reply - *
  • TurnResumed - The system detected that speech had ended and - * therefore sent an EagerEndOfTurn event, but speech is actually - * continuing for this turn - *
  • EndOfTurn - The user has finished speaking for the turn - *
- */ - @JsonProperty("event") - public ListenV2TurnInfoEvent getEvent() { - return event; - } - - /** - * @return The index of the current turn - */ - @JsonProperty("turn_index") - public double getTurnIndex() { - return turnIndex; - } - - /** - * @return Start time in seconds of the audio range that was transcribed - */ - @JsonProperty("audio_window_start") - public float getAudioWindowStart() { - return audioWindowStart; - } - - /** - * @return End time in seconds of the audio range that was transcribed - */ - @JsonProperty("audio_window_end") - public float getAudioWindowEnd() { - return audioWindowEnd; - } - - /** - * @return Text that was said over the course of the current turn - */ - @JsonProperty("transcript") - public String getTranscript() { - return transcript; - } - - /** - * @return The words in the transcript - */ - @JsonProperty("words") - public List getWords() { - return words; - } - - /** - * @return Confidence that no more speech is coming in this turn - */ - @JsonProperty("end_of_turn_confidence") - public float getEndOfTurnConfidence() { - return endOfTurnConfidence; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListenV2TurnInfo && equalTo((ListenV2TurnInfo) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListenV2TurnInfo other) { - return requestId.equals(other.requestId) - && sequenceId == other.sequenceId - && event.equals(other.event) - && turnIndex == other.turnIndex - && audioWindowStart == other.audioWindowStart - && audioWindowEnd == other.audioWindowEnd - && transcript.equals(other.transcript) - && words.equals(other.words) - && endOfTurnConfidence == other.endOfTurnConfidence; - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.requestId, - this.sequenceId, - this.event, - this.turnIndex, - this.audioWindowStart, - this.audioWindowEnd, - this.transcript, - this.words, - this.endOfTurnConfidence); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static RequestIdStage builder() { - return new Builder(); - } - - public interface RequestIdStage { - /** The unique identifier of the request */ - SequenceIdStage requestId(@NotNull String requestId); - - Builder from(ListenV2TurnInfo other); - } - - public interface SequenceIdStage { - /** - * Starts at 0 and increments for each message the server sends to the client. This - * includes messages of other types, like Connected messages. - */ - EventStage sequenceId(double sequenceId); - } - - public interface EventStage { - /** - * The type of event being reported. - * - *
    - *
  • Update - Additional audio has been transcribed, but the turn state - * hasn't changed - *
  • StartOfTurn - The user has begun speaking for the first time in the - * turn - *
  • EagerEndOfTurn - The system has moderate confidence that the user has - * finished speaking for the turn. This is an opportunity to begin preparing an agent - * reply - *
  • TurnResumed - The system detected that speech had ended and therefore - * sent an EagerEndOfTurn event, but speech is actually continuing for - * this turn - *
  • EndOfTurn - The user has finished speaking for the turn - *
- */ - TurnIndexStage event(@NotNull ListenV2TurnInfoEvent event); - } - - public interface TurnIndexStage { - /** The index of the current turn */ - AudioWindowStartStage turnIndex(double turnIndex); - } - - public interface AudioWindowStartStage { - /** Start time in seconds of the audio range that was transcribed */ - AudioWindowEndStage audioWindowStart(float audioWindowStart); - } - - public interface AudioWindowEndStage { - /** End time in seconds of the audio range that was transcribed */ - TranscriptStage audioWindowEnd(float audioWindowEnd); - } - - public interface TranscriptStage { - /** Text that was said over the course of the current turn */ - EndOfTurnConfidenceStage transcript(@NotNull String transcript); - } - - public interface EndOfTurnConfidenceStage { - /** Confidence that no more speech is coming in this turn */ - _FinalStage endOfTurnConfidence(float endOfTurnConfidence); - } - - public interface _FinalStage { - ListenV2TurnInfo build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** The words in the transcript */ - _FinalStage words(List words); - - _FinalStage addWords(ListenV2TurnInfoWordsItem words); - - _FinalStage addAllWords(List words); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements RequestIdStage, - SequenceIdStage, - EventStage, - TurnIndexStage, - AudioWindowStartStage, - AudioWindowEndStage, - TranscriptStage, - EndOfTurnConfidenceStage, - _FinalStage { - private String requestId; - - private double sequenceId; - - private ListenV2TurnInfoEvent event; - - private double turnIndex; - - private float audioWindowStart; - - private float audioWindowEnd; - - private String transcript; - - private float endOfTurnConfidence; - - private List words = new ArrayList<>(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(ListenV2TurnInfo other) { - requestId(other.getRequestId()); - sequenceId(other.getSequenceId()); - event(other.getEvent()); - turnIndex(other.getTurnIndex()); - audioWindowStart(other.getAudioWindowStart()); - audioWindowEnd(other.getAudioWindowEnd()); - transcript(other.getTranscript()); - words(other.getWords()); - endOfTurnConfidence(other.getEndOfTurnConfidence()); - return this; - } - - /** - * The unique identifier of the request - * - *

The unique identifier of the request - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("request_id") - public SequenceIdStage requestId(@NotNull String requestId) { - this.requestId = Objects.requireNonNull(requestId, "requestId must not be null"); - return this; - } - - /** - * Starts at 0 and increments for each message the server sends to the client. This - * includes messages of other types, like Connected messages. - * - *

Starts at 0 and increments for each message the server sends to the client. - * This includes messages of other types, like Connected messages. - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("sequence_id") - public EventStage sequenceId(double sequenceId) { - this.sequenceId = sequenceId; - return this; - } - - /** - * The type of event being reported. - * - *

    - *
  • Update - Additional audio has been transcribed, but the turn state - * hasn't changed - *
  • StartOfTurn - The user has begun speaking for the first time in the - * turn - *
  • EagerEndOfTurn - The system has moderate confidence that the user has - * finished speaking for the turn. This is an opportunity to begin preparing an agent - * reply - *
  • TurnResumed - The system detected that speech had ended and therefore - * sent an EagerEndOfTurn event, but speech is actually continuing for - * this turn - *
  • EndOfTurn - The user has finished speaking for the turn - *
- * - *

The type of event being reported. - * - *

    - *
  • Update - Additional audio has been transcribed, but the turn state - * hasn't changed - *
  • StartOfTurn - The user has begun speaking for the first time in the - * turn - *
  • EagerEndOfTurn - The system has moderate confidence that the user has - * finished speaking for the turn. This is an opportunity to begin preparing an agent - * reply - *
  • TurnResumed - The system detected that speech had ended and therefore - * sent an EagerEndOfTurn event, but speech is actually continuing for - * this turn - *
  • EndOfTurn - The user has finished speaking for the turn - *
- * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("event") - public TurnIndexStage event(@NotNull ListenV2TurnInfoEvent event) { - this.event = Objects.requireNonNull(event, "event must not be null"); - return this; - } - - /** - * The index of the current turn - * - *

The index of the current turn - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("turn_index") - public AudioWindowStartStage turnIndex(double turnIndex) { - this.turnIndex = turnIndex; - return this; - } - - /** - * Start time in seconds of the audio range that was transcribed - * - *

Start time in seconds of the audio range that was transcribed - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("audio_window_start") - public AudioWindowEndStage audioWindowStart(float audioWindowStart) { - this.audioWindowStart = audioWindowStart; - return this; - } - - /** - * End time in seconds of the audio range that was transcribed - * - *

End time in seconds of the audio range that was transcribed - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("audio_window_end") - public TranscriptStage audioWindowEnd(float audioWindowEnd) { - this.audioWindowEnd = audioWindowEnd; - return this; - } - - /** - * Text that was said over the course of the current turn - * - *

Text that was said over the course of the current turn - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("transcript") - public EndOfTurnConfidenceStage transcript(@NotNull String transcript) { - this.transcript = Objects.requireNonNull(transcript, "transcript must not be null"); - return this; - } - - /** - * Confidence that no more speech is coming in this turn - * - *

Confidence that no more speech is coming in this turn - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("end_of_turn_confidence") - public _FinalStage endOfTurnConfidence(float endOfTurnConfidence) { - this.endOfTurnConfidence = endOfTurnConfidence; - return this; - } - - /** - * The words in the transcript - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage addAllWords(List words) { - if (words != null) { - this.words.addAll(words); - } - return this; - } - - /** - * The words in the transcript - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage addWords(ListenV2TurnInfoWordsItem words) { - this.words.add(words); - return this; - } - - /** The words in the transcript */ - @java.lang.Override - @JsonSetter(value = "words", nulls = Nulls.SKIP) - public _FinalStage words(List words) { - this.words.clear(); - if (words != null) { - this.words.addAll(words); - } - return this; - } - - @java.lang.Override - public ListenV2TurnInfo build() { - return new ListenV2TurnInfo( - requestId, - sequenceId, - event, - turnIndex, - audioWindowStart, - audioWindowEnd, - transcript, - words, - endOfTurnConfidence, - additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/listen/v2/types/ListenV2TurnInfoEvent.java b/src/main/java/resources/listen/v2/types/ListenV2TurnInfoEvent.java deleted file mode 100644 index aa5ca23..0000000 --- a/src/main/java/resources/listen/v2/types/ListenV2TurnInfoEvent.java +++ /dev/null @@ -1,117 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v2.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class ListenV2TurnInfoEvent { - public static final ListenV2TurnInfoEvent EAGER_END_OF_TURN = - new ListenV2TurnInfoEvent(Value.EAGER_END_OF_TURN, "EagerEndOfTurn"); - - public static final ListenV2TurnInfoEvent UPDATE = - new ListenV2TurnInfoEvent(Value.UPDATE, "Update"); - - public static final ListenV2TurnInfoEvent START_OF_TURN = - new ListenV2TurnInfoEvent(Value.START_OF_TURN, "StartOfTurn"); - - public static final ListenV2TurnInfoEvent END_OF_TURN = - new ListenV2TurnInfoEvent(Value.END_OF_TURN, "EndOfTurn"); - - public static final ListenV2TurnInfoEvent TURN_RESUMED = - new ListenV2TurnInfoEvent(Value.TURN_RESUMED, "TurnResumed"); - - private final Value value; - - private final String string; - - ListenV2TurnInfoEvent(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof ListenV2TurnInfoEvent - && this.string.equals(((ListenV2TurnInfoEvent) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case EAGER_END_OF_TURN: - return visitor.visitEagerEndOfTurn(); - case UPDATE: - return visitor.visitUpdate(); - case START_OF_TURN: - return visitor.visitStartOfTurn(); - case END_OF_TURN: - return visitor.visitEndOfTurn(); - case TURN_RESUMED: - return visitor.visitTurnResumed(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListenV2TurnInfoEvent valueOf(String value) { - switch (value) { - case "EagerEndOfTurn": - return EAGER_END_OF_TURN; - case "Update": - return UPDATE; - case "StartOfTurn": - return START_OF_TURN; - case "EndOfTurn": - return END_OF_TURN; - case "TurnResumed": - return TURN_RESUMED; - default: - return new ListenV2TurnInfoEvent(Value.UNKNOWN, value); - } - } - - public enum Value { - UPDATE, - - START_OF_TURN, - - EAGER_END_OF_TURN, - - TURN_RESUMED, - - END_OF_TURN, - - UNKNOWN - } - - public interface Visitor { - T visitUpdate(); - - T visitStartOfTurn(); - - T visitEagerEndOfTurn(); - - T visitTurnResumed(); - - T visitEndOfTurn(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/resources/listen/v2/types/ListenV2TurnInfoWordsItem.java b/src/main/java/resources/listen/v2/types/ListenV2TurnInfoWordsItem.java deleted file mode 100644 index 5190d09..0000000 --- a/src/main/java/resources/listen/v2/types/ListenV2TurnInfoWordsItem.java +++ /dev/null @@ -1,160 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v2.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListenV2TurnInfoWordsItem.Builder.class) -public final class ListenV2TurnInfoWordsItem { - private final String word; - - private final float confidence; - - private final Map additionalProperties; - - private ListenV2TurnInfoWordsItem( - String word, float confidence, Map additionalProperties) { - this.word = word; - this.confidence = confidence; - this.additionalProperties = additionalProperties; - } - - /** - * @return The individual punctuated, properly-cased word from the transcript - */ - @JsonProperty("word") - public String getWord() { - return word; - } - - /** - * @return Confidence that this word was transcribed correctly - */ - @JsonProperty("confidence") - public float getConfidence() { - return confidence; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListenV2TurnInfoWordsItem && equalTo((ListenV2TurnInfoWordsItem) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListenV2TurnInfoWordsItem other) { - return word.equals(other.word) && confidence == other.confidence; - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.word, this.confidence); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static WordStage builder() { - return new Builder(); - } - - public interface WordStage { - /** The individual punctuated, properly-cased word from the transcript */ - ConfidenceStage word(@NotNull String word); - - Builder from(ListenV2TurnInfoWordsItem other); - } - - public interface ConfidenceStage { - /** Confidence that this word was transcribed correctly */ - _FinalStage confidence(float confidence); - } - - public interface _FinalStage { - ListenV2TurnInfoWordsItem build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements WordStage, ConfidenceStage, _FinalStage { - private String word; - - private float confidence; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(ListenV2TurnInfoWordsItem other) { - word(other.getWord()); - confidence(other.getConfidence()); - return this; - } - - /** - * The individual punctuated, properly-cased word from the transcript - * - *

The individual punctuated, properly-cased word from the transcript - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("word") - public ConfidenceStage word(@NotNull String word) { - this.word = Objects.requireNonNull(word, "word must not be null"); - return this; - } - - /** - * Confidence that this word was transcribed correctly - * - *

Confidence that this word was transcribed correctly - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("confidence") - public _FinalStage confidence(float confidence) { - this.confidence = confidence; - return this; - } - - @java.lang.Override - public ListenV2TurnInfoWordsItem build() { - return new ListenV2TurnInfoWordsItem(word, confidence, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/listen/v2/websocket/V2ConnectOptions.java b/src/main/java/resources/listen/v2/websocket/V2ConnectOptions.java deleted file mode 100644 index 30ebde5..0000000 --- a/src/main/java/resources/listen/v2/websocket/V2ConnectOptions.java +++ /dev/null @@ -1,386 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v2.websocket; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 core.ObjectMappers; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.jetbrains.annotations.NotNull; -import types.ListenV2EagerEotThreshold; -import types.ListenV2Encoding; -import types.ListenV2EotThreshold; -import types.ListenV2EotTimeoutMs; -import types.ListenV2Keyterm; -import types.ListenV2MipOptOut; -import types.ListenV2SampleRate; -import types.ListenV2Tag; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = V2ConnectOptions.Builder.class) -public final class V2ConnectOptions { - private final String model; - - private final Optional encoding; - - private final Optional sampleRate; - - private final Optional eagerEotThreshold; - - private final Optional eotThreshold; - - private final Optional eotTimeoutMs; - - private final Optional keyterm; - - private final Optional mipOptOut; - - private final Optional tag; - - private final Map additionalProperties; - - private V2ConnectOptions( - String model, - Optional encoding, - Optional sampleRate, - Optional eagerEotThreshold, - Optional eotThreshold, - Optional eotTimeoutMs, - Optional keyterm, - Optional mipOptOut, - Optional tag, - Map additionalProperties) { - this.model = model; - this.encoding = encoding; - this.sampleRate = sampleRate; - this.eagerEotThreshold = eagerEotThreshold; - this.eotThreshold = eotThreshold; - this.eotTimeoutMs = eotTimeoutMs; - this.keyterm = keyterm; - this.mipOptOut = mipOptOut; - this.tag = tag; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("model") - public String getModel() { - return model; - } - - @JsonProperty("encoding") - public Optional getEncoding() { - return encoding; - } - - @JsonProperty("sample_rate") - public Optional getSampleRate() { - return sampleRate; - } - - @JsonProperty("eager_eot_threshold") - public Optional getEagerEotThreshold() { - return eagerEotThreshold; - } - - @JsonProperty("eot_threshold") - public Optional getEotThreshold() { - return eotThreshold; - } - - @JsonProperty("eot_timeout_ms") - public Optional getEotTimeoutMs() { - return eotTimeoutMs; - } - - @JsonProperty("keyterm") - public Optional getKeyterm() { - return keyterm; - } - - @JsonProperty("mip_opt_out") - public Optional getMipOptOut() { - return mipOptOut; - } - - @JsonProperty("tag") - public Optional getTag() { - return tag; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof V2ConnectOptions && equalTo((V2ConnectOptions) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(V2ConnectOptions other) { - return model.equals(other.model) - && encoding.equals(other.encoding) - && sampleRate.equals(other.sampleRate) - && eagerEotThreshold.equals(other.eagerEotThreshold) - && eotThreshold.equals(other.eotThreshold) - && eotTimeoutMs.equals(other.eotTimeoutMs) - && keyterm.equals(other.keyterm) - && mipOptOut.equals(other.mipOptOut) - && tag.equals(other.tag); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.model, - this.encoding, - this.sampleRate, - this.eagerEotThreshold, - this.eotThreshold, - this.eotTimeoutMs, - this.keyterm, - this.mipOptOut, - this.tag); - } - - @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(V2ConnectOptions other); - } - - public interface _FinalStage { - V2ConnectOptions build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - _FinalStage encoding(Optional encoding); - - _FinalStage encoding(ListenV2Encoding encoding); - - _FinalStage sampleRate(Optional sampleRate); - - _FinalStage sampleRate(ListenV2SampleRate sampleRate); - - _FinalStage eagerEotThreshold(Optional eagerEotThreshold); - - _FinalStage eagerEotThreshold(ListenV2EagerEotThreshold eagerEotThreshold); - - _FinalStage eotThreshold(Optional eotThreshold); - - _FinalStage eotThreshold(ListenV2EotThreshold eotThreshold); - - _FinalStage eotTimeoutMs(Optional eotTimeoutMs); - - _FinalStage eotTimeoutMs(ListenV2EotTimeoutMs eotTimeoutMs); - - _FinalStage keyterm(Optional keyterm); - - _FinalStage keyterm(ListenV2Keyterm keyterm); - - _FinalStage mipOptOut(Optional mipOptOut); - - _FinalStage mipOptOut(ListenV2MipOptOut mipOptOut); - - _FinalStage tag(Optional tag); - - _FinalStage tag(ListenV2Tag tag); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements ModelStage, _FinalStage { - private String model; - - private Optional tag = Optional.empty(); - - private Optional mipOptOut = Optional.empty(); - - private Optional keyterm = Optional.empty(); - - private Optional eotTimeoutMs = Optional.empty(); - - private Optional eotThreshold = Optional.empty(); - - private Optional eagerEotThreshold = Optional.empty(); - - private Optional sampleRate = Optional.empty(); - - private Optional encoding = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(V2ConnectOptions other) { - model(other.getModel()); - encoding(other.getEncoding()); - sampleRate(other.getSampleRate()); - eagerEotThreshold(other.getEagerEotThreshold()); - eotThreshold(other.getEotThreshold()); - eotTimeoutMs(other.getEotTimeoutMs()); - keyterm(other.getKeyterm()); - mipOptOut(other.getMipOptOut()); - tag(other.getTag()); - return this; - } - - @java.lang.Override - @JsonSetter("model") - public _FinalStage model(@NotNull String model) { - this.model = Objects.requireNonNull(model, "model must not be null"); - return this; - } - - @java.lang.Override - public _FinalStage tag(ListenV2Tag 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 _FinalStage mipOptOut(ListenV2MipOptOut mipOptOut) { - this.mipOptOut = Optional.ofNullable(mipOptOut); - return this; - } - - @java.lang.Override - @JsonSetter(value = "mip_opt_out", nulls = Nulls.SKIP) - public _FinalStage mipOptOut(Optional mipOptOut) { - this.mipOptOut = mipOptOut; - return this; - } - - @java.lang.Override - public _FinalStage keyterm(ListenV2Keyterm keyterm) { - this.keyterm = Optional.ofNullable(keyterm); - return this; - } - - @java.lang.Override - @JsonSetter(value = "keyterm", nulls = Nulls.SKIP) - public _FinalStage keyterm(Optional keyterm) { - this.keyterm = keyterm; - return this; - } - - @java.lang.Override - public _FinalStage eotTimeoutMs(ListenV2EotTimeoutMs eotTimeoutMs) { - this.eotTimeoutMs = Optional.ofNullable(eotTimeoutMs); - return this; - } - - @java.lang.Override - @JsonSetter(value = "eot_timeout_ms", nulls = Nulls.SKIP) - public _FinalStage eotTimeoutMs(Optional eotTimeoutMs) { - this.eotTimeoutMs = eotTimeoutMs; - return this; - } - - @java.lang.Override - public _FinalStage eotThreshold(ListenV2EotThreshold eotThreshold) { - this.eotThreshold = Optional.ofNullable(eotThreshold); - return this; - } - - @java.lang.Override - @JsonSetter(value = "eot_threshold", nulls = Nulls.SKIP) - public _FinalStage eotThreshold(Optional eotThreshold) { - this.eotThreshold = eotThreshold; - return this; - } - - @java.lang.Override - public _FinalStage eagerEotThreshold(ListenV2EagerEotThreshold eagerEotThreshold) { - this.eagerEotThreshold = Optional.ofNullable(eagerEotThreshold); - return this; - } - - @java.lang.Override - @JsonSetter(value = "eager_eot_threshold", nulls = Nulls.SKIP) - public _FinalStage eagerEotThreshold(Optional eagerEotThreshold) { - this.eagerEotThreshold = eagerEotThreshold; - return this; - } - - @java.lang.Override - public _FinalStage sampleRate(ListenV2SampleRate sampleRate) { - this.sampleRate = Optional.ofNullable(sampleRate); - return this; - } - - @java.lang.Override - @JsonSetter(value = "sample_rate", nulls = Nulls.SKIP) - public _FinalStage sampleRate(Optional sampleRate) { - this.sampleRate = sampleRate; - return this; - } - - @java.lang.Override - public _FinalStage encoding(ListenV2Encoding encoding) { - this.encoding = Optional.ofNullable(encoding); - return this; - } - - @java.lang.Override - @JsonSetter(value = "encoding", nulls = Nulls.SKIP) - public _FinalStage encoding(Optional encoding) { - this.encoding = encoding; - return this; - } - - @java.lang.Override - public V2ConnectOptions build() { - return new V2ConnectOptions( - model, - encoding, - sampleRate, - eagerEotThreshold, - eotThreshold, - eotTimeoutMs, - keyterm, - mipOptOut, - tag, - additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/listen/v2/websocket/V2WebSocketClient.java b/src/main/java/resources/listen/v2/websocket/V2WebSocketClient.java deleted file mode 100644 index c4c41e9..0000000 --- a/src/main/java/resources/listen/v2/websocket/V2WebSocketClient.java +++ /dev/null @@ -1,449 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.listen.v2.websocket; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import core.ClientOptions; -import core.DisconnectReason; -import core.ObjectMappers; -import core.ReconnectingWebSocketListener; -import core.WebSocketReadyState; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ScheduledExecutorService; -import java.util.function.Consumer; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import okhttp3.WebSocket; -import okio.ByteString; -import resources.listen.v2.types.ListenV2CloseStream; -import resources.listen.v2.types.ListenV2Configure; -import resources.listen.v2.types.ListenV2ConfigureFailure; -import resources.listen.v2.types.ListenV2ConfigureSuccess; -import resources.listen.v2.types.ListenV2Connected; -import resources.listen.v2.types.ListenV2FatalError; -import resources.listen.v2.types.ListenV2TurnInfo; - -/** - * WebSocket client for the v2 channel. Provides real-time bidirectional communication with - * strongly-typed messages. - */ -public class V2WebSocketClient implements AutoCloseable { - protected final ClientOptions clientOptions; - - private final ObjectMapper objectMapper; - - private final OkHttpClient okHttpClient; - - private ScheduledExecutorService timeoutExecutor; - - private volatile WebSocketReadyState readyState = WebSocketReadyState.CLOSED; - - private volatile Runnable onConnectedHandler; - - private volatile Consumer onDisconnectedHandler; - - private volatile Consumer onErrorHandler; - - private volatile Consumer onMessageHandler; - - private volatile ReconnectingWebSocketListener.ReconnectOptions reconnectOptions; - - private CompletableFuture connectionFuture; - - private ReconnectingWebSocketListener reconnectingListener; - - private volatile Consumer connectedHandler; - - private volatile Consumer turnInfoHandler; - - private volatile Consumer configureSuccessHandler; - - private volatile Consumer configureFailureHandler; - - private volatile Consumer errorHandler; - - /** Creates a new async WebSocket client for the v2 channel. */ - public V2WebSocketClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.objectMapper = ObjectMappers.JSON_MAPPER; - this.okHttpClient = clientOptions.httpClient(); - } - - /** - * Establishes the WebSocket connection asynchronously with automatic reconnection. - * - * @return a CompletableFuture that completes when the connection is established - * @param options connection options including query parameters - */ - public CompletableFuture connect(V2ConnectOptions options) { - connectionFuture = new CompletableFuture<>(); - String baseUrl = clientOptions.environment().getProductionURL(); - String fullPath = "/v2/listen"; - if (baseUrl.endsWith("/") && fullPath.startsWith("/")) { - fullPath = fullPath.substring(1); - } else if (!baseUrl.endsWith("/") && !fullPath.startsWith("/")) { - fullPath = "/" + fullPath; - } - // OkHttp's HttpUrl only supports http/https schemes; convert wss/ws for URL parsing - if (baseUrl.startsWith("wss://")) { - baseUrl = "https://" + baseUrl.substring(6); - } else if (baseUrl.startsWith("ws://")) { - baseUrl = "http://" + baseUrl.substring(5); - } - HttpUrl parsedUrl = HttpUrl.parse(baseUrl + fullPath); - if (parsedUrl == null) { - throw new IllegalArgumentException("Invalid WebSocket URL: " + baseUrl + fullPath); - } - HttpUrl.Builder urlBuilder = parsedUrl.newBuilder(); - urlBuilder.addQueryParameter("model", String.valueOf(options.getModel())); - if (options.getEncoding() != null && options.getEncoding().isPresent()) { - urlBuilder.addQueryParameter("encoding", String.valueOf(options.getEncoding().get())); - } - if (options.getSampleRate() != null && options.getSampleRate().isPresent()) { - urlBuilder.addQueryParameter("sample_rate", String.valueOf(options.getSampleRate().get())); - } - if (options.getEagerEotThreshold() != null && options.getEagerEotThreshold().isPresent()) { - urlBuilder.addQueryParameter( - "eager_eot_threshold", String.valueOf(options.getEagerEotThreshold().get())); - } - if (options.getEotThreshold() != null && options.getEotThreshold().isPresent()) { - urlBuilder.addQueryParameter( - "eot_threshold", String.valueOf(options.getEotThreshold().get())); - } - if (options.getEotTimeoutMs() != null && options.getEotTimeoutMs().isPresent()) { - urlBuilder.addQueryParameter( - "eot_timeout_ms", String.valueOf(options.getEotTimeoutMs().get())); - } - if (options.getKeyterm() != null && options.getKeyterm().isPresent()) { - urlBuilder.addQueryParameter("keyterm", String.valueOf(options.getKeyterm().get())); - } - if (options.getMipOptOut() != null && options.getMipOptOut().isPresent()) { - urlBuilder.addQueryParameter("mip_opt_out", String.valueOf(options.getMipOptOut().get())); - } - if (options.getTag() != null && options.getTag().isPresent()) { - urlBuilder.addQueryParameter("tag", String.valueOf(options.getTag().get())); - } - Request.Builder requestBuilder = new Request.Builder().url(urlBuilder.build()); - clientOptions.headers(null).forEach(requestBuilder::addHeader); - final Request request = requestBuilder.build(); - this.readyState = WebSocketReadyState.CONNECTING; - ReconnectingWebSocketListener.ReconnectOptions reconnectOpts = - this.reconnectOptions != null - ? this.reconnectOptions - : ReconnectingWebSocketListener.ReconnectOptions.builder().build(); - this.reconnectingListener = - new ReconnectingWebSocketListener( - reconnectOpts, - () -> { - if (clientOptions.webSocketFactory().isPresent()) { - return clientOptions - .webSocketFactory() - .get() - .create(request, this.reconnectingListener); - } else { - return okHttpClient.newWebSocket(request, this.reconnectingListener); - } - }) { - @Override - protected void onWebSocketOpen(WebSocket webSocket, Response response) { - readyState = WebSocketReadyState.OPEN; - if (onConnectedHandler != null) { - onConnectedHandler.run(); - } - connectionFuture.complete(null); - } - - @Override - protected void onWebSocketMessage(WebSocket webSocket, String text) { - handleIncomingMessage(text); - } - - @Override - protected void onWebSocketBinaryMessage(WebSocket webSocket, ByteString bytes) {} - - @Override - protected void onWebSocketFailure(WebSocket webSocket, Throwable t, Response response) { - readyState = WebSocketReadyState.CLOSED; - if (onErrorHandler != null) { - onErrorHandler.accept(new RuntimeException(t)); - } - connectionFuture.completeExceptionally(t); - } - - @Override - protected void onWebSocketClosed(WebSocket webSocket, int code, String reason) { - readyState = WebSocketReadyState.CLOSED; - if (onDisconnectedHandler != null) { - onDisconnectedHandler.accept(new DisconnectReason(code, reason)); - } - } - }; - reconnectingListener.connect(); - return connectionFuture; - } - - /** Disconnects the WebSocket connection and releases resources. */ - public void disconnect() { - reconnectingListener.disconnect(); - if (timeoutExecutor != null) { - timeoutExecutor.shutdownNow(); - timeoutExecutor = null; - } - } - - /** - * Gets the current state of the WebSocket connection. - * - *

This provides the actual connection state, similar to the W3C WebSocket API. - * - * @return the current WebSocket ready state - */ - public WebSocketReadyState getReadyState() { - return readyState; - } - - /** - * Sends a ListenV2Media message to the server asynchronously. - * - * @param message the message to send - * @return a CompletableFuture that completes when the message is sent - */ - public CompletableFuture sendMedia(ByteString message) { - CompletableFuture future = new CompletableFuture<>(); - try { - assertSocketIsOpen(); - // Use reconnecting listener's sendBinary method which handles queuing - reconnectingListener.sendBinary(message); - future.complete(null); - } catch (Exception e) { - future.completeExceptionally(new RuntimeException("Failed to send binary data", e)); - } - return future; - } - - /** - * Sends a ListenV2CloseStream message to the server asynchronously. - * - * @param message the message to send - * @return a CompletableFuture that completes when the message is sent - */ - public CompletableFuture sendCloseStream(ListenV2CloseStream message) { - return sendMessage(message); - } - - /** - * Sends a ListenV2Configure message to the server asynchronously. - * - * @param message the message to send - * @return a CompletableFuture that completes when the message is sent - */ - public CompletableFuture sendListenV2Configure(ListenV2Configure message) { - return sendMessage(message); - } - - /** - * Registers a handler for ListenV2Connected messages from the server. - * - * @param handler the handler to invoke when a message is received - */ - public void onConnected(Consumer handler) { - this.connectedHandler = handler; - } - - /** - * Registers a handler for ListenV2TurnInfo messages from the server. - * - * @param handler the handler to invoke when a message is received - */ - public void onTurnInfo(Consumer handler) { - this.turnInfoHandler = handler; - } - - /** - * Registers a handler for ListenV2ConfigureSuccess messages from the server. - * - * @param handler the handler to invoke when a message is received - */ - public void onConfigureSuccess(Consumer handler) { - this.configureSuccessHandler = handler; - } - - /** - * Registers a handler for ListenV2ConfigureFailure messages from the server. - * - * @param handler the handler to invoke when a message is received - */ - public void onConfigureFailure(Consumer handler) { - this.configureFailureHandler = handler; - } - - /** - * Registers a handler for ListenV2FatalError messages from the server. - * - * @param handler the handler to invoke when a message is received - */ - public void onErrorMessage(Consumer handler) { - this.errorHandler = handler; - } - - /** - * Registers a handler called when the connection is established. - * - * @param handler the handler to invoke when connected - */ - public void onConnected(Runnable handler) { - this.onConnectedHandler = handler; - } - - /** - * Registers a handler called when the connection is closed. - * - * @param handler the handler to invoke when disconnected - */ - public void onDisconnected(Consumer handler) { - this.onDisconnectedHandler = handler; - } - - /** - * Registers a handler called when an error occurs. - * - * @param handler the handler to invoke on error - */ - public void onError(Consumer handler) { - this.onErrorHandler = handler; - } - - /** - * Registers a handler called for every incoming text message. The handler receives the raw JSON - * string before type-specific dispatch. - * - * @param handler the handler to invoke with the raw message JSON - */ - public void onMessage(Consumer handler) { - this.onMessageHandler = handler; - } - - /** - * Configures reconnection behavior. Must be called before {@link #connect}. - * - * @param options the reconnection options (backoff, retries, queue size) - */ - public void reconnectOptions(ReconnectingWebSocketListener.ReconnectOptions options) { - this.reconnectOptions = options; - } - - /** - * Closes this WebSocket client, releasing all resources. Equivalent to calling {@link - * #disconnect()}. - */ - @Override - public void close() { - disconnect(); - } - - /** - * Ensures the WebSocket is connected and ready to send messages. - * - * @throws IllegalStateException if the socket is not connected or not open - */ - private void assertSocketIsOpen() { - if (reconnectingListener.getWebSocket() == null) { - throw new IllegalStateException("WebSocket is not connected. Call connect() first."); - } - if (readyState != WebSocketReadyState.OPEN) { - throw new IllegalStateException("WebSocket is not open. Current state: " + readyState); - } - } - - private CompletableFuture sendMessage(Object body) { - CompletableFuture future = new CompletableFuture<>(); - try { - assertSocketIsOpen(); - String json = objectMapper.writeValueAsString(body); - // Use reconnecting listener's send method which handles queuing - reconnectingListener.send(json); - future.complete(null); - } catch (IllegalStateException e) { - future.completeExceptionally(e); - } catch (Exception e) { - future.completeExceptionally(new RuntimeException("Failed to send message", e)); - } - return future; - } - - private void handleIncomingMessage(String json) { - try { - if (onMessageHandler != null) { - onMessageHandler.accept(json); - } - JsonNode node = objectMapper.readTree(json); - if (node == null || node.isNull()) { - throw new IllegalArgumentException("Received null or invalid JSON message"); - } - JsonNode typeNode = node.get("type"); - if (typeNode == null || typeNode.isNull()) { - throw new IllegalArgumentException("Message missing 'type' field"); - } - String type = typeNode.asText(); - switch (type) { - case "Connected": - if (connectedHandler != null) { - ListenV2Connected event = objectMapper.treeToValue(node, ListenV2Connected.class); - if (event != null) { - connectedHandler.accept(event); - } - } - break; - case "TurnInfo": - if (turnInfoHandler != null) { - ListenV2TurnInfo event = objectMapper.treeToValue(node, ListenV2TurnInfo.class); - if (event != null) { - turnInfoHandler.accept(event); - } - } - break; - case "ConfigureSuccess": - if (configureSuccessHandler != null) { - ListenV2ConfigureSuccess event = - objectMapper.treeToValue(node, ListenV2ConfigureSuccess.class); - if (event != null) { - configureSuccessHandler.accept(event); - } - } - break; - case "ConfigureFailure": - if (configureFailureHandler != null) { - ListenV2ConfigureFailure event = - objectMapper.treeToValue(node, ListenV2ConfigureFailure.class); - if (event != null) { - configureFailureHandler.accept(event); - } - } - break; - case "Error": - if (errorHandler != null) { - ListenV2FatalError event = objectMapper.treeToValue(node, ListenV2FatalError.class); - if (event != null) { - errorHandler.accept(event); - } - } - break; - default: - if (onErrorHandler != null) { - onErrorHandler.accept( - new RuntimeException( - "Unknown WebSocket message type: '" - + type - + "'. Update your SDK version to support new message types.")); - } - break; - } - } catch (Exception e) { - if (onErrorHandler != null) { - onErrorHandler.accept(e); - } - } - } -} diff --git a/src/main/java/resources/manage/AsyncManageClient.java b/src/main/java/resources/manage/AsyncManageClient.java deleted file mode 100644 index 990dad5..0000000 --- a/src/main/java/resources/manage/AsyncManageClient.java +++ /dev/null @@ -1,22 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage; - -import core.ClientOptions; -import core.Suppliers; -import java.util.function.Supplier; -import resources.manage.v1.AsyncV1Client; - -public class AsyncManageClient { - protected final ClientOptions clientOptions; - - protected final Supplier v1Client; - - public AsyncManageClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.v1Client = Suppliers.memoize(() -> new AsyncV1Client(clientOptions)); - } - - public AsyncV1Client v1() { - return this.v1Client.get(); - } -} diff --git a/src/main/java/resources/manage/ManageClient.java b/src/main/java/resources/manage/ManageClient.java deleted file mode 100644 index c169e61..0000000 --- a/src/main/java/resources/manage/ManageClient.java +++ /dev/null @@ -1,22 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage; - -import core.ClientOptions; -import core.Suppliers; -import java.util.function.Supplier; -import resources.manage.v1.V1Client; - -public class ManageClient { - protected final ClientOptions clientOptions; - - protected final Supplier v1Client; - - public ManageClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.v1Client = Suppliers.memoize(() -> new V1Client(clientOptions)); - } - - public V1Client v1() { - return this.v1Client.get(); - } -} diff --git a/src/main/java/resources/manage/v1/AsyncV1Client.java b/src/main/java/resources/manage/v1/AsyncV1Client.java deleted file mode 100644 index 4548b17..0000000 --- a/src/main/java/resources/manage/v1/AsyncV1Client.java +++ /dev/null @@ -1,30 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1; - -import core.ClientOptions; -import core.Suppliers; -import java.util.function.Supplier; -import resources.manage.v1.models.AsyncModelsClient; -import resources.manage.v1.projects.AsyncProjectsClient; - -public class AsyncV1Client { - protected final ClientOptions clientOptions; - - protected final Supplier modelsClient; - - protected final Supplier projectsClient; - - public AsyncV1Client(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.modelsClient = Suppliers.memoize(() -> new AsyncModelsClient(clientOptions)); - this.projectsClient = Suppliers.memoize(() -> new AsyncProjectsClient(clientOptions)); - } - - public AsyncModelsClient models() { - return this.modelsClient.get(); - } - - public AsyncProjectsClient projects() { - return this.projectsClient.get(); - } -} diff --git a/src/main/java/resources/manage/v1/V1Client.java b/src/main/java/resources/manage/v1/V1Client.java deleted file mode 100644 index 8ab9cfc..0000000 --- a/src/main/java/resources/manage/v1/V1Client.java +++ /dev/null @@ -1,30 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1; - -import core.ClientOptions; -import core.Suppliers; -import java.util.function.Supplier; -import resources.manage.v1.models.ModelsClient; -import resources.manage.v1.projects.ProjectsClient; - -public class V1Client { - protected final ClientOptions clientOptions; - - protected final Supplier modelsClient; - - protected final Supplier projectsClient; - - public V1Client(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.modelsClient = Suppliers.memoize(() -> new ModelsClient(clientOptions)); - this.projectsClient = Suppliers.memoize(() -> new ProjectsClient(clientOptions)); - } - - public ModelsClient models() { - return this.modelsClient.get(); - } - - public ProjectsClient projects() { - return this.projectsClient.get(); - } -} diff --git a/src/main/java/resources/manage/v1/models/AsyncModelsClient.java b/src/main/java/resources/manage/v1/models/AsyncModelsClient.java deleted file mode 100644 index 49c668d..0000000 --- a/src/main/java/resources/manage/v1/models/AsyncModelsClient.java +++ /dev/null @@ -1,68 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.models; - -import core.ClientOptions; -import core.RequestOptions; -import java.util.concurrent.CompletableFuture; -import resources.manage.v1.models.requests.ModelsListRequest; -import types.GetModelV1Response; -import types.ListModelsV1Response; - -public class AsyncModelsClient { - protected final ClientOptions clientOptions; - - private final AsyncRawModelsClient rawClient; - - public AsyncModelsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new AsyncRawModelsClient(clientOptions); - } - - /** Get responses with HTTP metadata like headers */ - public AsyncRawModelsClient withRawResponse() { - return this.rawClient; - } - - /** - * Returns metadata on all the latest public models. To retrieve custom models, use Get Project - * Models. - */ - public CompletableFuture list() { - return this.rawClient.list().thenApply(response -> response.body()); - } - - /** - * Returns metadata on all the latest public models. To retrieve custom models, use Get Project - * Models. - */ - public CompletableFuture list(RequestOptions requestOptions) { - return this.rawClient.list(requestOptions).thenApply(response -> response.body()); - } - - /** - * Returns metadata on all the latest public models. To retrieve custom models, use Get Project - * Models. - */ - public CompletableFuture list(ModelsListRequest request) { - return this.rawClient.list(request).thenApply(response -> response.body()); - } - - /** - * Returns metadata on all the latest public models. To retrieve custom models, use Get Project - * Models. - */ - public CompletableFuture list( - ModelsListRequest request, RequestOptions requestOptions) { - return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); - } - - /** Returns metadata for a specific public model */ - public CompletableFuture get(String modelId) { - return this.rawClient.get(modelId).thenApply(response -> response.body()); - } - - /** Returns metadata for a specific public model */ - public CompletableFuture get(String modelId, RequestOptions requestOptions) { - return this.rawClient.get(modelId, requestOptions).thenApply(response -> response.body()); - } -} diff --git a/src/main/java/resources/manage/v1/models/AsyncRawModelsClient.java b/src/main/java/resources/manage/v1/models/AsyncRawModelsClient.java deleted file mode 100644 index 01f0af8..0000000 --- a/src/main/java/resources/manage/v1/models/AsyncRawModelsClient.java +++ /dev/null @@ -1,231 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.models; - -import com.fasterxml.jackson.core.JsonProcessingException; -import core.ClientOptions; -import core.DeepgramApiApiException; -import core.DeepgramApiException; -import core.DeepgramApiHttpResponse; -import core.ObjectMappers; -import core.QueryStringMapper; -import core.RequestOptions; -import errors.BadRequestError; -import java.io.IOException; -import java.util.concurrent.CompletableFuture; -import okhttp3.Call; -import okhttp3.Callback; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import okhttp3.ResponseBody; -import org.jetbrains.annotations.NotNull; -import resources.manage.v1.models.requests.ModelsListRequest; -import types.GetModelV1Response; -import types.ListModelsV1Response; - -public class AsyncRawModelsClient { - protected final ClientOptions clientOptions; - - public AsyncRawModelsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** - * Returns metadata on all the latest public models. To retrieve custom models, use Get Project - * Models. - */ - public CompletableFuture> list() { - return list(ModelsListRequest.builder().build()); - } - - /** - * Returns metadata on all the latest public models. To retrieve custom models, use Get Project - * Models. - */ - public CompletableFuture> list( - RequestOptions requestOptions) { - return list(ModelsListRequest.builder().build(), requestOptions); - } - - /** - * Returns metadata on all the latest public models. To retrieve custom models, use Get Project - * Models. - */ - public CompletableFuture> list( - ModelsListRequest request) { - return list(request, null); - } - - /** - * Returns metadata on all the latest public models. To retrieve custom models, use Get Project - * Models. - */ - public CompletableFuture> list( - ModelsListRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/models"); - if (request.getIncludeOutdated().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "include_outdated", request.getIncludeOutdated().get(), false); - } - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request.Builder _requestBuilder = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json"); - Request okhttpRequest = _requestBuilder.build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = - new CompletableFuture<>(); - client - .newCall(okhttpRequest) - .enqueue( - new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) - throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete( - new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, ListModelsV1Response.class), - response)); - return; - } - try { - if (response.code() == 400) { - future.completeExceptionally( - new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally( - new DeepgramApiApiException( - "Error with status code " + response.code(), - response.code(), - errorBody, - response)); - return; - } catch (IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - }); - return future; - } - - /** Returns metadata for a specific public model */ - public CompletableFuture> get(String modelId) { - return get(modelId, null); - } - - /** Returns metadata for a specific public model */ - public CompletableFuture> get( - String modelId, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/models") - .addPathSegment(modelId); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = - new CompletableFuture<>(); - client - .newCall(okhttpRequest) - .enqueue( - new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) - throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete( - new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, GetModelV1Response.class), - response)); - return; - } - try { - if (response.code() == 400) { - future.completeExceptionally( - new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally( - new DeepgramApiApiException( - "Error with status code " + response.code(), - response.code(), - errorBody, - response)); - return; - } catch (IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - }); - return future; - } -} diff --git a/src/main/java/resources/manage/v1/models/ModelsClient.java b/src/main/java/resources/manage/v1/models/ModelsClient.java deleted file mode 100644 index 02c1eae..0000000 --- a/src/main/java/resources/manage/v1/models/ModelsClient.java +++ /dev/null @@ -1,66 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.models; - -import core.ClientOptions; -import core.RequestOptions; -import resources.manage.v1.models.requests.ModelsListRequest; -import types.GetModelV1Response; -import types.ListModelsV1Response; - -public class ModelsClient { - protected final ClientOptions clientOptions; - - private final RawModelsClient rawClient; - - public ModelsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new RawModelsClient(clientOptions); - } - - /** Get responses with HTTP metadata like headers */ - public RawModelsClient withRawResponse() { - return this.rawClient; - } - - /** - * Returns metadata on all the latest public models. To retrieve custom models, use Get Project - * Models. - */ - public ListModelsV1Response list() { - return this.rawClient.list().body(); - } - - /** - * Returns metadata on all the latest public models. To retrieve custom models, use Get Project - * Models. - */ - public ListModelsV1Response list(RequestOptions requestOptions) { - return this.rawClient.list(requestOptions).body(); - } - - /** - * Returns metadata on all the latest public models. To retrieve custom models, use Get Project - * Models. - */ - public ListModelsV1Response list(ModelsListRequest request) { - return this.rawClient.list(request).body(); - } - - /** - * Returns metadata on all the latest public models. To retrieve custom models, use Get Project - * Models. - */ - public ListModelsV1Response list(ModelsListRequest request, RequestOptions requestOptions) { - return this.rawClient.list(request, requestOptions).body(); - } - - /** Returns metadata for a specific public model */ - public GetModelV1Response get(String modelId) { - return this.rawClient.get(modelId).body(); - } - - /** Returns metadata for a specific public model */ - public GetModelV1Response get(String modelId, RequestOptions requestOptions) { - return this.rawClient.get(modelId, requestOptions).body(); - } -} diff --git a/src/main/java/resources/manage/v1/models/RawModelsClient.java b/src/main/java/resources/manage/v1/models/RawModelsClient.java deleted file mode 100644 index 59cab59..0000000 --- a/src/main/java/resources/manage/v1/models/RawModelsClient.java +++ /dev/null @@ -1,167 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.models; - -import com.fasterxml.jackson.core.JsonProcessingException; -import core.ClientOptions; -import core.DeepgramApiApiException; -import core.DeepgramApiException; -import core.DeepgramApiHttpResponse; -import core.ObjectMappers; -import core.QueryStringMapper; -import core.RequestOptions; -import errors.BadRequestError; -import java.io.IOException; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import okhttp3.ResponseBody; -import resources.manage.v1.models.requests.ModelsListRequest; -import types.GetModelV1Response; -import types.ListModelsV1Response; - -public class RawModelsClient { - protected final ClientOptions clientOptions; - - public RawModelsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** - * Returns metadata on all the latest public models. To retrieve custom models, use Get Project - * Models. - */ - public DeepgramApiHttpResponse list() { - return list(ModelsListRequest.builder().build()); - } - - /** - * Returns metadata on all the latest public models. To retrieve custom models, use Get Project - * Models. - */ - public DeepgramApiHttpResponse list(RequestOptions requestOptions) { - return list(ModelsListRequest.builder().build(), requestOptions); - } - - /** - * Returns metadata on all the latest public models. To retrieve custom models, use Get Project - * Models. - */ - public DeepgramApiHttpResponse list(ModelsListRequest request) { - return list(request, null); - } - - /** - * Returns metadata on all the latest public models. To retrieve custom models, use Get Project - * Models. - */ - public DeepgramApiHttpResponse list( - ModelsListRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/models"); - if (request.getIncludeOutdated().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "include_outdated", request.getIncludeOutdated().get(), false); - } - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request.Builder _requestBuilder = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "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(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListModelsV1Response.class), - response); - } - try { - if (response.code() == 400) { - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new DeepgramApiApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (IOException e) { - throw new DeepgramApiException("Network error executing HTTP request", e); - } - } - - /** Returns metadata for a specific public model */ - public DeepgramApiHttpResponse get(String modelId) { - return get(modelId, null); - } - - /** Returns metadata for a specific public model */ - public DeepgramApiHttpResponse get( - String modelId, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/models") - .addPathSegment(modelId); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "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(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetModelV1Response.class), - response); - } - try { - if (response.code() == 400) { - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new DeepgramApiApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (IOException e) { - throw new DeepgramApiException("Network error executing HTTP request", e); - } - } -} diff --git a/src/main/java/resources/manage/v1/models/requests/ModelsListRequest.java b/src/main/java/resources/manage/v1/models/requests/ModelsListRequest.java deleted file mode 100644 index e160571..0000000 --- a/src/main/java/resources/manage/v1/models/requests/ModelsListRequest.java +++ /dev/null @@ -1,108 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.models.requests; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import 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 = ModelsListRequest.Builder.class) -public final class ModelsListRequest { - private final Optional includeOutdated; - - private final Map additionalProperties; - - private ModelsListRequest( - Optional includeOutdated, Map additionalProperties) { - this.includeOutdated = includeOutdated; - this.additionalProperties = additionalProperties; - } - - /** - * @return - *

non-latest versions of models - */ - @JsonIgnore - public Optional getIncludeOutdated() { - return includeOutdated; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ModelsListRequest && equalTo((ModelsListRequest) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ModelsListRequest other) { - return includeOutdated.equals(other.includeOutdated); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.includeOutdated); - } - - @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 includeOutdated = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ModelsListRequest other) { - includeOutdated(other.getIncludeOutdated()); - return this; - } - - /** returns non-latest versions of models */ - @JsonSetter(value = "include_outdated", nulls = Nulls.SKIP) - public Builder includeOutdated(Optional includeOutdated) { - this.includeOutdated = includeOutdated; - return this; - } - - public Builder includeOutdated(Boolean includeOutdated) { - this.includeOutdated = Optional.ofNullable(includeOutdated); - return this; - } - - public ModelsListRequest build() { - return new ModelsListRequest(includeOutdated, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/manage/v1/projects/AsyncProjectsClient.java b/src/main/java/resources/manage/v1/projects/AsyncProjectsClient.java deleted file mode 100644 index cf8abae..0000000 --- a/src/main/java/resources/manage/v1/projects/AsyncProjectsClient.java +++ /dev/null @@ -1,160 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects; - -import core.ClientOptions; -import core.RequestOptions; -import core.Suppliers; -import java.util.concurrent.CompletableFuture; -import java.util.function.Supplier; -import resources.manage.v1.projects.billing.AsyncBillingClient; -import resources.manage.v1.projects.keys.AsyncKeysClient; -import resources.manage.v1.projects.members.AsyncMembersClient; -import resources.manage.v1.projects.models.AsyncModelsClient; -import resources.manage.v1.projects.requests.AsyncRequestsClient; -import resources.manage.v1.projects.requests.ProjectsGetRequest; -import resources.manage.v1.projects.requests.UpdateProjectV1Request; -import resources.manage.v1.projects.usage.AsyncUsageClient; -import types.DeleteProjectV1Response; -import types.GetProjectV1Response; -import types.LeaveProjectV1Response; -import types.ListProjectsV1Response; -import types.UpdateProjectV1Response; - -public class AsyncProjectsClient { - protected final ClientOptions clientOptions; - - private final AsyncRawProjectsClient rawClient; - - protected final Supplier keysClient; - - protected final Supplier membersClient; - - protected final Supplier modelsClient; - - protected final Supplier requestsClient; - - protected final Supplier usageClient; - - protected final Supplier billingClient; - - public AsyncProjectsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new AsyncRawProjectsClient(clientOptions); - this.keysClient = Suppliers.memoize(() -> new AsyncKeysClient(clientOptions)); - this.membersClient = Suppliers.memoize(() -> new AsyncMembersClient(clientOptions)); - this.modelsClient = Suppliers.memoize(() -> new AsyncModelsClient(clientOptions)); - this.requestsClient = Suppliers.memoize(() -> new AsyncRequestsClient(clientOptions)); - this.usageClient = Suppliers.memoize(() -> new AsyncUsageClient(clientOptions)); - this.billingClient = Suppliers.memoize(() -> new AsyncBillingClient(clientOptions)); - } - - /** Get responses with HTTP metadata like headers */ - public AsyncRawProjectsClient withRawResponse() { - return this.rawClient; - } - - /** Retrieves basic information about the projects associated with the API key */ - public CompletableFuture list() { - return this.rawClient.list().thenApply(response -> response.body()); - } - - /** Retrieves basic information about the projects associated with the API key */ - public CompletableFuture list(RequestOptions requestOptions) { - return this.rawClient.list(requestOptions).thenApply(response -> response.body()); - } - - /** Retrieves information about the specified project */ - public CompletableFuture get(String projectId) { - return this.rawClient.get(projectId).thenApply(response -> response.body()); - } - - /** Retrieves information about the specified project */ - public CompletableFuture get( - String projectId, RequestOptions requestOptions) { - return this.rawClient.get(projectId, requestOptions).thenApply(response -> response.body()); - } - - /** Retrieves information about the specified project */ - public CompletableFuture get(String projectId, ProjectsGetRequest request) { - return this.rawClient.get(projectId, request).thenApply(response -> response.body()); - } - - /** Retrieves information about the specified project */ - public CompletableFuture get( - String projectId, ProjectsGetRequest request, RequestOptions requestOptions) { - return this.rawClient - .get(projectId, request, requestOptions) - .thenApply(response -> response.body()); - } - - /** Deletes the specified project */ - public CompletableFuture delete(String projectId) { - return this.rawClient.delete(projectId).thenApply(response -> response.body()); - } - - /** Deletes the specified project */ - public CompletableFuture delete( - String projectId, RequestOptions requestOptions) { - return this.rawClient.delete(projectId, requestOptions).thenApply(response -> response.body()); - } - - /** Updates the name or other properties of an existing project */ - public CompletableFuture update(String projectId) { - return this.rawClient.update(projectId).thenApply(response -> response.body()); - } - - /** Updates the name or other properties of an existing project */ - public CompletableFuture update( - String projectId, RequestOptions requestOptions) { - return this.rawClient.update(projectId, requestOptions).thenApply(response -> response.body()); - } - - /** Updates the name or other properties of an existing project */ - public CompletableFuture update( - String projectId, UpdateProjectV1Request request) { - return this.rawClient.update(projectId, request).thenApply(response -> response.body()); - } - - /** Updates the name or other properties of an existing project */ - public CompletableFuture update( - String projectId, UpdateProjectV1Request request, RequestOptions requestOptions) { - return this.rawClient - .update(projectId, request, requestOptions) - .thenApply(response -> response.body()); - } - - /** Removes the authenticated account from the specific project */ - public CompletableFuture leave(String projectId) { - return this.rawClient.leave(projectId).thenApply(response -> response.body()); - } - - /** Removes the authenticated account from the specific project */ - public CompletableFuture leave( - String projectId, RequestOptions requestOptions) { - return this.rawClient.leave(projectId, requestOptions).thenApply(response -> response.body()); - } - - public AsyncKeysClient keys() { - return this.keysClient.get(); - } - - public AsyncMembersClient members() { - return this.membersClient.get(); - } - - public AsyncModelsClient models() { - return this.modelsClient.get(); - } - - public AsyncRequestsClient requests() { - return this.requestsClient.get(); - } - - public AsyncUsageClient usage() { - return this.usageClient.get(); - } - - public AsyncBillingClient billing() { - return this.billingClient.get(); - } -} diff --git a/src/main/java/resources/manage/v1/projects/AsyncRawProjectsClient.java b/src/main/java/resources/manage/v1/projects/AsyncRawProjectsClient.java deleted file mode 100644 index 900e761..0000000 --- a/src/main/java/resources/manage/v1/projects/AsyncRawProjectsClient.java +++ /dev/null @@ -1,507 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects; - -import com.fasterxml.jackson.core.JsonProcessingException; -import core.ClientOptions; -import core.DeepgramApiApiException; -import core.DeepgramApiException; -import core.DeepgramApiHttpResponse; -import core.MediaTypes; -import core.ObjectMappers; -import core.QueryStringMapper; -import core.RequestOptions; -import errors.BadRequestError; -import java.io.IOException; -import java.util.concurrent.CompletableFuture; -import okhttp3.Call; -import okhttp3.Callback; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; -import okhttp3.ResponseBody; -import org.jetbrains.annotations.NotNull; -import resources.manage.v1.projects.requests.ProjectsGetRequest; -import resources.manage.v1.projects.requests.UpdateProjectV1Request; -import types.DeleteProjectV1Response; -import types.GetProjectV1Response; -import types.LeaveProjectV1Response; -import types.ListProjectsV1Response; -import types.UpdateProjectV1Response; - -public class AsyncRawProjectsClient { - protected final ClientOptions clientOptions; - - public AsyncRawProjectsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** Retrieves basic information about the projects associated with the API key */ - public CompletableFuture> list() { - return list(null); - } - - /** Retrieves basic information about the projects associated with the API key */ - public CompletableFuture> list( - RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects"); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = - new CompletableFuture<>(); - client - .newCall(okhttpRequest) - .enqueue( - new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) - throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete( - new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, ListProjectsV1Response.class), - response)); - return; - } - try { - if (response.code() == 400) { - future.completeExceptionally( - new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally( - new DeepgramApiApiException( - "Error with status code " + response.code(), - response.code(), - errorBody, - response)); - return; - } catch (IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - }); - return future; - } - - /** Retrieves information about the specified project */ - public CompletableFuture> get(String projectId) { - return get(projectId, ProjectsGetRequest.builder().build()); - } - - /** Retrieves information about the specified project */ - public CompletableFuture> get( - String projectId, RequestOptions requestOptions) { - return get(projectId, ProjectsGetRequest.builder().build(), requestOptions); - } - - /** Retrieves information about the specified project */ - public CompletableFuture> get( - String projectId, ProjectsGetRequest request) { - return get(projectId, request, null); - } - - /** Retrieves information about the specified project */ - public CompletableFuture> get( - String projectId, ProjectsGetRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId); - if (request.getLimit().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "limit", request.getLimit().get(), false); - } - if (request.getPage().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "page", request.getPage().get(), false); - } - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request.Builder _requestBuilder = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json"); - Request okhttpRequest = _requestBuilder.build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = - new CompletableFuture<>(); - client - .newCall(okhttpRequest) - .enqueue( - new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) - throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete( - new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, GetProjectV1Response.class), - response)); - return; - } - try { - if (response.code() == 400) { - future.completeExceptionally( - new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally( - new DeepgramApiApiException( - "Error with status code " + response.code(), - response.code(), - errorBody, - response)); - return; - } catch (IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - }); - return future; - } - - /** Deletes the specified project */ - public CompletableFuture> delete( - String projectId) { - return delete(projectId, null); - } - - /** Deletes the specified project */ - public CompletableFuture> delete( - String projectId, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = - new CompletableFuture<>(); - client - .newCall(okhttpRequest) - .enqueue( - new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) - throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete( - new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, DeleteProjectV1Response.class), - response)); - return; - } - try { - if (response.code() == 400) { - future.completeExceptionally( - new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally( - new DeepgramApiApiException( - "Error with status code " + response.code(), - response.code(), - errorBody, - response)); - return; - } catch (IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - }); - return future; - } - - /** Updates the name or other properties of an existing project */ - public CompletableFuture> update( - String projectId) { - return update(projectId, UpdateProjectV1Request.builder().build()); - } - - /** Updates the name or other properties of an existing project */ - public CompletableFuture> update( - String projectId, RequestOptions requestOptions) { - return update(projectId, UpdateProjectV1Request.builder().build(), requestOptions); - } - - /** Updates the name or other properties of an existing project */ - public CompletableFuture> update( - String projectId, UpdateProjectV1Request request) { - return update(projectId, request, null); - } - - /** Updates the name or other properties of an existing project */ - public CompletableFuture> update( - String projectId, UpdateProjectV1Request request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - RequestBody body; - try { - body = - RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); - } catch (JsonProcessingException e) { - throw new DeepgramApiException("Failed to serialize request", e); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("PATCH", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = - new CompletableFuture<>(); - client - .newCall(okhttpRequest) - .enqueue( - new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) - throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete( - new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, UpdateProjectV1Response.class), - response)); - return; - } - try { - if (response.code() == 400) { - future.completeExceptionally( - new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally( - new DeepgramApiApiException( - "Error with status code " + response.code(), - response.code(), - errorBody, - response)); - return; - } catch (IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - }); - return future; - } - - /** Removes the authenticated account from the specific project */ - public CompletableFuture> leave( - String projectId) { - return leave(projectId, null); - } - - /** Removes the authenticated account from the specific project */ - public CompletableFuture> leave( - String projectId, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("leave"); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = - new CompletableFuture<>(); - client - .newCall(okhttpRequest) - .enqueue( - new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) - throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete( - new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, LeaveProjectV1Response.class), - response)); - return; - } - try { - if (response.code() == 400) { - future.completeExceptionally( - new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally( - new DeepgramApiApiException( - "Error with status code " + response.code(), - response.code(), - errorBody, - response)); - return; - } catch (IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - }); - return future; - } -} diff --git a/src/main/java/resources/manage/v1/projects/ProjectsClient.java b/src/main/java/resources/manage/v1/projects/ProjectsClient.java deleted file mode 100644 index 7b3644b..0000000 --- a/src/main/java/resources/manage/v1/projects/ProjectsClient.java +++ /dev/null @@ -1,150 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects; - -import core.ClientOptions; -import core.RequestOptions; -import core.Suppliers; -import java.util.function.Supplier; -import resources.manage.v1.projects.billing.BillingClient; -import resources.manage.v1.projects.keys.KeysClient; -import resources.manage.v1.projects.members.MembersClient; -import resources.manage.v1.projects.models.ModelsClient; -import resources.manage.v1.projects.requests.ProjectsGetRequest; -import resources.manage.v1.projects.requests.RequestsClient; -import resources.manage.v1.projects.requests.UpdateProjectV1Request; -import resources.manage.v1.projects.usage.UsageClient; -import types.DeleteProjectV1Response; -import types.GetProjectV1Response; -import types.LeaveProjectV1Response; -import types.ListProjectsV1Response; -import types.UpdateProjectV1Response; - -public class ProjectsClient { - protected final ClientOptions clientOptions; - - private final RawProjectsClient rawClient; - - protected final Supplier keysClient; - - protected final Supplier membersClient; - - protected final Supplier modelsClient; - - protected final Supplier requestsClient; - - protected final Supplier usageClient; - - protected final Supplier billingClient; - - public ProjectsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new RawProjectsClient(clientOptions); - this.keysClient = Suppliers.memoize(() -> new KeysClient(clientOptions)); - this.membersClient = Suppliers.memoize(() -> new MembersClient(clientOptions)); - this.modelsClient = Suppliers.memoize(() -> new ModelsClient(clientOptions)); - this.requestsClient = Suppliers.memoize(() -> new RequestsClient(clientOptions)); - this.usageClient = Suppliers.memoize(() -> new UsageClient(clientOptions)); - this.billingClient = Suppliers.memoize(() -> new BillingClient(clientOptions)); - } - - /** Get responses with HTTP metadata like headers */ - public RawProjectsClient withRawResponse() { - return this.rawClient; - } - - /** Retrieves basic information about the projects associated with the API key */ - public ListProjectsV1Response list() { - return this.rawClient.list().body(); - } - - /** Retrieves basic information about the projects associated with the API key */ - public ListProjectsV1Response list(RequestOptions requestOptions) { - return this.rawClient.list(requestOptions).body(); - } - - /** Retrieves information about the specified project */ - public GetProjectV1Response get(String projectId) { - return this.rawClient.get(projectId).body(); - } - - /** Retrieves information about the specified project */ - public GetProjectV1Response get(String projectId, RequestOptions requestOptions) { - return this.rawClient.get(projectId, requestOptions).body(); - } - - /** Retrieves information about the specified project */ - public GetProjectV1Response get(String projectId, ProjectsGetRequest request) { - return this.rawClient.get(projectId, request).body(); - } - - /** Retrieves information about the specified project */ - public GetProjectV1Response get( - String projectId, ProjectsGetRequest request, RequestOptions requestOptions) { - return this.rawClient.get(projectId, request, requestOptions).body(); - } - - /** Deletes the specified project */ - public DeleteProjectV1Response delete(String projectId) { - return this.rawClient.delete(projectId).body(); - } - - /** Deletes the specified project */ - public DeleteProjectV1Response delete(String projectId, RequestOptions requestOptions) { - return this.rawClient.delete(projectId, requestOptions).body(); - } - - /** Updates the name or other properties of an existing project */ - public UpdateProjectV1Response update(String projectId) { - return this.rawClient.update(projectId).body(); - } - - /** Updates the name or other properties of an existing project */ - public UpdateProjectV1Response update(String projectId, RequestOptions requestOptions) { - return this.rawClient.update(projectId, requestOptions).body(); - } - - /** Updates the name or other properties of an existing project */ - public UpdateProjectV1Response update(String projectId, UpdateProjectV1Request request) { - return this.rawClient.update(projectId, request).body(); - } - - /** Updates the name or other properties of an existing project */ - public UpdateProjectV1Response update( - String projectId, UpdateProjectV1Request request, RequestOptions requestOptions) { - return this.rawClient.update(projectId, request, requestOptions).body(); - } - - /** Removes the authenticated account from the specific project */ - public LeaveProjectV1Response leave(String projectId) { - return this.rawClient.leave(projectId).body(); - } - - /** Removes the authenticated account from the specific project */ - public LeaveProjectV1Response leave(String projectId, RequestOptions requestOptions) { - return this.rawClient.leave(projectId, requestOptions).body(); - } - - public KeysClient keys() { - return this.keysClient.get(); - } - - public MembersClient members() { - return this.membersClient.get(); - } - - public ModelsClient models() { - return this.modelsClient.get(); - } - - public RequestsClient requests() { - return this.requestsClient.get(); - } - - public UsageClient usage() { - return this.usageClient.get(); - } - - public BillingClient billing() { - return this.billingClient.get(); - } -} diff --git a/src/main/java/resources/manage/v1/projects/RawProjectsClient.java b/src/main/java/resources/manage/v1/projects/RawProjectsClient.java deleted file mode 100644 index 0c1e993..0000000 --- a/src/main/java/resources/manage/v1/projects/RawProjectsClient.java +++ /dev/null @@ -1,354 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects; - -import com.fasterxml.jackson.core.JsonProcessingException; -import core.ClientOptions; -import core.DeepgramApiApiException; -import core.DeepgramApiException; -import core.DeepgramApiHttpResponse; -import core.MediaTypes; -import core.ObjectMappers; -import core.QueryStringMapper; -import core.RequestOptions; -import errors.BadRequestError; -import java.io.IOException; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; -import okhttp3.ResponseBody; -import resources.manage.v1.projects.requests.ProjectsGetRequest; -import resources.manage.v1.projects.requests.UpdateProjectV1Request; -import types.DeleteProjectV1Response; -import types.GetProjectV1Response; -import types.LeaveProjectV1Response; -import types.ListProjectsV1Response; -import types.UpdateProjectV1Response; - -public class RawProjectsClient { - protected final ClientOptions clientOptions; - - public RawProjectsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** Retrieves basic information about the projects associated with the API key */ - public DeepgramApiHttpResponse list() { - return list(null); - } - - /** Retrieves basic information about the projects associated with the API key */ - public DeepgramApiHttpResponse list(RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects"); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "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(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListProjectsV1Response.class), - response); - } - try { - if (response.code() == 400) { - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new DeepgramApiApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (IOException e) { - throw new DeepgramApiException("Network error executing HTTP request", e); - } - } - - /** Retrieves information about the specified project */ - public DeepgramApiHttpResponse get(String projectId) { - return get(projectId, ProjectsGetRequest.builder().build()); - } - - /** Retrieves information about the specified project */ - public DeepgramApiHttpResponse get( - String projectId, RequestOptions requestOptions) { - return get(projectId, ProjectsGetRequest.builder().build(), requestOptions); - } - - /** Retrieves information about the specified project */ - public DeepgramApiHttpResponse get( - String projectId, ProjectsGetRequest request) { - return get(projectId, request, null); - } - - /** Retrieves information about the specified project */ - public DeepgramApiHttpResponse get( - String projectId, ProjectsGetRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId); - if (request.getLimit().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "limit", request.getLimit().get(), false); - } - if (request.getPage().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "page", request.getPage().get(), false); - } - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request.Builder _requestBuilder = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "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(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetProjectV1Response.class), - response); - } - try { - if (response.code() == 400) { - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new DeepgramApiApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (IOException e) { - throw new DeepgramApiException("Network error executing HTTP request", e); - } - } - - /** Deletes the specified project */ - public DeepgramApiHttpResponse delete(String projectId) { - return delete(projectId, null); - } - - /** Deletes the specified project */ - public DeepgramApiHttpResponse delete( - String projectId, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "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(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteProjectV1Response.class), - response); - } - try { - if (response.code() == 400) { - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new DeepgramApiApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (IOException e) { - throw new DeepgramApiException("Network error executing HTTP request", e); - } - } - - /** Updates the name or other properties of an existing project */ - public DeepgramApiHttpResponse update(String projectId) { - return update(projectId, UpdateProjectV1Request.builder().build()); - } - - /** Updates the name or other properties of an existing project */ - public DeepgramApiHttpResponse update( - String projectId, RequestOptions requestOptions) { - return update(projectId, UpdateProjectV1Request.builder().build(), requestOptions); - } - - /** Updates the name or other properties of an existing project */ - public DeepgramApiHttpResponse update( - String projectId, UpdateProjectV1Request request) { - return update(projectId, request, null); - } - - /** Updates the name or other properties of an existing project */ - public DeepgramApiHttpResponse update( - String projectId, UpdateProjectV1Request request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - RequestBody body; - try { - body = - RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); - } catch (JsonProcessingException e) { - throw new DeepgramApiException("Failed to serialize request", e); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("PATCH", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .addHeader("Accept", "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(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UpdateProjectV1Response.class), - response); - } - try { - if (response.code() == 400) { - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new DeepgramApiApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (IOException e) { - throw new DeepgramApiException("Network error executing HTTP request", e); - } - } - - /** Removes the authenticated account from the specific project */ - public DeepgramApiHttpResponse leave(String projectId) { - return leave(projectId, null); - } - - /** Removes the authenticated account from the specific project */ - public DeepgramApiHttpResponse leave( - String projectId, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("leave"); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "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(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, LeaveProjectV1Response.class), - response); - } - try { - if (response.code() == 400) { - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new DeepgramApiApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (IOException e) { - throw new DeepgramApiException("Network error executing HTTP request", e); - } - } -} diff --git a/src/main/java/resources/manage/v1/projects/billing/AsyncBillingClient.java b/src/main/java/resources/manage/v1/projects/billing/AsyncBillingClient.java deleted file mode 100644 index 01534b2..0000000 --- a/src/main/java/resources/manage/v1/projects/billing/AsyncBillingClient.java +++ /dev/null @@ -1,46 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.billing; - -import core.ClientOptions; -import core.Suppliers; -import java.util.function.Supplier; -import resources.manage.v1.projects.billing.balances.AsyncBalancesClient; -import resources.manage.v1.projects.billing.breakdown.AsyncBreakdownClient; -import resources.manage.v1.projects.billing.fields.AsyncFieldsClient; -import resources.manage.v1.projects.billing.purchases.AsyncPurchasesClient; - -public class AsyncBillingClient { - protected final ClientOptions clientOptions; - - protected final Supplier balancesClient; - - protected final Supplier breakdownClient; - - protected final Supplier fieldsClient; - - protected final Supplier purchasesClient; - - public AsyncBillingClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.balancesClient = Suppliers.memoize(() -> new AsyncBalancesClient(clientOptions)); - this.breakdownClient = Suppliers.memoize(() -> new AsyncBreakdownClient(clientOptions)); - this.fieldsClient = Suppliers.memoize(() -> new AsyncFieldsClient(clientOptions)); - this.purchasesClient = Suppliers.memoize(() -> new AsyncPurchasesClient(clientOptions)); - } - - public AsyncBalancesClient balances() { - return this.balancesClient.get(); - } - - public AsyncBreakdownClient breakdown() { - return this.breakdownClient.get(); - } - - public AsyncFieldsClient fields() { - return this.fieldsClient.get(); - } - - public AsyncPurchasesClient purchases() { - return this.purchasesClient.get(); - } -} diff --git a/src/main/java/resources/manage/v1/projects/billing/BillingClient.java b/src/main/java/resources/manage/v1/projects/billing/BillingClient.java deleted file mode 100644 index 10d0234..0000000 --- a/src/main/java/resources/manage/v1/projects/billing/BillingClient.java +++ /dev/null @@ -1,46 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.billing; - -import core.ClientOptions; -import core.Suppliers; -import java.util.function.Supplier; -import resources.manage.v1.projects.billing.balances.BalancesClient; -import resources.manage.v1.projects.billing.breakdown.BreakdownClient; -import resources.manage.v1.projects.billing.fields.FieldsClient; -import resources.manage.v1.projects.billing.purchases.PurchasesClient; - -public class BillingClient { - protected final ClientOptions clientOptions; - - protected final Supplier balancesClient; - - protected final Supplier breakdownClient; - - protected final Supplier fieldsClient; - - protected final Supplier purchasesClient; - - public BillingClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.balancesClient = Suppliers.memoize(() -> new BalancesClient(clientOptions)); - this.breakdownClient = Suppliers.memoize(() -> new BreakdownClient(clientOptions)); - this.fieldsClient = Suppliers.memoize(() -> new FieldsClient(clientOptions)); - this.purchasesClient = Suppliers.memoize(() -> new PurchasesClient(clientOptions)); - } - - public BalancesClient balances() { - return this.balancesClient.get(); - } - - public BreakdownClient breakdown() { - return this.breakdownClient.get(); - } - - public FieldsClient fields() { - return this.fieldsClient.get(); - } - - public PurchasesClient purchases() { - return this.purchasesClient.get(); - } -} diff --git a/src/main/java/resources/manage/v1/projects/billing/balances/AsyncBalancesClient.java b/src/main/java/resources/manage/v1/projects/billing/balances/AsyncBalancesClient.java deleted file mode 100644 index 02737bc..0000000 --- a/src/main/java/resources/manage/v1/projects/billing/balances/AsyncBalancesClient.java +++ /dev/null @@ -1,48 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.billing.balances; - -import core.ClientOptions; -import core.RequestOptions; -import java.util.concurrent.CompletableFuture; -import types.GetProjectBalanceV1Response; -import types.ListProjectBalancesV1Response; - -public class AsyncBalancesClient { - protected final ClientOptions clientOptions; - - private final AsyncRawBalancesClient rawClient; - - public AsyncBalancesClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new AsyncRawBalancesClient(clientOptions); - } - - /** Get responses with HTTP metadata like headers */ - public AsyncRawBalancesClient withRawResponse() { - return this.rawClient; - } - - /** Generates a list of outstanding balances for the specified project */ - public CompletableFuture list(String projectId) { - return this.rawClient.list(projectId).thenApply(response -> response.body()); - } - - /** Generates a list of outstanding balances for the specified project */ - public CompletableFuture list( - String projectId, RequestOptions requestOptions) { - return this.rawClient.list(projectId, requestOptions).thenApply(response -> response.body()); - } - - /** Retrieves details about the specified balance */ - public CompletableFuture get(String projectId, String balanceId) { - return this.rawClient.get(projectId, balanceId).thenApply(response -> response.body()); - } - - /** Retrieves details about the specified balance */ - public CompletableFuture get( - String projectId, String balanceId, RequestOptions requestOptions) { - return this.rawClient - .get(projectId, balanceId, requestOptions) - .thenApply(response -> response.body()); - } -} diff --git a/src/main/java/resources/manage/v1/projects/billing/balances/AsyncRawBalancesClient.java b/src/main/java/resources/manage/v1/projects/billing/balances/AsyncRawBalancesClient.java deleted file mode 100644 index c8f8472..0000000 --- a/src/main/java/resources/manage/v1/projects/billing/balances/AsyncRawBalancesClient.java +++ /dev/null @@ -1,207 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.billing.balances; - -import com.fasterxml.jackson.core.JsonProcessingException; -import core.ClientOptions; -import core.DeepgramApiApiException; -import core.DeepgramApiException; -import core.DeepgramApiHttpResponse; -import core.ObjectMappers; -import core.RequestOptions; -import errors.BadRequestError; -import java.io.IOException; -import java.util.concurrent.CompletableFuture; -import okhttp3.Call; -import okhttp3.Callback; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import okhttp3.ResponseBody; -import org.jetbrains.annotations.NotNull; -import types.GetProjectBalanceV1Response; -import types.ListProjectBalancesV1Response; - -public class AsyncRawBalancesClient { - protected final ClientOptions clientOptions; - - public AsyncRawBalancesClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** Generates a list of outstanding balances for the specified project */ - public CompletableFuture> list( - String projectId) { - return list(projectId, null); - } - - /** Generates a list of outstanding balances for the specified project */ - public CompletableFuture> list( - String projectId, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("balances"); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = - new CompletableFuture<>(); - client - .newCall(okhttpRequest) - .enqueue( - new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) - throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete( - new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, ListProjectBalancesV1Response.class), - response)); - return; - } - try { - if (response.code() == 400) { - future.completeExceptionally( - new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally( - new DeepgramApiApiException( - "Error with status code " + response.code(), - response.code(), - errorBody, - response)); - return; - } catch (IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - }); - return future; - } - - /** Retrieves details about the specified balance */ - public CompletableFuture> get( - String projectId, String balanceId) { - return get(projectId, balanceId, null); - } - - /** Retrieves details about the specified balance */ - public CompletableFuture> get( - String projectId, String balanceId, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("balances") - .addPathSegment(balanceId); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = - new CompletableFuture<>(); - client - .newCall(okhttpRequest) - .enqueue( - new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) - throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete( - new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, GetProjectBalanceV1Response.class), - response)); - return; - } - try { - if (response.code() == 400) { - future.completeExceptionally( - new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally( - new DeepgramApiApiException( - "Error with status code " + response.code(), - response.code(), - errorBody, - response)); - return; - } catch (IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - }); - return future; - } -} diff --git a/src/main/java/resources/manage/v1/projects/billing/balances/BalancesClient.java b/src/main/java/resources/manage/v1/projects/billing/balances/BalancesClient.java deleted file mode 100644 index 7b628d0..0000000 --- a/src/main/java/resources/manage/v1/projects/billing/balances/BalancesClient.java +++ /dev/null @@ -1,44 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.billing.balances; - -import core.ClientOptions; -import core.RequestOptions; -import types.GetProjectBalanceV1Response; -import types.ListProjectBalancesV1Response; - -public class BalancesClient { - protected final ClientOptions clientOptions; - - private final RawBalancesClient rawClient; - - public BalancesClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new RawBalancesClient(clientOptions); - } - - /** Get responses with HTTP metadata like headers */ - public RawBalancesClient withRawResponse() { - return this.rawClient; - } - - /** Generates a list of outstanding balances for the specified project */ - public ListProjectBalancesV1Response list(String projectId) { - return this.rawClient.list(projectId).body(); - } - - /** Generates a list of outstanding balances for the specified project */ - public ListProjectBalancesV1Response list(String projectId, RequestOptions requestOptions) { - return this.rawClient.list(projectId, requestOptions).body(); - } - - /** Retrieves details about the specified balance */ - public GetProjectBalanceV1Response get(String projectId, String balanceId) { - return this.rawClient.get(projectId, balanceId).body(); - } - - /** Retrieves details about the specified balance */ - public GetProjectBalanceV1Response get( - String projectId, String balanceId, RequestOptions requestOptions) { - return this.rawClient.get(projectId, balanceId, requestOptions).body(); - } -} diff --git a/src/main/java/resources/manage/v1/projects/billing/balances/RawBalancesClient.java b/src/main/java/resources/manage/v1/projects/billing/balances/RawBalancesClient.java deleted file mode 100644 index 504e2be..0000000 --- a/src/main/java/resources/manage/v1/projects/billing/balances/RawBalancesClient.java +++ /dev/null @@ -1,146 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.billing.balances; - -import com.fasterxml.jackson.core.JsonProcessingException; -import core.ClientOptions; -import core.DeepgramApiApiException; -import core.DeepgramApiException; -import core.DeepgramApiHttpResponse; -import core.ObjectMappers; -import core.RequestOptions; -import errors.BadRequestError; -import java.io.IOException; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import okhttp3.ResponseBody; -import types.GetProjectBalanceV1Response; -import types.ListProjectBalancesV1Response; - -public class RawBalancesClient { - protected final ClientOptions clientOptions; - - public RawBalancesClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** Generates a list of outstanding balances for the specified project */ - public DeepgramApiHttpResponse list(String projectId) { - return list(projectId, null); - } - - /** Generates a list of outstanding balances for the specified project */ - public DeepgramApiHttpResponse list( - String projectId, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("balances"); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "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(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, ListProjectBalancesV1Response.class), - response); - } - try { - if (response.code() == 400) { - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new DeepgramApiApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (IOException e) { - throw new DeepgramApiException("Network error executing HTTP request", e); - } - } - - /** Retrieves details about the specified balance */ - public DeepgramApiHttpResponse get( - String projectId, String balanceId) { - return get(projectId, balanceId, null); - } - - /** Retrieves details about the specified balance */ - public DeepgramApiHttpResponse get( - String projectId, String balanceId, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("balances") - .addPathSegment(balanceId); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "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(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, GetProjectBalanceV1Response.class), - response); - } - try { - if (response.code() == 400) { - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new DeepgramApiApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (IOException e) { - throw new DeepgramApiException("Network error executing HTTP request", e); - } - } -} diff --git a/src/main/java/resources/manage/v1/projects/billing/breakdown/AsyncBreakdownClient.java b/src/main/java/resources/manage/v1/projects/billing/breakdown/AsyncBreakdownClient.java deleted file mode 100644 index 0ae83d3..0000000 --- a/src/main/java/resources/manage/v1/projects/billing/breakdown/AsyncBreakdownClient.java +++ /dev/null @@ -1,61 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.billing.breakdown; - -import core.ClientOptions; -import core.RequestOptions; -import java.util.concurrent.CompletableFuture; -import resources.manage.v1.projects.billing.breakdown.requests.BreakdownListRequest; -import types.BillingBreakdownV1Response; - -public class AsyncBreakdownClient { - protected final ClientOptions clientOptions; - - private final AsyncRawBreakdownClient rawClient; - - public AsyncBreakdownClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new AsyncRawBreakdownClient(clientOptions); - } - - /** Get responses with HTTP metadata like headers */ - public AsyncRawBreakdownClient withRawResponse() { - return this.rawClient; - } - - /** - * Retrieves the billing summary for a specific project, with various filter options or by - * grouping options. - */ - public CompletableFuture list(String projectId) { - return this.rawClient.list(projectId).thenApply(response -> response.body()); - } - - /** - * Retrieves the billing summary for a specific project, with various filter options or by - * grouping options. - */ - public CompletableFuture list( - String projectId, RequestOptions requestOptions) { - return this.rawClient.list(projectId, requestOptions).thenApply(response -> response.body()); - } - - /** - * Retrieves the billing summary for a specific project, with various filter options or by - * grouping options. - */ - public CompletableFuture list( - String projectId, BreakdownListRequest request) { - return this.rawClient.list(projectId, request).thenApply(response -> response.body()); - } - - /** - * Retrieves the billing summary for a specific project, with various filter options or by - * grouping options. - */ - public CompletableFuture list( - String projectId, BreakdownListRequest request, RequestOptions requestOptions) { - return this.rawClient - .list(projectId, request, requestOptions) - .thenApply(response -> response.body()); - } -} diff --git a/src/main/java/resources/manage/v1/projects/billing/breakdown/AsyncRawBreakdownClient.java b/src/main/java/resources/manage/v1/projects/billing/breakdown/AsyncRawBreakdownClient.java deleted file mode 100644 index 43b58fc..0000000 --- a/src/main/java/resources/manage/v1/projects/billing/breakdown/AsyncRawBreakdownClient.java +++ /dev/null @@ -1,167 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.billing.breakdown; - -import com.fasterxml.jackson.core.JsonProcessingException; -import core.ClientOptions; -import core.DeepgramApiApiException; -import core.DeepgramApiException; -import core.DeepgramApiHttpResponse; -import core.ObjectMappers; -import core.QueryStringMapper; -import core.RequestOptions; -import errors.BadRequestError; -import java.io.IOException; -import java.util.concurrent.CompletableFuture; -import okhttp3.Call; -import okhttp3.Callback; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import okhttp3.ResponseBody; -import org.jetbrains.annotations.NotNull; -import resources.manage.v1.projects.billing.breakdown.requests.BreakdownListRequest; -import types.BillingBreakdownV1Response; - -public class AsyncRawBreakdownClient { - protected final ClientOptions clientOptions; - - public AsyncRawBreakdownClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** - * Retrieves the billing summary for a specific project, with various filter options or by - * grouping options. - */ - public CompletableFuture> list( - String projectId) { - return list(projectId, BreakdownListRequest.builder().build()); - } - - /** - * Retrieves the billing summary for a specific project, with various filter options or by - * grouping options. - */ - public CompletableFuture> list( - String projectId, RequestOptions requestOptions) { - return list(projectId, BreakdownListRequest.builder().build(), requestOptions); - } - - /** - * Retrieves the billing summary for a specific project, with various filter options or by - * grouping options. - */ - public CompletableFuture> list( - String projectId, BreakdownListRequest request) { - return list(projectId, request, null); - } - - /** - * Retrieves the billing summary for a specific project, with various filter options or by - * grouping options. - */ - public CompletableFuture> list( - String projectId, BreakdownListRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("billing") - .addPathSegments("breakdown"); - if (request.getStart().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "start", request.getStart().get(), false); - } - if (request.getEnd().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "end", request.getEnd().get(), false); - } - if (request.getAccessor().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "accessor", request.getAccessor().get(), false); - } - if (request.getDeployment().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "deployment", request.getDeployment().get(), false); - } - if (request.getTag().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "tag", request.getTag().get(), false); - } - if (request.getLineItem().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "line_item", request.getLineItem().get(), false); - } - if (request.getGrouping().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "grouping", request.getGrouping().get(), true); - } - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request.Builder _requestBuilder = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json"); - Request okhttpRequest = _requestBuilder.build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = - new CompletableFuture<>(); - client - .newCall(okhttpRequest) - .enqueue( - new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) - throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete( - new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, BillingBreakdownV1Response.class), - response)); - return; - } - try { - if (response.code() == 400) { - future.completeExceptionally( - new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally( - new DeepgramApiApiException( - "Error with status code " + response.code(), - response.code(), - errorBody, - response)); - return; - } catch (IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - }); - return future; - } -} diff --git a/src/main/java/resources/manage/v1/projects/billing/breakdown/BreakdownClient.java b/src/main/java/resources/manage/v1/projects/billing/breakdown/BreakdownClient.java deleted file mode 100644 index 23c1b00..0000000 --- a/src/main/java/resources/manage/v1/projects/billing/breakdown/BreakdownClient.java +++ /dev/null @@ -1,56 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.billing.breakdown; - -import core.ClientOptions; -import core.RequestOptions; -import resources.manage.v1.projects.billing.breakdown.requests.BreakdownListRequest; -import types.BillingBreakdownV1Response; - -public class BreakdownClient { - protected final ClientOptions clientOptions; - - private final RawBreakdownClient rawClient; - - public BreakdownClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new RawBreakdownClient(clientOptions); - } - - /** Get responses with HTTP metadata like headers */ - public RawBreakdownClient withRawResponse() { - return this.rawClient; - } - - /** - * Retrieves the billing summary for a specific project, with various filter options or by - * grouping options. - */ - public BillingBreakdownV1Response list(String projectId) { - return this.rawClient.list(projectId).body(); - } - - /** - * Retrieves the billing summary for a specific project, with various filter options or by - * grouping options. - */ - public BillingBreakdownV1Response list(String projectId, RequestOptions requestOptions) { - return this.rawClient.list(projectId, requestOptions).body(); - } - - /** - * Retrieves the billing summary for a specific project, with various filter options or by - * grouping options. - */ - public BillingBreakdownV1Response list(String projectId, BreakdownListRequest request) { - return this.rawClient.list(projectId, request).body(); - } - - /** - * Retrieves the billing summary for a specific project, with various filter options or by - * grouping options. - */ - public BillingBreakdownV1Response list( - String projectId, BreakdownListRequest request, RequestOptions requestOptions) { - return this.rawClient.list(projectId, request, requestOptions).body(); - } -} diff --git a/src/main/java/resources/manage/v1/projects/billing/breakdown/RawBreakdownClient.java b/src/main/java/resources/manage/v1/projects/billing/breakdown/RawBreakdownClient.java deleted file mode 100644 index e4d0b63..0000000 --- a/src/main/java/resources/manage/v1/projects/billing/breakdown/RawBreakdownClient.java +++ /dev/null @@ -1,134 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.billing.breakdown; - -import com.fasterxml.jackson.core.JsonProcessingException; -import core.ClientOptions; -import core.DeepgramApiApiException; -import core.DeepgramApiException; -import core.DeepgramApiHttpResponse; -import core.ObjectMappers; -import core.QueryStringMapper; -import core.RequestOptions; -import errors.BadRequestError; -import java.io.IOException; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import okhttp3.ResponseBody; -import resources.manage.v1.projects.billing.breakdown.requests.BreakdownListRequest; -import types.BillingBreakdownV1Response; - -public class RawBreakdownClient { - protected final ClientOptions clientOptions; - - public RawBreakdownClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** - * Retrieves the billing summary for a specific project, with various filter options or by - * grouping options. - */ - public DeepgramApiHttpResponse list(String projectId) { - return list(projectId, BreakdownListRequest.builder().build()); - } - - /** - * Retrieves the billing summary for a specific project, with various filter options or by - * grouping options. - */ - public DeepgramApiHttpResponse list( - String projectId, RequestOptions requestOptions) { - return list(projectId, BreakdownListRequest.builder().build(), requestOptions); - } - - /** - * Retrieves the billing summary for a specific project, with various filter options or by - * grouping options. - */ - public DeepgramApiHttpResponse list( - String projectId, BreakdownListRequest request) { - return list(projectId, request, null); - } - - /** - * Retrieves the billing summary for a specific project, with various filter options or by - * grouping options. - */ - public DeepgramApiHttpResponse list( - String projectId, BreakdownListRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("billing") - .addPathSegments("breakdown"); - if (request.getStart().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "start", request.getStart().get(), false); - } - if (request.getEnd().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "end", request.getEnd().get(), false); - } - if (request.getAccessor().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "accessor", request.getAccessor().get(), false); - } - if (request.getDeployment().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "deployment", request.getDeployment().get(), false); - } - if (request.getTag().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "tag", request.getTag().get(), false); - } - if (request.getLineItem().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "line_item", request.getLineItem().get(), false); - } - if (request.getGrouping().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "grouping", request.getGrouping().get(), true); - } - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request.Builder _requestBuilder = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "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(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, BillingBreakdownV1Response.class), - response); - } - try { - if (response.code() == 400) { - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new DeepgramApiApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (IOException e) { - throw new DeepgramApiException("Network error executing HTTP request", e); - } - } -} diff --git a/src/main/java/resources/manage/v1/projects/billing/breakdown/requests/BreakdownListRequest.java b/src/main/java/resources/manage/v1/projects/billing/breakdown/requests/BreakdownListRequest.java deleted file mode 100644 index 3cfc1cd..0000000 --- a/src/main/java/resources/manage/v1/projects/billing/breakdown/requests/BreakdownListRequest.java +++ /dev/null @@ -1,294 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.billing.breakdown.requests; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import core.ObjectMappers; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import resources.manage.v1.projects.billing.breakdown.types.BreakdownListRequestDeployment; -import resources.manage.v1.projects.billing.breakdown.types.BreakdownListRequestGroupingItem; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = BreakdownListRequest.Builder.class) -public final class BreakdownListRequest { - private final Optional> grouping; - - private final Optional start; - - private final Optional end; - - private final Optional accessor; - - private final Optional deployment; - - private final Optional tag; - - private final Optional lineItem; - - private final Map additionalProperties; - - private BreakdownListRequest( - Optional> grouping, - Optional start, - Optional end, - Optional accessor, - Optional deployment, - Optional tag, - Optional lineItem, - Map additionalProperties) { - this.grouping = grouping; - this.start = start; - this.end = end; - this.accessor = accessor; - this.deployment = deployment; - this.tag = tag; - this.lineItem = lineItem; - this.additionalProperties = additionalProperties; - } - - /** - * @return Group billing breakdown by one or more dimensions (accessor, deployment, line_item, - * tags) - */ - @JsonIgnore - public Optional> getGrouping() { - return grouping; - } - - /** - * @return Start date of the requested date range. Format accepted is YYYY-MM-DD - */ - @JsonIgnore - public Optional getStart() { - return start; - } - - /** - * @return End date of the requested date range. Format accepted is YYYY-MM-DD - */ - @JsonIgnore - public Optional getEnd() { - return end; - } - - /** - * @return Filter for requests where a specific accessor was used - */ - @JsonIgnore - public Optional getAccessor() { - return accessor; - } - - /** - * @return Filter for requests where a specific deployment was used - */ - @JsonIgnore - public Optional getDeployment() { - return deployment; - } - - /** - * @return Filter for requests where a specific tag was used - */ - @JsonIgnore - public Optional getTag() { - return tag; - } - - /** - * @return Filter requests by line item (e.g. streaming::nova-3) - */ - @JsonIgnore - public Optional getLineItem() { - return lineItem; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof BreakdownListRequest && equalTo((BreakdownListRequest) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(BreakdownListRequest other) { - return grouping.equals(other.grouping) - && start.equals(other.start) - && end.equals(other.end) - && accessor.equals(other.accessor) - && deployment.equals(other.deployment) - && tag.equals(other.tag) - && lineItem.equals(other.lineItem); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.grouping, - this.start, - this.end, - this.accessor, - this.deployment, - this.tag, - this.lineItem); - } - - @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> grouping = Optional.empty(); - - private Optional start = Optional.empty(); - - private Optional end = Optional.empty(); - - private Optional accessor = Optional.empty(); - - private Optional deployment = Optional.empty(); - - private Optional tag = Optional.empty(); - - private Optional lineItem = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(BreakdownListRequest other) { - grouping(other.getGrouping()); - start(other.getStart()); - end(other.getEnd()); - accessor(other.getAccessor()); - deployment(other.getDeployment()); - tag(other.getTag()); - lineItem(other.getLineItem()); - return this; - } - - /** Group billing breakdown by one or more dimensions (accessor, deployment, line_item, tags) */ - @JsonSetter(value = "grouping", nulls = Nulls.SKIP) - public Builder grouping(Optional> grouping) { - this.grouping = grouping; - return this; - } - - public Builder grouping(List grouping) { - this.grouping = Optional.ofNullable(grouping); - return this; - } - - public Builder grouping(BreakdownListRequestGroupingItem grouping) { - this.grouping = Optional.of(Collections.singletonList(grouping)); - return this; - } - - /** Start date of the requested date range. Format accepted is YYYY-MM-DD */ - @JsonSetter(value = "start", nulls = Nulls.SKIP) - public Builder start(Optional start) { - this.start = start; - return this; - } - - public Builder start(String start) { - this.start = Optional.ofNullable(start); - return this; - } - - /** End date of the requested date range. Format accepted is YYYY-MM-DD */ - @JsonSetter(value = "end", nulls = Nulls.SKIP) - public Builder end(Optional end) { - this.end = end; - return this; - } - - public Builder end(String end) { - this.end = Optional.ofNullable(end); - return this; - } - - /** Filter for requests where a specific accessor was used */ - @JsonSetter(value = "accessor", nulls = Nulls.SKIP) - public Builder accessor(Optional accessor) { - this.accessor = accessor; - return this; - } - - public Builder accessor(String accessor) { - this.accessor = Optional.ofNullable(accessor); - return this; - } - - /** Filter for requests where a specific deployment was used */ - @JsonSetter(value = "deployment", nulls = Nulls.SKIP) - public Builder deployment(Optional deployment) { - this.deployment = deployment; - return this; - } - - public Builder deployment(BreakdownListRequestDeployment deployment) { - this.deployment = Optional.ofNullable(deployment); - return this; - } - - /** Filter for requests where a specific tag was used */ - @JsonSetter(value = "tag", nulls = Nulls.SKIP) - public Builder tag(Optional tag) { - this.tag = tag; - return this; - } - - public Builder tag(String tag) { - this.tag = Optional.ofNullable(tag); - return this; - } - - /** Filter requests by line item (e.g. streaming::nova-3) */ - @JsonSetter(value = "line_item", nulls = Nulls.SKIP) - public Builder lineItem(Optional lineItem) { - this.lineItem = lineItem; - return this; - } - - public Builder lineItem(String lineItem) { - this.lineItem = Optional.ofNullable(lineItem); - return this; - } - - public BreakdownListRequest build() { - return new BreakdownListRequest( - grouping, start, end, accessor, deployment, tag, lineItem, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/manage/v1/projects/billing/breakdown/types/BreakdownListRequestDeployment.java b/src/main/java/resources/manage/v1/projects/billing/breakdown/types/BreakdownListRequestDeployment.java deleted file mode 100644 index 4509112..0000000 --- a/src/main/java/resources/manage/v1/projects/billing/breakdown/types/BreakdownListRequestDeployment.java +++ /dev/null @@ -1,95 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.billing.breakdown.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class BreakdownListRequestDeployment { - public static final BreakdownListRequestDeployment SELF_HOSTED = - new BreakdownListRequestDeployment(Value.SELF_HOSTED, "self-hosted"); - - public static final BreakdownListRequestDeployment BETA = - new BreakdownListRequestDeployment(Value.BETA, "beta"); - - public static final BreakdownListRequestDeployment HOSTED = - new BreakdownListRequestDeployment(Value.HOSTED, "hosted"); - - private final Value value; - - private final String string; - - BreakdownListRequestDeployment(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof BreakdownListRequestDeployment - && this.string.equals(((BreakdownListRequestDeployment) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case SELF_HOSTED: - return visitor.visitSelfHosted(); - case BETA: - return visitor.visitBeta(); - case HOSTED: - return visitor.visitHosted(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static BreakdownListRequestDeployment valueOf(String value) { - switch (value) { - case "self-hosted": - return SELF_HOSTED; - case "beta": - return BETA; - case "hosted": - return HOSTED; - default: - return new BreakdownListRequestDeployment(Value.UNKNOWN, value); - } - } - - public enum Value { - HOSTED, - - BETA, - - SELF_HOSTED, - - UNKNOWN - } - - public interface Visitor { - T visitHosted(); - - T visitBeta(); - - T visitSelfHosted(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/resources/manage/v1/projects/billing/breakdown/types/BreakdownListRequestGroupingItem.java b/src/main/java/resources/manage/v1/projects/billing/breakdown/types/BreakdownListRequestGroupingItem.java deleted file mode 100644 index 983ff8e..0000000 --- a/src/main/java/resources/manage/v1/projects/billing/breakdown/types/BreakdownListRequestGroupingItem.java +++ /dev/null @@ -1,106 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.billing.breakdown.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class BreakdownListRequestGroupingItem { - public static final BreakdownListRequestGroupingItem TAGS = - new BreakdownListRequestGroupingItem(Value.TAGS, "tags"); - - public static final BreakdownListRequestGroupingItem ACCESSOR = - new BreakdownListRequestGroupingItem(Value.ACCESSOR, "accessor"); - - public static final BreakdownListRequestGroupingItem DEPLOYMENT = - new BreakdownListRequestGroupingItem(Value.DEPLOYMENT, "deployment"); - - public static final BreakdownListRequestGroupingItem LINE_ITEM = - new BreakdownListRequestGroupingItem(Value.LINE_ITEM, "line_item"); - - private final Value value; - - private final String string; - - BreakdownListRequestGroupingItem(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof BreakdownListRequestGroupingItem - && this.string.equals(((BreakdownListRequestGroupingItem) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case TAGS: - return visitor.visitTags(); - case ACCESSOR: - return visitor.visitAccessor(); - case DEPLOYMENT: - return visitor.visitDeployment(); - case LINE_ITEM: - return visitor.visitLineItem(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static BreakdownListRequestGroupingItem valueOf(String value) { - switch (value) { - case "tags": - return TAGS; - case "accessor": - return ACCESSOR; - case "deployment": - return DEPLOYMENT; - case "line_item": - return LINE_ITEM; - default: - return new BreakdownListRequestGroupingItem(Value.UNKNOWN, value); - } - } - - public enum Value { - ACCESSOR, - - DEPLOYMENT, - - LINE_ITEM, - - TAGS, - - UNKNOWN - } - - public interface Visitor { - T visitAccessor(); - - T visitDeployment(); - - T visitLineItem(); - - T visitTags(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/resources/manage/v1/projects/billing/fields/AsyncFieldsClient.java b/src/main/java/resources/manage/v1/projects/billing/fields/AsyncFieldsClient.java deleted file mode 100644 index 8459590..0000000 --- a/src/main/java/resources/manage/v1/projects/billing/fields/AsyncFieldsClient.java +++ /dev/null @@ -1,65 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.billing.fields; - -import core.ClientOptions; -import core.RequestOptions; -import java.util.concurrent.CompletableFuture; -import resources.manage.v1.projects.billing.fields.requests.FieldsListRequest; -import types.ListBillingFieldsV1Response; - -public class AsyncFieldsClient { - protected final ClientOptions clientOptions; - - private final AsyncRawFieldsClient rawClient; - - public AsyncFieldsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new AsyncRawFieldsClient(clientOptions); - } - - /** Get responses with HTTP metadata like headers */ - public AsyncRawFieldsClient withRawResponse() { - return this.rawClient; - } - - /** - * Lists the accessors, deployment types, tags, and line items used for billing data in the - * specified time period. Use this endpoint if you want to filter your results from the Billing - * Breakdown endpoint and want to know what filters are available. - */ - public CompletableFuture list(String projectId) { - return this.rawClient.list(projectId).thenApply(response -> response.body()); - } - - /** - * Lists the accessors, deployment types, tags, and line items used for billing data in the - * specified time period. Use this endpoint if you want to filter your results from the Billing - * Breakdown endpoint and want to know what filters are available. - */ - public CompletableFuture list( - String projectId, RequestOptions requestOptions) { - return this.rawClient.list(projectId, requestOptions).thenApply(response -> response.body()); - } - - /** - * Lists the accessors, deployment types, tags, and line items used for billing data in the - * specified time period. Use this endpoint if you want to filter your results from the Billing - * Breakdown endpoint and want to know what filters are available. - */ - public CompletableFuture list( - String projectId, FieldsListRequest request) { - return this.rawClient.list(projectId, request).thenApply(response -> response.body()); - } - - /** - * Lists the accessors, deployment types, tags, and line items used for billing data in the - * specified time period. Use this endpoint if you want to filter your results from the Billing - * Breakdown endpoint and want to know what filters are available. - */ - public CompletableFuture list( - String projectId, FieldsListRequest request, RequestOptions requestOptions) { - return this.rawClient - .list(projectId, request, requestOptions) - .thenApply(response -> response.body()); - } -} diff --git a/src/main/java/resources/manage/v1/projects/billing/fields/AsyncRawFieldsClient.java b/src/main/java/resources/manage/v1/projects/billing/fields/AsyncRawFieldsClient.java deleted file mode 100644 index 73eb78f..0000000 --- a/src/main/java/resources/manage/v1/projects/billing/fields/AsyncRawFieldsClient.java +++ /dev/null @@ -1,155 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.billing.fields; - -import com.fasterxml.jackson.core.JsonProcessingException; -import core.ClientOptions; -import core.DeepgramApiApiException; -import core.DeepgramApiException; -import core.DeepgramApiHttpResponse; -import core.ObjectMappers; -import core.QueryStringMapper; -import core.RequestOptions; -import errors.BadRequestError; -import java.io.IOException; -import java.util.concurrent.CompletableFuture; -import okhttp3.Call; -import okhttp3.Callback; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import okhttp3.ResponseBody; -import org.jetbrains.annotations.NotNull; -import resources.manage.v1.projects.billing.fields.requests.FieldsListRequest; -import types.ListBillingFieldsV1Response; - -public class AsyncRawFieldsClient { - protected final ClientOptions clientOptions; - - public AsyncRawFieldsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** - * Lists the accessors, deployment types, tags, and line items used for billing data in the - * specified time period. Use this endpoint if you want to filter your results from the Billing - * Breakdown endpoint and want to know what filters are available. - */ - public CompletableFuture> list( - String projectId) { - return list(projectId, FieldsListRequest.builder().build()); - } - - /** - * Lists the accessors, deployment types, tags, and line items used for billing data in the - * specified time period. Use this endpoint if you want to filter your results from the Billing - * Breakdown endpoint and want to know what filters are available. - */ - public CompletableFuture> list( - String projectId, RequestOptions requestOptions) { - return list(projectId, FieldsListRequest.builder().build(), requestOptions); - } - - /** - * Lists the accessors, deployment types, tags, and line items used for billing data in the - * specified time period. Use this endpoint if you want to filter your results from the Billing - * Breakdown endpoint and want to know what filters are available. - */ - public CompletableFuture> list( - String projectId, FieldsListRequest request) { - return list(projectId, request, null); - } - - /** - * Lists the accessors, deployment types, tags, and line items used for billing data in the - * specified time period. Use this endpoint if you want to filter your results from the Billing - * Breakdown endpoint and want to know what filters are available. - */ - public CompletableFuture> list( - String projectId, FieldsListRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("billing") - .addPathSegments("fields"); - if (request.getStart().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "start", request.getStart().get(), false); - } - if (request.getEnd().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "end", request.getEnd().get(), false); - } - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request.Builder _requestBuilder = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json"); - Request okhttpRequest = _requestBuilder.build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = - new CompletableFuture<>(); - client - .newCall(okhttpRequest) - .enqueue( - new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) - throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete( - new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, ListBillingFieldsV1Response.class), - response)); - return; - } - try { - if (response.code() == 400) { - future.completeExceptionally( - new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally( - new DeepgramApiApiException( - "Error with status code " + response.code(), - response.code(), - errorBody, - response)); - return; - } catch (IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - }); - return future; - } -} diff --git a/src/main/java/resources/manage/v1/projects/billing/fields/FieldsClient.java b/src/main/java/resources/manage/v1/projects/billing/fields/FieldsClient.java deleted file mode 100644 index 75c213a..0000000 --- a/src/main/java/resources/manage/v1/projects/billing/fields/FieldsClient.java +++ /dev/null @@ -1,60 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.billing.fields; - -import core.ClientOptions; -import core.RequestOptions; -import resources.manage.v1.projects.billing.fields.requests.FieldsListRequest; -import types.ListBillingFieldsV1Response; - -public class FieldsClient { - protected final ClientOptions clientOptions; - - private final RawFieldsClient rawClient; - - public FieldsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new RawFieldsClient(clientOptions); - } - - /** Get responses with HTTP metadata like headers */ - public RawFieldsClient withRawResponse() { - return this.rawClient; - } - - /** - * Lists the accessors, deployment types, tags, and line items used for billing data in the - * specified time period. Use this endpoint if you want to filter your results from the Billing - * Breakdown endpoint and want to know what filters are available. - */ - public ListBillingFieldsV1Response list(String projectId) { - return this.rawClient.list(projectId).body(); - } - - /** - * Lists the accessors, deployment types, tags, and line items used for billing data in the - * specified time period. Use this endpoint if you want to filter your results from the Billing - * Breakdown endpoint and want to know what filters are available. - */ - public ListBillingFieldsV1Response list(String projectId, RequestOptions requestOptions) { - return this.rawClient.list(projectId, requestOptions).body(); - } - - /** - * Lists the accessors, deployment types, tags, and line items used for billing data in the - * specified time period. Use this endpoint if you want to filter your results from the Billing - * Breakdown endpoint and want to know what filters are available. - */ - public ListBillingFieldsV1Response list(String projectId, FieldsListRequest request) { - return this.rawClient.list(projectId, request).body(); - } - - /** - * Lists the accessors, deployment types, tags, and line items used for billing data in the - * specified time period. Use this endpoint if you want to filter your results from the Billing - * Breakdown endpoint and want to know what filters are available. - */ - public ListBillingFieldsV1Response list( - String projectId, FieldsListRequest request, RequestOptions requestOptions) { - return this.rawClient.list(projectId, request, requestOptions).body(); - } -} diff --git a/src/main/java/resources/manage/v1/projects/billing/fields/RawFieldsClient.java b/src/main/java/resources/manage/v1/projects/billing/fields/RawFieldsClient.java deleted file mode 100644 index fa31ff0..0000000 --- a/src/main/java/resources/manage/v1/projects/billing/fields/RawFieldsClient.java +++ /dev/null @@ -1,122 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.billing.fields; - -import com.fasterxml.jackson.core.JsonProcessingException; -import core.ClientOptions; -import core.DeepgramApiApiException; -import core.DeepgramApiException; -import core.DeepgramApiHttpResponse; -import core.ObjectMappers; -import core.QueryStringMapper; -import core.RequestOptions; -import errors.BadRequestError; -import java.io.IOException; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import okhttp3.ResponseBody; -import resources.manage.v1.projects.billing.fields.requests.FieldsListRequest; -import types.ListBillingFieldsV1Response; - -public class RawFieldsClient { - protected final ClientOptions clientOptions; - - public RawFieldsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** - * Lists the accessors, deployment types, tags, and line items used for billing data in the - * specified time period. Use this endpoint if you want to filter your results from the Billing - * Breakdown endpoint and want to know what filters are available. - */ - public DeepgramApiHttpResponse list(String projectId) { - return list(projectId, FieldsListRequest.builder().build()); - } - - /** - * Lists the accessors, deployment types, tags, and line items used for billing data in the - * specified time period. Use this endpoint if you want to filter your results from the Billing - * Breakdown endpoint and want to know what filters are available. - */ - public DeepgramApiHttpResponse list( - String projectId, RequestOptions requestOptions) { - return list(projectId, FieldsListRequest.builder().build(), requestOptions); - } - - /** - * Lists the accessors, deployment types, tags, and line items used for billing data in the - * specified time period. Use this endpoint if you want to filter your results from the Billing - * Breakdown endpoint and want to know what filters are available. - */ - public DeepgramApiHttpResponse list( - String projectId, FieldsListRequest request) { - return list(projectId, request, null); - } - - /** - * Lists the accessors, deployment types, tags, and line items used for billing data in the - * specified time period. Use this endpoint if you want to filter your results from the Billing - * Breakdown endpoint and want to know what filters are available. - */ - public DeepgramApiHttpResponse list( - String projectId, FieldsListRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("billing") - .addPathSegments("fields"); - if (request.getStart().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "start", request.getStart().get(), false); - } - if (request.getEnd().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "end", request.getEnd().get(), false); - } - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request.Builder _requestBuilder = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "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(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, ListBillingFieldsV1Response.class), - response); - } - try { - if (response.code() == 400) { - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new DeepgramApiApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (IOException e) { - throw new DeepgramApiException("Network error executing HTTP request", e); - } - } -} diff --git a/src/main/java/resources/manage/v1/projects/billing/fields/requests/FieldsListRequest.java b/src/main/java/resources/manage/v1/projects/billing/fields/requests/FieldsListRequest.java deleted file mode 100644 index 71d6f5e..0000000 --- a/src/main/java/resources/manage/v1/projects/billing/fields/requests/FieldsListRequest.java +++ /dev/null @@ -1,133 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.billing.fields.requests; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import 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 = FieldsListRequest.Builder.class) -public final class FieldsListRequest { - private final Optional start; - - private final Optional end; - - private final Map additionalProperties; - - private FieldsListRequest( - Optional start, Optional end, Map additionalProperties) { - this.start = start; - this.end = end; - this.additionalProperties = additionalProperties; - } - - /** - * @return Start date of the requested date range. Format accepted is YYYY-MM-DD - */ - @JsonIgnore - public Optional getStart() { - return start; - } - - /** - * @return End date of the requested date range. Format accepted is YYYY-MM-DD - */ - @JsonIgnore - public Optional getEnd() { - return end; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof FieldsListRequest && equalTo((FieldsListRequest) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(FieldsListRequest other) { - return start.equals(other.start) && end.equals(other.end); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.start, this.end); - } - - @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 start = Optional.empty(); - - private Optional end = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(FieldsListRequest other) { - start(other.getStart()); - end(other.getEnd()); - return this; - } - - /** Start date of the requested date range. Format accepted is YYYY-MM-DD */ - @JsonSetter(value = "start", nulls = Nulls.SKIP) - public Builder start(Optional start) { - this.start = start; - return this; - } - - public Builder start(String start) { - this.start = Optional.ofNullable(start); - return this; - } - - /** End date of the requested date range. Format accepted is YYYY-MM-DD */ - @JsonSetter(value = "end", nulls = Nulls.SKIP) - public Builder end(Optional end) { - this.end = end; - return this; - } - - public Builder end(String end) { - this.end = Optional.ofNullable(end); - return this; - } - - public FieldsListRequest build() { - return new FieldsListRequest(start, end, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/manage/v1/projects/billing/purchases/AsyncPurchasesClient.java b/src/main/java/resources/manage/v1/projects/billing/purchases/AsyncPurchasesClient.java deleted file mode 100644 index 9b9dffa..0000000 --- a/src/main/java/resources/manage/v1/projects/billing/purchases/AsyncPurchasesClient.java +++ /dev/null @@ -1,49 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.billing.purchases; - -import core.ClientOptions; -import core.RequestOptions; -import java.util.concurrent.CompletableFuture; -import resources.manage.v1.projects.billing.purchases.requests.PurchasesListRequest; -import types.ListProjectPurchasesV1Response; - -public class AsyncPurchasesClient { - protected final ClientOptions clientOptions; - - private final AsyncRawPurchasesClient rawClient; - - public AsyncPurchasesClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new AsyncRawPurchasesClient(clientOptions); - } - - /** Get responses with HTTP metadata like headers */ - public AsyncRawPurchasesClient withRawResponse() { - return this.rawClient; - } - - /** Returns the original purchased amount on an order transaction */ - public CompletableFuture list(String projectId) { - return this.rawClient.list(projectId).thenApply(response -> response.body()); - } - - /** Returns the original purchased amount on an order transaction */ - public CompletableFuture list( - String projectId, RequestOptions requestOptions) { - return this.rawClient.list(projectId, requestOptions).thenApply(response -> response.body()); - } - - /** Returns the original purchased amount on an order transaction */ - public CompletableFuture list( - String projectId, PurchasesListRequest request) { - return this.rawClient.list(projectId, request).thenApply(response -> response.body()); - } - - /** Returns the original purchased amount on an order transaction */ - public CompletableFuture list( - String projectId, PurchasesListRequest request, RequestOptions requestOptions) { - return this.rawClient - .list(projectId, request, requestOptions) - .thenApply(response -> response.body()); - } -} diff --git a/src/main/java/resources/manage/v1/projects/billing/purchases/AsyncRawPurchasesClient.java b/src/main/java/resources/manage/v1/projects/billing/purchases/AsyncRawPurchasesClient.java deleted file mode 100644 index dc07126..0000000 --- a/src/main/java/resources/manage/v1/projects/billing/purchases/AsyncRawPurchasesClient.java +++ /dev/null @@ -1,135 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.billing.purchases; - -import com.fasterxml.jackson.core.JsonProcessingException; -import core.ClientOptions; -import core.DeepgramApiApiException; -import core.DeepgramApiException; -import core.DeepgramApiHttpResponse; -import core.ObjectMappers; -import core.QueryStringMapper; -import core.RequestOptions; -import errors.BadRequestError; -import java.io.IOException; -import java.util.concurrent.CompletableFuture; -import okhttp3.Call; -import okhttp3.Callback; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import okhttp3.ResponseBody; -import org.jetbrains.annotations.NotNull; -import resources.manage.v1.projects.billing.purchases.requests.PurchasesListRequest; -import types.ListProjectPurchasesV1Response; - -public class AsyncRawPurchasesClient { - protected final ClientOptions clientOptions; - - public AsyncRawPurchasesClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** Returns the original purchased amount on an order transaction */ - public CompletableFuture> list( - String projectId) { - return list(projectId, PurchasesListRequest.builder().build()); - } - - /** Returns the original purchased amount on an order transaction */ - public CompletableFuture> list( - String projectId, RequestOptions requestOptions) { - return list(projectId, PurchasesListRequest.builder().build(), requestOptions); - } - - /** Returns the original purchased amount on an order transaction */ - public CompletableFuture> list( - String projectId, PurchasesListRequest request) { - return list(projectId, request, null); - } - - /** Returns the original purchased amount on an order transaction */ - public CompletableFuture> list( - String projectId, PurchasesListRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("purchases"); - if (request.getLimit().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "limit", request.getLimit().get(), false); - } - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request.Builder _requestBuilder = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json"); - Request okhttpRequest = _requestBuilder.build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = - new CompletableFuture<>(); - client - .newCall(okhttpRequest) - .enqueue( - new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) - throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete( - new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, ListProjectPurchasesV1Response.class), - response)); - return; - } - try { - if (response.code() == 400) { - future.completeExceptionally( - new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally( - new DeepgramApiApiException( - "Error with status code " + response.code(), - response.code(), - errorBody, - response)); - return; - } catch (IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - }); - return future; - } -} diff --git a/src/main/java/resources/manage/v1/projects/billing/purchases/PurchasesClient.java b/src/main/java/resources/manage/v1/projects/billing/purchases/PurchasesClient.java deleted file mode 100644 index 4e4f3d5..0000000 --- a/src/main/java/resources/manage/v1/projects/billing/purchases/PurchasesClient.java +++ /dev/null @@ -1,44 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.billing.purchases; - -import core.ClientOptions; -import core.RequestOptions; -import resources.manage.v1.projects.billing.purchases.requests.PurchasesListRequest; -import types.ListProjectPurchasesV1Response; - -public class PurchasesClient { - protected final ClientOptions clientOptions; - - private final RawPurchasesClient rawClient; - - public PurchasesClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new RawPurchasesClient(clientOptions); - } - - /** Get responses with HTTP metadata like headers */ - public RawPurchasesClient withRawResponse() { - return this.rawClient; - } - - /** Returns the original purchased amount on an order transaction */ - public ListProjectPurchasesV1Response list(String projectId) { - return this.rawClient.list(projectId).body(); - } - - /** Returns the original purchased amount on an order transaction */ - public ListProjectPurchasesV1Response list(String projectId, RequestOptions requestOptions) { - return this.rawClient.list(projectId, requestOptions).body(); - } - - /** Returns the original purchased amount on an order transaction */ - public ListProjectPurchasesV1Response list(String projectId, PurchasesListRequest request) { - return this.rawClient.list(projectId, request).body(); - } - - /** Returns the original purchased amount on an order transaction */ - public ListProjectPurchasesV1Response list( - String projectId, PurchasesListRequest request, RequestOptions requestOptions) { - return this.rawClient.list(projectId, request, requestOptions).body(); - } -} diff --git a/src/main/java/resources/manage/v1/projects/billing/purchases/RawPurchasesClient.java b/src/main/java/resources/manage/v1/projects/billing/purchases/RawPurchasesClient.java deleted file mode 100644 index 5b5093b..0000000 --- a/src/main/java/resources/manage/v1/projects/billing/purchases/RawPurchasesClient.java +++ /dev/null @@ -1,102 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.billing.purchases; - -import com.fasterxml.jackson.core.JsonProcessingException; -import core.ClientOptions; -import core.DeepgramApiApiException; -import core.DeepgramApiException; -import core.DeepgramApiHttpResponse; -import core.ObjectMappers; -import core.QueryStringMapper; -import core.RequestOptions; -import errors.BadRequestError; -import java.io.IOException; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import okhttp3.ResponseBody; -import resources.manage.v1.projects.billing.purchases.requests.PurchasesListRequest; -import types.ListProjectPurchasesV1Response; - -public class RawPurchasesClient { - protected final ClientOptions clientOptions; - - public RawPurchasesClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** Returns the original purchased amount on an order transaction */ - public DeepgramApiHttpResponse list(String projectId) { - return list(projectId, PurchasesListRequest.builder().build()); - } - - /** Returns the original purchased amount on an order transaction */ - public DeepgramApiHttpResponse list( - String projectId, RequestOptions requestOptions) { - return list(projectId, PurchasesListRequest.builder().build(), requestOptions); - } - - /** Returns the original purchased amount on an order transaction */ - public DeepgramApiHttpResponse list( - String projectId, PurchasesListRequest request) { - return list(projectId, request, null); - } - - /** Returns the original purchased amount on an order transaction */ - public DeepgramApiHttpResponse list( - String projectId, PurchasesListRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("purchases"); - if (request.getLimit().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "limit", request.getLimit().get(), false); - } - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request.Builder _requestBuilder = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "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(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, ListProjectPurchasesV1Response.class), - response); - } - try { - if (response.code() == 400) { - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new DeepgramApiApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (IOException e) { - throw new DeepgramApiException("Network error executing HTTP request", e); - } - } -} diff --git a/src/main/java/resources/manage/v1/projects/billing/purchases/requests/PurchasesListRequest.java b/src/main/java/resources/manage/v1/projects/billing/purchases/requests/PurchasesListRequest.java deleted file mode 100644 index 79d4ce5..0000000 --- a/src/main/java/resources/manage/v1/projects/billing/purchases/requests/PurchasesListRequest.java +++ /dev/null @@ -1,106 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.billing.purchases.requests; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import 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 = PurchasesListRequest.Builder.class) -public final class PurchasesListRequest { - private final Optional limit; - - private final Map additionalProperties; - - private PurchasesListRequest(Optional limit, Map additionalProperties) { - this.limit = limit; - this.additionalProperties = additionalProperties; - } - - /** - * @return Number of results to return per page. Default 10. Range [1,1000] - */ - @JsonIgnore - public Optional getLimit() { - return limit; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof PurchasesListRequest && equalTo((PurchasesListRequest) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(PurchasesListRequest other) { - return limit.equals(other.limit); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.limit); - } - - @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(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(PurchasesListRequest other) { - limit(other.getLimit()); - return this; - } - - /** Number of results to return per page. Default 10. Range [1,1000] */ - @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; - } - - public PurchasesListRequest build() { - return new PurchasesListRequest(limit, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/manage/v1/projects/keys/AsyncKeysClient.java b/src/main/java/resources/manage/v1/projects/keys/AsyncKeysClient.java deleted file mode 100644 index 1e84624..0000000 --- a/src/main/java/resources/manage/v1/projects/keys/AsyncKeysClient.java +++ /dev/null @@ -1,93 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.keys; - -import core.ClientOptions; -import core.RequestOptions; -import java.util.concurrent.CompletableFuture; -import resources.manage.v1.projects.keys.requests.KeysListRequest; -import types.CreateKeyV1RequestOne; -import types.CreateKeyV1Response; -import types.DeleteProjectKeyV1Response; -import types.GetProjectKeyV1Response; -import types.ListProjectKeysV1Response; - -public class AsyncKeysClient { - protected final ClientOptions clientOptions; - - private final AsyncRawKeysClient rawClient; - - public AsyncKeysClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new AsyncRawKeysClient(clientOptions); - } - - /** Get responses with HTTP metadata like headers */ - public AsyncRawKeysClient withRawResponse() { - return this.rawClient; - } - - /** Retrieves all API keys associated with the specified project */ - public CompletableFuture list(String projectId) { - return this.rawClient.list(projectId).thenApply(response -> response.body()); - } - - /** Retrieves all API keys associated with the specified project */ - public CompletableFuture list( - String projectId, RequestOptions requestOptions) { - return this.rawClient.list(projectId, requestOptions).thenApply(response -> response.body()); - } - - /** Retrieves all API keys associated with the specified project */ - public CompletableFuture list( - String projectId, KeysListRequest request) { - return this.rawClient.list(projectId, request).thenApply(response -> response.body()); - } - - /** Retrieves all API keys associated with the specified project */ - public CompletableFuture list( - String projectId, KeysListRequest request, RequestOptions requestOptions) { - return this.rawClient - .list(projectId, request, requestOptions) - .thenApply(response -> response.body()); - } - - /** Creates a new API key with specified settings for the project */ - public CompletableFuture create( - String projectId, CreateKeyV1RequestOne request) { - return this.rawClient.create(projectId, request).thenApply(response -> response.body()); - } - - /** Creates a new API key with specified settings for the project */ - public CompletableFuture create( - String projectId, CreateKeyV1RequestOne request, RequestOptions requestOptions) { - return this.rawClient - .create(projectId, request, requestOptions) - .thenApply(response -> response.body()); - } - - /** Retrieves information about a specified API key */ - public CompletableFuture get(String projectId, String keyId) { - return this.rawClient.get(projectId, keyId).thenApply(response -> response.body()); - } - - /** Retrieves information about a specified API key */ - public CompletableFuture get( - String projectId, String keyId, RequestOptions requestOptions) { - return this.rawClient - .get(projectId, keyId, requestOptions) - .thenApply(response -> response.body()); - } - - /** Deletes an API key for a specific project */ - public CompletableFuture delete(String projectId, String keyId) { - return this.rawClient.delete(projectId, keyId).thenApply(response -> response.body()); - } - - /** Deletes an API key for a specific project */ - public CompletableFuture delete( - String projectId, String keyId, RequestOptions requestOptions) { - return this.rawClient - .delete(projectId, keyId, requestOptions) - .thenApply(response -> response.body()); - } -} diff --git a/src/main/java/resources/manage/v1/projects/keys/AsyncRawKeysClient.java b/src/main/java/resources/manage/v1/projects/keys/AsyncRawKeysClient.java deleted file mode 100644 index 149dbfa..0000000 --- a/src/main/java/resources/manage/v1/projects/keys/AsyncRawKeysClient.java +++ /dev/null @@ -1,413 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.keys; - -import com.fasterxml.jackson.core.JsonProcessingException; -import core.ClientOptions; -import core.DeepgramApiApiException; -import core.DeepgramApiException; -import core.DeepgramApiHttpResponse; -import core.MediaTypes; -import core.ObjectMappers; -import core.QueryStringMapper; -import core.RequestOptions; -import errors.BadRequestError; -import java.io.IOException; -import java.util.concurrent.CompletableFuture; -import okhttp3.Call; -import okhttp3.Callback; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; -import okhttp3.ResponseBody; -import org.jetbrains.annotations.NotNull; -import resources.manage.v1.projects.keys.requests.KeysListRequest; -import types.CreateKeyV1RequestOne; -import types.CreateKeyV1Response; -import types.DeleteProjectKeyV1Response; -import types.GetProjectKeyV1Response; -import types.ListProjectKeysV1Response; - -public class AsyncRawKeysClient { - protected final ClientOptions clientOptions; - - public AsyncRawKeysClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** Retrieves all API keys associated with the specified project */ - public CompletableFuture> list( - String projectId) { - return list(projectId, KeysListRequest.builder().build()); - } - - /** Retrieves all API keys associated with the specified project */ - public CompletableFuture> list( - String projectId, RequestOptions requestOptions) { - return list(projectId, KeysListRequest.builder().build(), requestOptions); - } - - /** Retrieves all API keys associated with the specified project */ - public CompletableFuture> list( - String projectId, KeysListRequest request) { - return list(projectId, request, null); - } - - /** Retrieves all API keys associated with the specified project */ - public CompletableFuture> list( - String projectId, KeysListRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("keys"); - if (request.getStatus().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "status", request.getStatus().get(), false); - } - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request.Builder _requestBuilder = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json"); - Request okhttpRequest = _requestBuilder.build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = - new CompletableFuture<>(); - client - .newCall(okhttpRequest) - .enqueue( - new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) - throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete( - new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, ListProjectKeysV1Response.class), - response)); - return; - } - try { - if (response.code() == 400) { - future.completeExceptionally( - new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally( - new DeepgramApiApiException( - "Error with status code " + response.code(), - response.code(), - errorBody, - response)); - return; - } catch (IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - }); - return future; - } - - /** Creates a new API key with specified settings for the project */ - public CompletableFuture> create( - String projectId, CreateKeyV1RequestOne request) { - return create(projectId, request, null); - } - - /** Creates a new API key with specified settings for the project */ - public CompletableFuture> create( - String projectId, CreateKeyV1RequestOne request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("keys"); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - RequestBody body; - try { - body = - RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); - } catch (JsonProcessingException e) { - throw new DeepgramApiException("Failed to serialize request", e); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = - new CompletableFuture<>(); - client - .newCall(okhttpRequest) - .enqueue( - new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) - throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete( - new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, CreateKeyV1Response.class), - response)); - return; - } - try { - if (response.code() == 400) { - future.completeExceptionally( - new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally( - new DeepgramApiApiException( - "Error with status code " + response.code(), - response.code(), - errorBody, - response)); - return; - } catch (IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - }); - return future; - } - - /** Retrieves information about a specified API key */ - public CompletableFuture> get( - String projectId, String keyId) { - return get(projectId, keyId, null); - } - - /** Retrieves information about a specified API key */ - public CompletableFuture> get( - String projectId, String keyId, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("keys") - .addPathSegment(keyId); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = - new CompletableFuture<>(); - client - .newCall(okhttpRequest) - .enqueue( - new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) - throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete( - new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, GetProjectKeyV1Response.class), - response)); - return; - } - try { - if (response.code() == 400) { - future.completeExceptionally( - new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally( - new DeepgramApiApiException( - "Error with status code " + response.code(), - response.code(), - errorBody, - response)); - return; - } catch (IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - }); - return future; - } - - /** Deletes an API key for a specific project */ - public CompletableFuture> delete( - String projectId, String keyId) { - return delete(projectId, keyId, null); - } - - /** Deletes an API key for a specific project */ - public CompletableFuture> delete( - String projectId, String keyId, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("keys") - .addPathSegment(keyId); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = - new CompletableFuture<>(); - client - .newCall(okhttpRequest) - .enqueue( - new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) - throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete( - new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, DeleteProjectKeyV1Response.class), - response)); - return; - } - try { - if (response.code() == 400) { - future.completeExceptionally( - new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally( - new DeepgramApiApiException( - "Error with status code " + response.code(), - response.code(), - errorBody, - response)); - return; - } catch (IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - }); - return future; - } -} diff --git a/src/main/java/resources/manage/v1/projects/keys/KeysClient.java b/src/main/java/resources/manage/v1/projects/keys/KeysClient.java deleted file mode 100644 index f21e9a3..0000000 --- a/src/main/java/resources/manage/v1/projects/keys/KeysClient.java +++ /dev/null @@ -1,81 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.keys; - -import core.ClientOptions; -import core.RequestOptions; -import resources.manage.v1.projects.keys.requests.KeysListRequest; -import types.CreateKeyV1RequestOne; -import types.CreateKeyV1Response; -import types.DeleteProjectKeyV1Response; -import types.GetProjectKeyV1Response; -import types.ListProjectKeysV1Response; - -public class KeysClient { - protected final ClientOptions clientOptions; - - private final RawKeysClient rawClient; - - public KeysClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new RawKeysClient(clientOptions); - } - - /** Get responses with HTTP metadata like headers */ - public RawKeysClient withRawResponse() { - return this.rawClient; - } - - /** Retrieves all API keys associated with the specified project */ - public ListProjectKeysV1Response list(String projectId) { - return this.rawClient.list(projectId).body(); - } - - /** Retrieves all API keys associated with the specified project */ - public ListProjectKeysV1Response list(String projectId, RequestOptions requestOptions) { - return this.rawClient.list(projectId, requestOptions).body(); - } - - /** Retrieves all API keys associated with the specified project */ - public ListProjectKeysV1Response list(String projectId, KeysListRequest request) { - return this.rawClient.list(projectId, request).body(); - } - - /** Retrieves all API keys associated with the specified project */ - public ListProjectKeysV1Response list( - String projectId, KeysListRequest request, RequestOptions requestOptions) { - return this.rawClient.list(projectId, request, requestOptions).body(); - } - - /** Creates a new API key with specified settings for the project */ - public CreateKeyV1Response create(String projectId, CreateKeyV1RequestOne request) { - return this.rawClient.create(projectId, request).body(); - } - - /** Creates a new API key with specified settings for the project */ - public CreateKeyV1Response create( - String projectId, CreateKeyV1RequestOne request, RequestOptions requestOptions) { - return this.rawClient.create(projectId, request, requestOptions).body(); - } - - /** Retrieves information about a specified API key */ - public GetProjectKeyV1Response get(String projectId, String keyId) { - return this.rawClient.get(projectId, keyId).body(); - } - - /** Retrieves information about a specified API key */ - public GetProjectKeyV1Response get( - String projectId, String keyId, RequestOptions requestOptions) { - return this.rawClient.get(projectId, keyId, requestOptions).body(); - } - - /** Deletes an API key for a specific project */ - public DeleteProjectKeyV1Response delete(String projectId, String keyId) { - return this.rawClient.delete(projectId, keyId).body(); - } - - /** Deletes an API key for a specific project */ - public DeleteProjectKeyV1Response delete( - String projectId, String keyId, RequestOptions requestOptions) { - return this.rawClient.delete(projectId, keyId, requestOptions).body(); - } -} diff --git a/src/main/java/resources/manage/v1/projects/keys/RawKeysClient.java b/src/main/java/resources/manage/v1/projects/keys/RawKeysClient.java deleted file mode 100644 index 359ffdf..0000000 --- a/src/main/java/resources/manage/v1/projects/keys/RawKeysClient.java +++ /dev/null @@ -1,293 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.keys; - -import com.fasterxml.jackson.core.JsonProcessingException; -import core.ClientOptions; -import core.DeepgramApiApiException; -import core.DeepgramApiException; -import core.DeepgramApiHttpResponse; -import core.MediaTypes; -import core.ObjectMappers; -import core.QueryStringMapper; -import core.RequestOptions; -import errors.BadRequestError; -import java.io.IOException; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; -import okhttp3.ResponseBody; -import resources.manage.v1.projects.keys.requests.KeysListRequest; -import types.CreateKeyV1RequestOne; -import types.CreateKeyV1Response; -import types.DeleteProjectKeyV1Response; -import types.GetProjectKeyV1Response; -import types.ListProjectKeysV1Response; - -public class RawKeysClient { - protected final ClientOptions clientOptions; - - public RawKeysClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** Retrieves all API keys associated with the specified project */ - public DeepgramApiHttpResponse list(String projectId) { - return list(projectId, KeysListRequest.builder().build()); - } - - /** Retrieves all API keys associated with the specified project */ - public DeepgramApiHttpResponse list( - String projectId, RequestOptions requestOptions) { - return list(projectId, KeysListRequest.builder().build(), requestOptions); - } - - /** Retrieves all API keys associated with the specified project */ - public DeepgramApiHttpResponse list( - String projectId, KeysListRequest request) { - return list(projectId, request, null); - } - - /** Retrieves all API keys associated with the specified project */ - public DeepgramApiHttpResponse list( - String projectId, KeysListRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("keys"); - if (request.getStatus().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "status", request.getStatus().get(), false); - } - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request.Builder _requestBuilder = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "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(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, ListProjectKeysV1Response.class), - response); - } - try { - if (response.code() == 400) { - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new DeepgramApiApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (IOException e) { - throw new DeepgramApiException("Network error executing HTTP request", e); - } - } - - /** Creates a new API key with specified settings for the project */ - public DeepgramApiHttpResponse create( - String projectId, CreateKeyV1RequestOne request) { - return create(projectId, request, null); - } - - /** Creates a new API key with specified settings for the project */ - public DeepgramApiHttpResponse create( - String projectId, CreateKeyV1RequestOne request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("keys"); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - RequestBody body; - try { - body = - RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); - } catch (JsonProcessingException e) { - throw new DeepgramApiException("Failed to serialize request", e); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .addHeader("Accept", "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(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, CreateKeyV1Response.class), - response); - } - try { - if (response.code() == 400) { - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new DeepgramApiApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (IOException e) { - throw new DeepgramApiException("Network error executing HTTP request", e); - } - } - - /** Retrieves information about a specified API key */ - public DeepgramApiHttpResponse get(String projectId, String keyId) { - return get(projectId, keyId, null); - } - - /** Retrieves information about a specified API key */ - public DeepgramApiHttpResponse get( - String projectId, String keyId, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("keys") - .addPathSegment(keyId); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "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(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetProjectKeyV1Response.class), - response); - } - try { - if (response.code() == 400) { - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new DeepgramApiApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (IOException e) { - throw new DeepgramApiException("Network error executing HTTP request", e); - } - } - - /** Deletes an API key for a specific project */ - public DeepgramApiHttpResponse delete( - String projectId, String keyId) { - return delete(projectId, keyId, null); - } - - /** Deletes an API key for a specific project */ - public DeepgramApiHttpResponse delete( - String projectId, String keyId, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("keys") - .addPathSegment(keyId); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "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(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, DeleteProjectKeyV1Response.class), - response); - } - try { - if (response.code() == 400) { - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new DeepgramApiApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (IOException e) { - throw new DeepgramApiException("Network error executing HTTP request", e); - } - } -} diff --git a/src/main/java/resources/manage/v1/projects/keys/requests/KeysListRequest.java b/src/main/java/resources/manage/v1/projects/keys/requests/KeysListRequest.java deleted file mode 100644 index 4bcd118..0000000 --- a/src/main/java/resources/manage/v1/projects/keys/requests/KeysListRequest.java +++ /dev/null @@ -1,108 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.keys.requests; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import core.ObjectMappers; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import resources.manage.v1.projects.keys.types.KeysListRequestStatus; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = KeysListRequest.Builder.class) -public final class KeysListRequest { - private final Optional status; - - private final Map additionalProperties; - - private KeysListRequest( - Optional status, Map additionalProperties) { - this.status = status; - this.additionalProperties = additionalProperties; - } - - /** - * @return Only return keys with a specific status - */ - @JsonIgnore - public Optional getStatus() { - return status; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof KeysListRequest && equalTo((KeysListRequest) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(KeysListRequest other) { - return status.equals(other.status); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.status); - } - - @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 status = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(KeysListRequest other) { - status(other.getStatus()); - return this; - } - - /** Only return keys with a specific status */ - @JsonSetter(value = "status", nulls = Nulls.SKIP) - public Builder status(Optional status) { - this.status = status; - return this; - } - - public Builder status(KeysListRequestStatus status) { - this.status = Optional.ofNullable(status); - return this; - } - - public KeysListRequest build() { - return new KeysListRequest(status, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/manage/v1/projects/keys/types/KeysListRequestStatus.java b/src/main/java/resources/manage/v1/projects/keys/types/KeysListRequestStatus.java deleted file mode 100644 index 16f015a..0000000 --- a/src/main/java/resources/manage/v1/projects/keys/types/KeysListRequestStatus.java +++ /dev/null @@ -1,84 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.keys.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class KeysListRequestStatus { - public static final KeysListRequestStatus EXPIRED = - new KeysListRequestStatus(Value.EXPIRED, "expired"); - - public static final KeysListRequestStatus ACTIVE = - new KeysListRequestStatus(Value.ACTIVE, "active"); - - private final Value value; - - private final String string; - - KeysListRequestStatus(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof KeysListRequestStatus - && this.string.equals(((KeysListRequestStatus) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case EXPIRED: - return visitor.visitExpired(); - case ACTIVE: - return visitor.visitActive(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static KeysListRequestStatus valueOf(String value) { - switch (value) { - case "expired": - return EXPIRED; - case "active": - return ACTIVE; - default: - return new KeysListRequestStatus(Value.UNKNOWN, value); - } - } - - public enum Value { - ACTIVE, - - EXPIRED, - - UNKNOWN - } - - public interface Visitor { - T visitActive(); - - T visitExpired(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/resources/manage/v1/projects/members/AsyncMembersClient.java b/src/main/java/resources/manage/v1/projects/members/AsyncMembersClient.java deleted file mode 100644 index f46bcb3..0000000 --- a/src/main/java/resources/manage/v1/projects/members/AsyncMembersClient.java +++ /dev/null @@ -1,67 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.members; - -import core.ClientOptions; -import core.RequestOptions; -import core.Suppliers; -import java.util.concurrent.CompletableFuture; -import java.util.function.Supplier; -import resources.manage.v1.projects.members.invites.AsyncInvitesClient; -import resources.manage.v1.projects.members.scopes.AsyncScopesClient; -import types.DeleteProjectMemberV1Response; -import types.ListProjectMembersV1Response; - -public class AsyncMembersClient { - protected final ClientOptions clientOptions; - - private final AsyncRawMembersClient rawClient; - - protected final Supplier invitesClient; - - protected final Supplier scopesClient; - - public AsyncMembersClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new AsyncRawMembersClient(clientOptions); - this.invitesClient = Suppliers.memoize(() -> new AsyncInvitesClient(clientOptions)); - this.scopesClient = Suppliers.memoize(() -> new AsyncScopesClient(clientOptions)); - } - - /** Get responses with HTTP metadata like headers */ - public AsyncRawMembersClient withRawResponse() { - return this.rawClient; - } - - /** Retrieves a list of members for a given project */ - public CompletableFuture list(String projectId) { - return this.rawClient.list(projectId).thenApply(response -> response.body()); - } - - /** Retrieves a list of members for a given project */ - public CompletableFuture list( - String projectId, RequestOptions requestOptions) { - return this.rawClient.list(projectId, requestOptions).thenApply(response -> response.body()); - } - - /** Removes a member from the project using their unique member ID */ - public CompletableFuture delete( - String projectId, String memberId) { - return this.rawClient.delete(projectId, memberId).thenApply(response -> response.body()); - } - - /** Removes a member from the project using their unique member ID */ - public CompletableFuture delete( - String projectId, String memberId, RequestOptions requestOptions) { - return this.rawClient - .delete(projectId, memberId, requestOptions) - .thenApply(response -> response.body()); - } - - public AsyncInvitesClient invites() { - return this.invitesClient.get(); - } - - public AsyncScopesClient scopes() { - return this.scopesClient.get(); - } -} diff --git a/src/main/java/resources/manage/v1/projects/members/AsyncRawMembersClient.java b/src/main/java/resources/manage/v1/projects/members/AsyncRawMembersClient.java deleted file mode 100644 index 563f9ae..0000000 --- a/src/main/java/resources/manage/v1/projects/members/AsyncRawMembersClient.java +++ /dev/null @@ -1,207 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.members; - -import com.fasterxml.jackson.core.JsonProcessingException; -import core.ClientOptions; -import core.DeepgramApiApiException; -import core.DeepgramApiException; -import core.DeepgramApiHttpResponse; -import core.ObjectMappers; -import core.RequestOptions; -import errors.BadRequestError; -import java.io.IOException; -import java.util.concurrent.CompletableFuture; -import okhttp3.Call; -import okhttp3.Callback; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import okhttp3.ResponseBody; -import org.jetbrains.annotations.NotNull; -import types.DeleteProjectMemberV1Response; -import types.ListProjectMembersV1Response; - -public class AsyncRawMembersClient { - protected final ClientOptions clientOptions; - - public AsyncRawMembersClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** Retrieves a list of members for a given project */ - public CompletableFuture> list( - String projectId) { - return list(projectId, null); - } - - /** Retrieves a list of members for a given project */ - public CompletableFuture> list( - String projectId, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("members"); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = - new CompletableFuture<>(); - client - .newCall(okhttpRequest) - .enqueue( - new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) - throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete( - new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, ListProjectMembersV1Response.class), - response)); - return; - } - try { - if (response.code() == 400) { - future.completeExceptionally( - new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally( - new DeepgramApiApiException( - "Error with status code " + response.code(), - response.code(), - errorBody, - response)); - return; - } catch (IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - }); - return future; - } - - /** Removes a member from the project using their unique member ID */ - public CompletableFuture> delete( - String projectId, String memberId) { - return delete(projectId, memberId, null); - } - - /** Removes a member from the project using their unique member ID */ - public CompletableFuture> delete( - String projectId, String memberId, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("members") - .addPathSegment(memberId); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = - new CompletableFuture<>(); - client - .newCall(okhttpRequest) - .enqueue( - new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) - throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete( - new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, DeleteProjectMemberV1Response.class), - response)); - return; - } - try { - if (response.code() == 400) { - future.completeExceptionally( - new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally( - new DeepgramApiApiException( - "Error with status code " + response.code(), - response.code(), - errorBody, - response)); - return; - } catch (IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - }); - return future; - } -} diff --git a/src/main/java/resources/manage/v1/projects/members/MembersClient.java b/src/main/java/resources/manage/v1/projects/members/MembersClient.java deleted file mode 100644 index 7125e4c..0000000 --- a/src/main/java/resources/manage/v1/projects/members/MembersClient.java +++ /dev/null @@ -1,62 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.members; - -import core.ClientOptions; -import core.RequestOptions; -import core.Suppliers; -import java.util.function.Supplier; -import resources.manage.v1.projects.members.invites.InvitesClient; -import resources.manage.v1.projects.members.scopes.ScopesClient; -import types.DeleteProjectMemberV1Response; -import types.ListProjectMembersV1Response; - -public class MembersClient { - protected final ClientOptions clientOptions; - - private final RawMembersClient rawClient; - - protected final Supplier invitesClient; - - protected final Supplier scopesClient; - - public MembersClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new RawMembersClient(clientOptions); - this.invitesClient = Suppliers.memoize(() -> new InvitesClient(clientOptions)); - this.scopesClient = Suppliers.memoize(() -> new ScopesClient(clientOptions)); - } - - /** Get responses with HTTP metadata like headers */ - public RawMembersClient withRawResponse() { - return this.rawClient; - } - - /** Retrieves a list of members for a given project */ - public ListProjectMembersV1Response list(String projectId) { - return this.rawClient.list(projectId).body(); - } - - /** Retrieves a list of members for a given project */ - public ListProjectMembersV1Response list(String projectId, RequestOptions requestOptions) { - return this.rawClient.list(projectId, requestOptions).body(); - } - - /** Removes a member from the project using their unique member ID */ - public DeleteProjectMemberV1Response delete(String projectId, String memberId) { - return this.rawClient.delete(projectId, memberId).body(); - } - - /** Removes a member from the project using their unique member ID */ - public DeleteProjectMemberV1Response delete( - String projectId, String memberId, RequestOptions requestOptions) { - return this.rawClient.delete(projectId, memberId, requestOptions).body(); - } - - public InvitesClient invites() { - return this.invitesClient.get(); - } - - public ScopesClient scopes() { - return this.scopesClient.get(); - } -} diff --git a/src/main/java/resources/manage/v1/projects/members/RawMembersClient.java b/src/main/java/resources/manage/v1/projects/members/RawMembersClient.java deleted file mode 100644 index 6da7634..0000000 --- a/src/main/java/resources/manage/v1/projects/members/RawMembersClient.java +++ /dev/null @@ -1,146 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.members; - -import com.fasterxml.jackson.core.JsonProcessingException; -import core.ClientOptions; -import core.DeepgramApiApiException; -import core.DeepgramApiException; -import core.DeepgramApiHttpResponse; -import core.ObjectMappers; -import core.RequestOptions; -import errors.BadRequestError; -import java.io.IOException; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import okhttp3.ResponseBody; -import types.DeleteProjectMemberV1Response; -import types.ListProjectMembersV1Response; - -public class RawMembersClient { - protected final ClientOptions clientOptions; - - public RawMembersClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** Retrieves a list of members for a given project */ - public DeepgramApiHttpResponse list(String projectId) { - return list(projectId, null); - } - - /** Retrieves a list of members for a given project */ - public DeepgramApiHttpResponse list( - String projectId, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("members"); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "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(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, ListProjectMembersV1Response.class), - response); - } - try { - if (response.code() == 400) { - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new DeepgramApiApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (IOException e) { - throw new DeepgramApiException("Network error executing HTTP request", e); - } - } - - /** Removes a member from the project using their unique member ID */ - public DeepgramApiHttpResponse delete( - String projectId, String memberId) { - return delete(projectId, memberId, null); - } - - /** Removes a member from the project using their unique member ID */ - public DeepgramApiHttpResponse delete( - String projectId, String memberId, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("members") - .addPathSegment(memberId); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "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(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, DeleteProjectMemberV1Response.class), - response); - } - try { - if (response.code() == 400) { - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new DeepgramApiApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (IOException e) { - throw new DeepgramApiException("Network error executing HTTP request", e); - } - } -} diff --git a/src/main/java/resources/manage/v1/projects/members/invites/AsyncInvitesClient.java b/src/main/java/resources/manage/v1/projects/members/invites/AsyncInvitesClient.java deleted file mode 100644 index 18355ba..0000000 --- a/src/main/java/resources/manage/v1/projects/members/invites/AsyncInvitesClient.java +++ /dev/null @@ -1,64 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.members.invites; - -import core.ClientOptions; -import core.RequestOptions; -import java.util.concurrent.CompletableFuture; -import resources.manage.v1.projects.members.invites.requests.CreateProjectInviteV1Request; -import types.CreateProjectInviteV1Response; -import types.DeleteProjectInviteV1Response; -import types.ListProjectInvitesV1Response; - -public class AsyncInvitesClient { - protected final ClientOptions clientOptions; - - private final AsyncRawInvitesClient rawClient; - - public AsyncInvitesClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new AsyncRawInvitesClient(clientOptions); - } - - /** Get responses with HTTP metadata like headers */ - public AsyncRawInvitesClient withRawResponse() { - return this.rawClient; - } - - /** Generates a list of invites for a specific project */ - public CompletableFuture list(String projectId) { - return this.rawClient.list(projectId).thenApply(response -> response.body()); - } - - /** Generates a list of invites for a specific project */ - public CompletableFuture list( - String projectId, RequestOptions requestOptions) { - return this.rawClient.list(projectId, requestOptions).thenApply(response -> response.body()); - } - - /** Generates an invite for a specific project */ - public CompletableFuture create( - String projectId, CreateProjectInviteV1Request request) { - return this.rawClient.create(projectId, request).thenApply(response -> response.body()); - } - - /** Generates an invite for a specific project */ - public CompletableFuture create( - String projectId, CreateProjectInviteV1Request request, RequestOptions requestOptions) { - return this.rawClient - .create(projectId, request, requestOptions) - .thenApply(response -> response.body()); - } - - /** Deletes an invite for a specific project */ - public CompletableFuture delete(String projectId, String email) { - return this.rawClient.delete(projectId, email).thenApply(response -> response.body()); - } - - /** Deletes an invite for a specific project */ - public CompletableFuture delete( - String projectId, String email, RequestOptions requestOptions) { - return this.rawClient - .delete(projectId, email, requestOptions) - .thenApply(response -> response.body()); - } -} diff --git a/src/main/java/resources/manage/v1/projects/members/invites/AsyncRawInvitesClient.java b/src/main/java/resources/manage/v1/projects/members/invites/AsyncRawInvitesClient.java deleted file mode 100644 index aa9b479..0000000 --- a/src/main/java/resources/manage/v1/projects/members/invites/AsyncRawInvitesClient.java +++ /dev/null @@ -1,307 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.members.invites; - -import com.fasterxml.jackson.core.JsonProcessingException; -import core.ClientOptions; -import core.DeepgramApiApiException; -import core.DeepgramApiException; -import core.DeepgramApiHttpResponse; -import core.MediaTypes; -import core.ObjectMappers; -import core.RequestOptions; -import errors.BadRequestError; -import java.io.IOException; -import java.util.concurrent.CompletableFuture; -import okhttp3.Call; -import okhttp3.Callback; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; -import okhttp3.ResponseBody; -import org.jetbrains.annotations.NotNull; -import resources.manage.v1.projects.members.invites.requests.CreateProjectInviteV1Request; -import types.CreateProjectInviteV1Response; -import types.DeleteProjectInviteV1Response; -import types.ListProjectInvitesV1Response; - -public class AsyncRawInvitesClient { - protected final ClientOptions clientOptions; - - public AsyncRawInvitesClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** Generates a list of invites for a specific project */ - public CompletableFuture> list( - String projectId) { - return list(projectId, null); - } - - /** Generates a list of invites for a specific project */ - public CompletableFuture> list( - String projectId, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("invites"); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = - new CompletableFuture<>(); - client - .newCall(okhttpRequest) - .enqueue( - new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) - throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete( - new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, ListProjectInvitesV1Response.class), - response)); - return; - } - try { - if (response.code() == 400) { - future.completeExceptionally( - new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally( - new DeepgramApiApiException( - "Error with status code " + response.code(), - response.code(), - errorBody, - response)); - return; - } catch (IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - }); - return future; - } - - /** Generates an invite for a specific project */ - public CompletableFuture> create( - String projectId, CreateProjectInviteV1Request request) { - return create(projectId, request, null); - } - - /** Generates an invite for a specific project */ - public CompletableFuture> create( - String projectId, CreateProjectInviteV1Request request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("invites"); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - RequestBody body; - try { - body = - RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); - } catch (JsonProcessingException e) { - throw new DeepgramApiException("Failed to serialize request", e); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = - new CompletableFuture<>(); - client - .newCall(okhttpRequest) - .enqueue( - new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) - throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete( - new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, CreateProjectInviteV1Response.class), - response)); - return; - } - try { - if (response.code() == 400) { - future.completeExceptionally( - new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally( - new DeepgramApiApiException( - "Error with status code " + response.code(), - response.code(), - errorBody, - response)); - return; - } catch (IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - }); - return future; - } - - /** Deletes an invite for a specific project */ - public CompletableFuture> delete( - String projectId, String email) { - return delete(projectId, email, null); - } - - /** Deletes an invite for a specific project */ - public CompletableFuture> delete( - String projectId, String email, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("invites") - .addPathSegment(email); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = - new CompletableFuture<>(); - client - .newCall(okhttpRequest) - .enqueue( - new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) - throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete( - new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, DeleteProjectInviteV1Response.class), - response)); - return; - } - try { - if (response.code() == 400) { - future.completeExceptionally( - new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally( - new DeepgramApiApiException( - "Error with status code " + response.code(), - response.code(), - errorBody, - response)); - return; - } catch (IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - }); - return future; - } -} diff --git a/src/main/java/resources/manage/v1/projects/members/invites/InvitesClient.java b/src/main/java/resources/manage/v1/projects/members/invites/InvitesClient.java deleted file mode 100644 index e51be7e..0000000 --- a/src/main/java/resources/manage/v1/projects/members/invites/InvitesClient.java +++ /dev/null @@ -1,58 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.members.invites; - -import core.ClientOptions; -import core.RequestOptions; -import resources.manage.v1.projects.members.invites.requests.CreateProjectInviteV1Request; -import types.CreateProjectInviteV1Response; -import types.DeleteProjectInviteV1Response; -import types.ListProjectInvitesV1Response; - -public class InvitesClient { - protected final ClientOptions clientOptions; - - private final RawInvitesClient rawClient; - - public InvitesClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new RawInvitesClient(clientOptions); - } - - /** Get responses with HTTP metadata like headers */ - public RawInvitesClient withRawResponse() { - return this.rawClient; - } - - /** Generates a list of invites for a specific project */ - public ListProjectInvitesV1Response list(String projectId) { - return this.rawClient.list(projectId).body(); - } - - /** Generates a list of invites for a specific project */ - public ListProjectInvitesV1Response list(String projectId, RequestOptions requestOptions) { - return this.rawClient.list(projectId, requestOptions).body(); - } - - /** Generates an invite for a specific project */ - public CreateProjectInviteV1Response create( - String projectId, CreateProjectInviteV1Request request) { - return this.rawClient.create(projectId, request).body(); - } - - /** Generates an invite for a specific project */ - public CreateProjectInviteV1Response create( - String projectId, CreateProjectInviteV1Request request, RequestOptions requestOptions) { - return this.rawClient.create(projectId, request, requestOptions).body(); - } - - /** Deletes an invite for a specific project */ - public DeleteProjectInviteV1Response delete(String projectId, String email) { - return this.rawClient.delete(projectId, email).body(); - } - - /** Deletes an invite for a specific project */ - public DeleteProjectInviteV1Response delete( - String projectId, String email, RequestOptions requestOptions) { - return this.rawClient.delete(projectId, email, requestOptions).body(); - } -} diff --git a/src/main/java/resources/manage/v1/projects/members/invites/RawInvitesClient.java b/src/main/java/resources/manage/v1/projects/members/invites/RawInvitesClient.java deleted file mode 100644 index 01bebf7..0000000 --- a/src/main/java/resources/manage/v1/projects/members/invites/RawInvitesClient.java +++ /dev/null @@ -1,218 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.members.invites; - -import com.fasterxml.jackson.core.JsonProcessingException; -import core.ClientOptions; -import core.DeepgramApiApiException; -import core.DeepgramApiException; -import core.DeepgramApiHttpResponse; -import core.MediaTypes; -import core.ObjectMappers; -import core.RequestOptions; -import errors.BadRequestError; -import java.io.IOException; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; -import okhttp3.ResponseBody; -import resources.manage.v1.projects.members.invites.requests.CreateProjectInviteV1Request; -import types.CreateProjectInviteV1Response; -import types.DeleteProjectInviteV1Response; -import types.ListProjectInvitesV1Response; - -public class RawInvitesClient { - protected final ClientOptions clientOptions; - - public RawInvitesClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** Generates a list of invites for a specific project */ - public DeepgramApiHttpResponse list(String projectId) { - return list(projectId, null); - } - - /** Generates a list of invites for a specific project */ - public DeepgramApiHttpResponse list( - String projectId, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("invites"); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "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(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, ListProjectInvitesV1Response.class), - response); - } - try { - if (response.code() == 400) { - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new DeepgramApiApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (IOException e) { - throw new DeepgramApiException("Network error executing HTTP request", e); - } - } - - /** Generates an invite for a specific project */ - public DeepgramApiHttpResponse create( - String projectId, CreateProjectInviteV1Request request) { - return create(projectId, request, null); - } - - /** Generates an invite for a specific project */ - public DeepgramApiHttpResponse create( - String projectId, CreateProjectInviteV1Request request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("invites"); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - RequestBody body; - try { - body = - RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); - } catch (JsonProcessingException e) { - throw new DeepgramApiException("Failed to serialize request", e); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .addHeader("Accept", "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(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, CreateProjectInviteV1Response.class), - response); - } - try { - if (response.code() == 400) { - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new DeepgramApiApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (IOException e) { - throw new DeepgramApiException("Network error executing HTTP request", e); - } - } - - /** Deletes an invite for a specific project */ - public DeepgramApiHttpResponse delete( - String projectId, String email) { - return delete(projectId, email, null); - } - - /** Deletes an invite for a specific project */ - public DeepgramApiHttpResponse delete( - String projectId, String email, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("invites") - .addPathSegment(email); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "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(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, DeleteProjectInviteV1Response.class), - response); - } - try { - if (response.code() == 400) { - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new DeepgramApiApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (IOException e) { - throw new DeepgramApiException("Network error executing HTTP request", e); - } - } -} diff --git a/src/main/java/resources/manage/v1/projects/members/invites/requests/CreateProjectInviteV1Request.java b/src/main/java/resources/manage/v1/projects/members/invites/requests/CreateProjectInviteV1Request.java deleted file mode 100644 index 2b2b778..0000000 --- a/src/main/java/resources/manage/v1/projects/members/invites/requests/CreateProjectInviteV1Request.java +++ /dev/null @@ -1,161 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.members.invites.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.databind.annotation.JsonDeserialize; -import 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 = CreateProjectInviteV1Request.Builder.class) -public final class CreateProjectInviteV1Request { - private final String email; - - private final String scope; - - private final Map additionalProperties; - - private CreateProjectInviteV1Request( - String email, String scope, Map additionalProperties) { - this.email = email; - this.scope = scope; - this.additionalProperties = additionalProperties; - } - - /** - * @return The email address of the invitee - */ - @JsonProperty("email") - public String getEmail() { - return email; - } - - /** - * @return The scope of the invitee - */ - @JsonProperty("scope") - public String getScope() { - return scope; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CreateProjectInviteV1Request - && equalTo((CreateProjectInviteV1Request) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(CreateProjectInviteV1Request other) { - return email.equals(other.email) && scope.equals(other.scope); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.email, this.scope); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static EmailStage builder() { - return new Builder(); - } - - public interface EmailStage { - /** The email address of the invitee */ - ScopeStage email(@NotNull String email); - - Builder from(CreateProjectInviteV1Request other); - } - - public interface ScopeStage { - /** The scope of the invitee */ - _FinalStage scope(@NotNull String scope); - } - - public interface _FinalStage { - CreateProjectInviteV1Request build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements EmailStage, ScopeStage, _FinalStage { - private String email; - - private String scope; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(CreateProjectInviteV1Request other) { - email(other.getEmail()); - scope(other.getScope()); - return this; - } - - /** - * The email address of the invitee - * - *

The email address of the invitee - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("email") - public ScopeStage email(@NotNull String email) { - this.email = Objects.requireNonNull(email, "email must not be null"); - return this; - } - - /** - * The scope of the invitee - * - *

The scope of the invitee - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("scope") - public _FinalStage scope(@NotNull String scope) { - this.scope = Objects.requireNonNull(scope, "scope must not be null"); - return this; - } - - @java.lang.Override - public CreateProjectInviteV1Request build() { - return new CreateProjectInviteV1Request(email, scope, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/manage/v1/projects/members/scopes/AsyncRawScopesClient.java b/src/main/java/resources/manage/v1/projects/members/scopes/AsyncRawScopesClient.java deleted file mode 100644 index 60ee069..0000000 --- a/src/main/java/resources/manage/v1/projects/members/scopes/AsyncRawScopesClient.java +++ /dev/null @@ -1,225 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.members.scopes; - -import com.fasterxml.jackson.core.JsonProcessingException; -import core.ClientOptions; -import core.DeepgramApiApiException; -import core.DeepgramApiException; -import core.DeepgramApiHttpResponse; -import core.MediaTypes; -import core.ObjectMappers; -import core.RequestOptions; -import errors.BadRequestError; -import java.io.IOException; -import java.util.concurrent.CompletableFuture; -import okhttp3.Call; -import okhttp3.Callback; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; -import okhttp3.ResponseBody; -import org.jetbrains.annotations.NotNull; -import resources.manage.v1.projects.members.scopes.requests.UpdateProjectMemberScopesV1Request; -import types.ListProjectMemberScopesV1Response; -import types.UpdateProjectMemberScopesV1Response; - -public class AsyncRawScopesClient { - protected final ClientOptions clientOptions; - - public AsyncRawScopesClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** Retrieves a list of scopes for a specific member */ - public CompletableFuture> list( - String projectId, String memberId) { - return list(projectId, memberId, null); - } - - /** Retrieves a list of scopes for a specific member */ - public CompletableFuture> list( - String projectId, String memberId, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("members") - .addPathSegment(memberId) - .addPathSegments("scopes"); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = - new CompletableFuture<>(); - client - .newCall(okhttpRequest) - .enqueue( - new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) - throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete( - new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, ListProjectMemberScopesV1Response.class), - response)); - return; - } - try { - if (response.code() == 400) { - future.completeExceptionally( - new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally( - new DeepgramApiApiException( - "Error with status code " + response.code(), - response.code(), - errorBody, - response)); - return; - } catch (IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - }); - return future; - } - - /** Updates the scopes for a specific member */ - public CompletableFuture> update( - String projectId, String memberId, UpdateProjectMemberScopesV1Request request) { - return update(projectId, memberId, request, null); - } - - /** Updates the scopes for a specific member */ - public CompletableFuture> update( - String projectId, - String memberId, - UpdateProjectMemberScopesV1Request request, - RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("members") - .addPathSegment(memberId) - .addPathSegments("scopes"); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - RequestBody body; - try { - body = - RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); - } catch (JsonProcessingException e) { - throw new DeepgramApiException("Failed to serialize request", e); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("PUT", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = - new CompletableFuture<>(); - client - .newCall(okhttpRequest) - .enqueue( - new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) - throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete( - new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, UpdateProjectMemberScopesV1Response.class), - response)); - return; - } - try { - if (response.code() == 400) { - future.completeExceptionally( - new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally( - new DeepgramApiApiException( - "Error with status code " + response.code(), - response.code(), - errorBody, - response)); - return; - } catch (IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - }); - return future; - } -} diff --git a/src/main/java/resources/manage/v1/projects/members/scopes/AsyncScopesClient.java b/src/main/java/resources/manage/v1/projects/members/scopes/AsyncScopesClient.java deleted file mode 100644 index f2fe491..0000000 --- a/src/main/java/resources/manage/v1/projects/members/scopes/AsyncScopesClient.java +++ /dev/null @@ -1,58 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.members.scopes; - -import core.ClientOptions; -import core.RequestOptions; -import java.util.concurrent.CompletableFuture; -import resources.manage.v1.projects.members.scopes.requests.UpdateProjectMemberScopesV1Request; -import types.ListProjectMemberScopesV1Response; -import types.UpdateProjectMemberScopesV1Response; - -public class AsyncScopesClient { - protected final ClientOptions clientOptions; - - private final AsyncRawScopesClient rawClient; - - public AsyncScopesClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new AsyncRawScopesClient(clientOptions); - } - - /** Get responses with HTTP metadata like headers */ - public AsyncRawScopesClient withRawResponse() { - return this.rawClient; - } - - /** Retrieves a list of scopes for a specific member */ - public CompletableFuture list( - String projectId, String memberId) { - return this.rawClient.list(projectId, memberId).thenApply(response -> response.body()); - } - - /** Retrieves a list of scopes for a specific member */ - public CompletableFuture list( - String projectId, String memberId, RequestOptions requestOptions) { - return this.rawClient - .list(projectId, memberId, requestOptions) - .thenApply(response -> response.body()); - } - - /** Updates the scopes for a specific member */ - public CompletableFuture update( - String projectId, String memberId, UpdateProjectMemberScopesV1Request request) { - return this.rawClient - .update(projectId, memberId, request) - .thenApply(response -> response.body()); - } - - /** Updates the scopes for a specific member */ - public CompletableFuture update( - String projectId, - String memberId, - UpdateProjectMemberScopesV1Request request, - RequestOptions requestOptions) { - return this.rawClient - .update(projectId, memberId, request, requestOptions) - .thenApply(response -> response.body()); - } -} diff --git a/src/main/java/resources/manage/v1/projects/members/scopes/RawScopesClient.java b/src/main/java/resources/manage/v1/projects/members/scopes/RawScopesClient.java deleted file mode 100644 index d4c2db9..0000000 --- a/src/main/java/resources/manage/v1/projects/members/scopes/RawScopesClient.java +++ /dev/null @@ -1,165 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.members.scopes; - -import com.fasterxml.jackson.core.JsonProcessingException; -import core.ClientOptions; -import core.DeepgramApiApiException; -import core.DeepgramApiException; -import core.DeepgramApiHttpResponse; -import core.MediaTypes; -import core.ObjectMappers; -import core.RequestOptions; -import errors.BadRequestError; -import java.io.IOException; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; -import okhttp3.ResponseBody; -import resources.manage.v1.projects.members.scopes.requests.UpdateProjectMemberScopesV1Request; -import types.ListProjectMemberScopesV1Response; -import types.UpdateProjectMemberScopesV1Response; - -public class RawScopesClient { - protected final ClientOptions clientOptions; - - public RawScopesClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** Retrieves a list of scopes for a specific member */ - public DeepgramApiHttpResponse list( - String projectId, String memberId) { - return list(projectId, memberId, null); - } - - /** Retrieves a list of scopes for a specific member */ - public DeepgramApiHttpResponse list( - String projectId, String memberId, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("members") - .addPathSegment(memberId) - .addPathSegments("scopes"); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "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(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, ListProjectMemberScopesV1Response.class), - response); - } - try { - if (response.code() == 400) { - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new DeepgramApiApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (IOException e) { - throw new DeepgramApiException("Network error executing HTTP request", e); - } - } - - /** Updates the scopes for a specific member */ - public DeepgramApiHttpResponse update( - String projectId, String memberId, UpdateProjectMemberScopesV1Request request) { - return update(projectId, memberId, request, null); - } - - /** Updates the scopes for a specific member */ - public DeepgramApiHttpResponse update( - String projectId, - String memberId, - UpdateProjectMemberScopesV1Request request, - RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("members") - .addPathSegment(memberId) - .addPathSegments("scopes"); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - RequestBody body; - try { - body = - RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); - } catch (JsonProcessingException e) { - throw new DeepgramApiException("Failed to serialize request", e); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("PUT", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .addHeader("Accept", "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(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, UpdateProjectMemberScopesV1Response.class), - response); - } - try { - if (response.code() == 400) { - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new DeepgramApiApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (IOException e) { - throw new DeepgramApiException("Network error executing HTTP request", e); - } - } -} diff --git a/src/main/java/resources/manage/v1/projects/members/scopes/ScopesClient.java b/src/main/java/resources/manage/v1/projects/members/scopes/ScopesClient.java deleted file mode 100644 index b02e42f..0000000 --- a/src/main/java/resources/manage/v1/projects/members/scopes/ScopesClient.java +++ /dev/null @@ -1,50 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.members.scopes; - -import core.ClientOptions; -import core.RequestOptions; -import resources.manage.v1.projects.members.scopes.requests.UpdateProjectMemberScopesV1Request; -import types.ListProjectMemberScopesV1Response; -import types.UpdateProjectMemberScopesV1Response; - -public class ScopesClient { - protected final ClientOptions clientOptions; - - private final RawScopesClient rawClient; - - public ScopesClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new RawScopesClient(clientOptions); - } - - /** Get responses with HTTP metadata like headers */ - public RawScopesClient withRawResponse() { - return this.rawClient; - } - - /** Retrieves a list of scopes for a specific member */ - public ListProjectMemberScopesV1Response list(String projectId, String memberId) { - return this.rawClient.list(projectId, memberId).body(); - } - - /** Retrieves a list of scopes for a specific member */ - public ListProjectMemberScopesV1Response list( - String projectId, String memberId, RequestOptions requestOptions) { - return this.rawClient.list(projectId, memberId, requestOptions).body(); - } - - /** Updates the scopes for a specific member */ - public UpdateProjectMemberScopesV1Response update( - String projectId, String memberId, UpdateProjectMemberScopesV1Request request) { - return this.rawClient.update(projectId, memberId, request).body(); - } - - /** Updates the scopes for a specific member */ - public UpdateProjectMemberScopesV1Response update( - String projectId, - String memberId, - UpdateProjectMemberScopesV1Request request, - RequestOptions requestOptions) { - return this.rawClient.update(projectId, memberId, request, requestOptions).body(); - } -} diff --git a/src/main/java/resources/manage/v1/projects/members/scopes/requests/UpdateProjectMemberScopesV1Request.java b/src/main/java/resources/manage/v1/projects/members/scopes/requests/UpdateProjectMemberScopesV1Request.java deleted file mode 100644 index 19ff876..0000000 --- a/src/main/java/resources/manage/v1/projects/members/scopes/requests/UpdateProjectMemberScopesV1Request.java +++ /dev/null @@ -1,128 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.members.scopes.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.databind.annotation.JsonDeserialize; -import 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 = UpdateProjectMemberScopesV1Request.Builder.class) -public final class UpdateProjectMemberScopesV1Request { - private final String scope; - - private final Map additionalProperties; - - private UpdateProjectMemberScopesV1Request( - String scope, Map additionalProperties) { - this.scope = scope; - this.additionalProperties = additionalProperties; - } - - /** - * @return A scope to update - */ - @JsonProperty("scope") - public String getScope() { - return scope; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpdateProjectMemberScopesV1Request - && equalTo((UpdateProjectMemberScopesV1Request) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(UpdateProjectMemberScopesV1Request other) { - return scope.equals(other.scope); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.scope); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static ScopeStage builder() { - return new Builder(); - } - - public interface ScopeStage { - /** A scope to update */ - _FinalStage scope(@NotNull String scope); - - Builder from(UpdateProjectMemberScopesV1Request other); - } - - public interface _FinalStage { - UpdateProjectMemberScopesV1Request build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements ScopeStage, _FinalStage { - private String scope; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(UpdateProjectMemberScopesV1Request other) { - scope(other.getScope()); - return this; - } - - /** - * A scope to update - * - *

A scope to update - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("scope") - public _FinalStage scope(@NotNull String scope) { - this.scope = Objects.requireNonNull(scope, "scope must not be null"); - return this; - } - - @java.lang.Override - public UpdateProjectMemberScopesV1Request build() { - return new UpdateProjectMemberScopesV1Request(scope, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/manage/v1/projects/models/AsyncModelsClient.java b/src/main/java/resources/manage/v1/projects/models/AsyncModelsClient.java deleted file mode 100644 index a06d1f4..0000000 --- a/src/main/java/resources/manage/v1/projects/models/AsyncModelsClient.java +++ /dev/null @@ -1,74 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.models; - -import core.ClientOptions; -import core.RequestOptions; -import java.util.concurrent.CompletableFuture; -import resources.manage.v1.projects.models.requests.ModelsListRequest; -import types.GetModelV1Response; -import types.ListModelsV1Response; - -public class AsyncModelsClient { - protected final ClientOptions clientOptions; - - private final AsyncRawModelsClient rawClient; - - public AsyncModelsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new AsyncRawModelsClient(clientOptions); - } - - /** Get responses with HTTP metadata like headers */ - public AsyncRawModelsClient withRawResponse() { - return this.rawClient; - } - - /** - * Returns metadata on all the latest models that a specific project has access to, including - * non-public models - */ - public CompletableFuture list(String projectId) { - return this.rawClient.list(projectId).thenApply(response -> response.body()); - } - - /** - * Returns metadata on all the latest models that a specific project has access to, including - * non-public models - */ - public CompletableFuture list( - String projectId, RequestOptions requestOptions) { - return this.rawClient.list(projectId, requestOptions).thenApply(response -> response.body()); - } - - /** - * Returns metadata on all the latest models that a specific project has access to, including - * non-public models - */ - public CompletableFuture list(String projectId, ModelsListRequest request) { - return this.rawClient.list(projectId, request).thenApply(response -> response.body()); - } - - /** - * Returns metadata on all the latest models that a specific project has access to, including - * non-public models - */ - public CompletableFuture list( - String projectId, ModelsListRequest request, RequestOptions requestOptions) { - return this.rawClient - .list(projectId, request, requestOptions) - .thenApply(response -> response.body()); - } - - /** Returns metadata for a specific model */ - public CompletableFuture get(String projectId, String modelId) { - return this.rawClient.get(projectId, modelId).thenApply(response -> response.body()); - } - - /** Returns metadata for a specific model */ - public CompletableFuture get( - String projectId, String modelId, RequestOptions requestOptions) { - return this.rawClient - .get(projectId, modelId, requestOptions) - .thenApply(response -> response.body()); - } -} diff --git a/src/main/java/resources/manage/v1/projects/models/AsyncRawModelsClient.java b/src/main/java/resources/manage/v1/projects/models/AsyncRawModelsClient.java deleted file mode 100644 index 721acaf..0000000 --- a/src/main/java/resources/manage/v1/projects/models/AsyncRawModelsClient.java +++ /dev/null @@ -1,236 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.models; - -import com.fasterxml.jackson.core.JsonProcessingException; -import core.ClientOptions; -import core.DeepgramApiApiException; -import core.DeepgramApiException; -import core.DeepgramApiHttpResponse; -import core.ObjectMappers; -import core.QueryStringMapper; -import core.RequestOptions; -import errors.BadRequestError; -import java.io.IOException; -import java.util.concurrent.CompletableFuture; -import okhttp3.Call; -import okhttp3.Callback; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import okhttp3.ResponseBody; -import org.jetbrains.annotations.NotNull; -import resources.manage.v1.projects.models.requests.ModelsListRequest; -import types.GetModelV1Response; -import types.ListModelsV1Response; - -public class AsyncRawModelsClient { - protected final ClientOptions clientOptions; - - public AsyncRawModelsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** - * Returns metadata on all the latest models that a specific project has access to, including - * non-public models - */ - public CompletableFuture> list(String projectId) { - return list(projectId, ModelsListRequest.builder().build()); - } - - /** - * Returns metadata on all the latest models that a specific project has access to, including - * non-public models - */ - public CompletableFuture> list( - String projectId, RequestOptions requestOptions) { - return list(projectId, ModelsListRequest.builder().build(), requestOptions); - } - - /** - * Returns metadata on all the latest models that a specific project has access to, including - * non-public models - */ - public CompletableFuture> list( - String projectId, ModelsListRequest request) { - return list(projectId, request, null); - } - - /** - * Returns metadata on all the latest models that a specific project has access to, including - * non-public models - */ - public CompletableFuture> list( - String projectId, ModelsListRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("models"); - if (request.getIncludeOutdated().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "include_outdated", request.getIncludeOutdated().get(), false); - } - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request.Builder _requestBuilder = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json"); - Request okhttpRequest = _requestBuilder.build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = - new CompletableFuture<>(); - client - .newCall(okhttpRequest) - .enqueue( - new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) - throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete( - new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, ListModelsV1Response.class), - response)); - return; - } - try { - if (response.code() == 400) { - future.completeExceptionally( - new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally( - new DeepgramApiApiException( - "Error with status code " + response.code(), - response.code(), - errorBody, - response)); - return; - } catch (IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - }); - return future; - } - - /** Returns metadata for a specific model */ - public CompletableFuture> get( - String projectId, String modelId) { - return get(projectId, modelId, null); - } - - /** Returns metadata for a specific model */ - public CompletableFuture> get( - String projectId, String modelId, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("models") - .addPathSegment(modelId); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = - new CompletableFuture<>(); - client - .newCall(okhttpRequest) - .enqueue( - new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) - throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete( - new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, GetModelV1Response.class), - response)); - return; - } - try { - if (response.code() == 400) { - future.completeExceptionally( - new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally( - new DeepgramApiApiException( - "Error with status code " + response.code(), - response.code(), - errorBody, - response)); - return; - } catch (IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - }); - return future; - } -} diff --git a/src/main/java/resources/manage/v1/projects/models/ModelsClient.java b/src/main/java/resources/manage/v1/projects/models/ModelsClient.java deleted file mode 100644 index 10567a6..0000000 --- a/src/main/java/resources/manage/v1/projects/models/ModelsClient.java +++ /dev/null @@ -1,67 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.models; - -import core.ClientOptions; -import core.RequestOptions; -import resources.manage.v1.projects.models.requests.ModelsListRequest; -import types.GetModelV1Response; -import types.ListModelsV1Response; - -public class ModelsClient { - protected final ClientOptions clientOptions; - - private final RawModelsClient rawClient; - - public ModelsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new RawModelsClient(clientOptions); - } - - /** Get responses with HTTP metadata like headers */ - public RawModelsClient withRawResponse() { - return this.rawClient; - } - - /** - * Returns metadata on all the latest models that a specific project has access to, including - * non-public models - */ - public ListModelsV1Response list(String projectId) { - return this.rawClient.list(projectId).body(); - } - - /** - * Returns metadata on all the latest models that a specific project has access to, including - * non-public models - */ - public ListModelsV1Response list(String projectId, RequestOptions requestOptions) { - return this.rawClient.list(projectId, requestOptions).body(); - } - - /** - * Returns metadata on all the latest models that a specific project has access to, including - * non-public models - */ - public ListModelsV1Response list(String projectId, ModelsListRequest request) { - return this.rawClient.list(projectId, request).body(); - } - - /** - * Returns metadata on all the latest models that a specific project has access to, including - * non-public models - */ - public ListModelsV1Response list( - String projectId, ModelsListRequest request, RequestOptions requestOptions) { - return this.rawClient.list(projectId, request, requestOptions).body(); - } - - /** Returns metadata for a specific model */ - public GetModelV1Response get(String projectId, String modelId) { - return this.rawClient.get(projectId, modelId).body(); - } - - /** Returns metadata for a specific model */ - public GetModelV1Response get(String projectId, String modelId, RequestOptions requestOptions) { - return this.rawClient.get(projectId, modelId, requestOptions).body(); - } -} diff --git a/src/main/java/resources/manage/v1/projects/models/RawModelsClient.java b/src/main/java/resources/manage/v1/projects/models/RawModelsClient.java deleted file mode 100644 index dd64f91..0000000 --- a/src/main/java/resources/manage/v1/projects/models/RawModelsClient.java +++ /dev/null @@ -1,173 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.models; - -import com.fasterxml.jackson.core.JsonProcessingException; -import core.ClientOptions; -import core.DeepgramApiApiException; -import core.DeepgramApiException; -import core.DeepgramApiHttpResponse; -import core.ObjectMappers; -import core.QueryStringMapper; -import core.RequestOptions; -import errors.BadRequestError; -import java.io.IOException; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import okhttp3.ResponseBody; -import resources.manage.v1.projects.models.requests.ModelsListRequest; -import types.GetModelV1Response; -import types.ListModelsV1Response; - -public class RawModelsClient { - protected final ClientOptions clientOptions; - - public RawModelsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** - * Returns metadata on all the latest models that a specific project has access to, including - * non-public models - */ - public DeepgramApiHttpResponse list(String projectId) { - return list(projectId, ModelsListRequest.builder().build()); - } - - /** - * Returns metadata on all the latest models that a specific project has access to, including - * non-public models - */ - public DeepgramApiHttpResponse list( - String projectId, RequestOptions requestOptions) { - return list(projectId, ModelsListRequest.builder().build(), requestOptions); - } - - /** - * Returns metadata on all the latest models that a specific project has access to, including - * non-public models - */ - public DeepgramApiHttpResponse list( - String projectId, ModelsListRequest request) { - return list(projectId, request, null); - } - - /** - * Returns metadata on all the latest models that a specific project has access to, including - * non-public models - */ - public DeepgramApiHttpResponse list( - String projectId, ModelsListRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("models"); - if (request.getIncludeOutdated().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "include_outdated", request.getIncludeOutdated().get(), false); - } - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request.Builder _requestBuilder = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "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(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ListModelsV1Response.class), - response); - } - try { - if (response.code() == 400) { - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new DeepgramApiApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (IOException e) { - throw new DeepgramApiException("Network error executing HTTP request", e); - } - } - - /** Returns metadata for a specific model */ - public DeepgramApiHttpResponse get(String projectId, String modelId) { - return get(projectId, modelId, null); - } - - /** Returns metadata for a specific model */ - public DeepgramApiHttpResponse get( - String projectId, String modelId, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("models") - .addPathSegment(modelId); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "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(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetModelV1Response.class), - response); - } - try { - if (response.code() == 400) { - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new DeepgramApiApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (IOException e) { - throw new DeepgramApiException("Network error executing HTTP request", e); - } - } -} diff --git a/src/main/java/resources/manage/v1/projects/models/requests/ModelsListRequest.java b/src/main/java/resources/manage/v1/projects/models/requests/ModelsListRequest.java deleted file mode 100644 index edc2621..0000000 --- a/src/main/java/resources/manage/v1/projects/models/requests/ModelsListRequest.java +++ /dev/null @@ -1,108 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.models.requests; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import 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 = ModelsListRequest.Builder.class) -public final class ModelsListRequest { - private final Optional includeOutdated; - - private final Map additionalProperties; - - private ModelsListRequest( - Optional includeOutdated, Map additionalProperties) { - this.includeOutdated = includeOutdated; - this.additionalProperties = additionalProperties; - } - - /** - * @return - *

non-latest versions of models - */ - @JsonIgnore - public Optional getIncludeOutdated() { - return includeOutdated; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ModelsListRequest && equalTo((ModelsListRequest) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ModelsListRequest other) { - return includeOutdated.equals(other.includeOutdated); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.includeOutdated); - } - - @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 includeOutdated = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ModelsListRequest other) { - includeOutdated(other.getIncludeOutdated()); - return this; - } - - /** returns non-latest versions of models */ - @JsonSetter(value = "include_outdated", nulls = Nulls.SKIP) - public Builder includeOutdated(Optional includeOutdated) { - this.includeOutdated = includeOutdated; - return this; - } - - public Builder includeOutdated(Boolean includeOutdated) { - this.includeOutdated = Optional.ofNullable(includeOutdated); - return this; - } - - public ModelsListRequest build() { - return new ModelsListRequest(includeOutdated, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/manage/v1/projects/requests/AsyncRawRequestsClient.java b/src/main/java/resources/manage/v1/projects/requests/AsyncRawRequestsClient.java deleted file mode 100644 index 89bb5df..0000000 --- a/src/main/java/resources/manage/v1/projects/requests/AsyncRawRequestsClient.java +++ /dev/null @@ -1,253 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.requests; - -import com.fasterxml.jackson.core.JsonProcessingException; -import core.ClientOptions; -import core.DeepgramApiApiException; -import core.DeepgramApiException; -import core.DeepgramApiHttpResponse; -import core.ObjectMappers; -import core.QueryStringMapper; -import core.RequestOptions; -import errors.BadRequestError; -import java.io.IOException; -import java.util.concurrent.CompletableFuture; -import okhttp3.Call; -import okhttp3.Callback; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import okhttp3.ResponseBody; -import org.jetbrains.annotations.NotNull; -import resources.manage.v1.projects.requests.requests.RequestsListRequest; -import types.GetProjectRequestV1Response; -import types.ListProjectRequestsV1Response; - -public class AsyncRawRequestsClient { - protected final ClientOptions clientOptions; - - public AsyncRawRequestsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** Generates a list of requests for a specific project */ - public CompletableFuture> list( - String projectId) { - return list(projectId, RequestsListRequest.builder().build()); - } - - /** Generates a list of requests for a specific project */ - public CompletableFuture> list( - String projectId, RequestOptions requestOptions) { - return list(projectId, RequestsListRequest.builder().build(), requestOptions); - } - - /** Generates a list of requests for a specific project */ - public CompletableFuture> list( - String projectId, RequestsListRequest request) { - return list(projectId, request, null); - } - - /** Generates a list of requests for a specific project */ - public CompletableFuture> list( - String projectId, RequestsListRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("requests"); - if (request.getStart().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "start", request.getStart().get(), false); - } - if (request.getEnd().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "end", request.getEnd().get(), false); - } - if (request.getLimit().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "limit", request.getLimit().get(), false); - } - if (request.getPage().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "page", request.getPage().get(), false); - } - if (request.getAccessor().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "accessor", request.getAccessor().get(), false); - } - if (request.getRequestId().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "request_id", request.getRequestId().get(), false); - } - if (request.getDeployment().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "deployment", request.getDeployment().get(), false); - } - if (request.getEndpoint().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "endpoint", request.getEndpoint().get(), false); - } - if (request.getMethod().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "method", request.getMethod().get(), false); - } - if (request.getStatus().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "status", request.getStatus().get(), false); - } - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request.Builder _requestBuilder = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json"); - Request okhttpRequest = _requestBuilder.build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = - new CompletableFuture<>(); - client - .newCall(okhttpRequest) - .enqueue( - new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) - throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete( - new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, ListProjectRequestsV1Response.class), - response)); - return; - } - try { - if (response.code() == 400) { - future.completeExceptionally( - new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally( - new DeepgramApiApiException( - "Error with status code " + response.code(), - response.code(), - errorBody, - response)); - return; - } catch (IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - }); - return future; - } - - /** Retrieves a specific request for a specific project */ - public CompletableFuture> get( - String projectId, String requestId) { - return get(projectId, requestId, null); - } - - /** Retrieves a specific request for a specific project */ - public CompletableFuture> get( - String projectId, String requestId, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("requests") - .addPathSegment(requestId); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = - new CompletableFuture<>(); - client - .newCall(okhttpRequest) - .enqueue( - new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) - throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete( - new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, GetProjectRequestV1Response.class), - response)); - return; - } - try { - if (response.code() == 400) { - future.completeExceptionally( - new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally( - new DeepgramApiApiException( - "Error with status code " + response.code(), - response.code(), - errorBody, - response)); - return; - } catch (IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - }); - return future; - } -} diff --git a/src/main/java/resources/manage/v1/projects/requests/AsyncRequestsClient.java b/src/main/java/resources/manage/v1/projects/requests/AsyncRequestsClient.java deleted file mode 100644 index 64b111b..0000000 --- a/src/main/java/resources/manage/v1/projects/requests/AsyncRequestsClient.java +++ /dev/null @@ -1,63 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.requests; - -import core.ClientOptions; -import core.RequestOptions; -import java.util.concurrent.CompletableFuture; -import resources.manage.v1.projects.requests.requests.RequestsListRequest; -import types.GetProjectRequestV1Response; -import types.ListProjectRequestsV1Response; - -public class AsyncRequestsClient { - protected final ClientOptions clientOptions; - - private final AsyncRawRequestsClient rawClient; - - public AsyncRequestsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new AsyncRawRequestsClient(clientOptions); - } - - /** Get responses with HTTP metadata like headers */ - public AsyncRawRequestsClient withRawResponse() { - return this.rawClient; - } - - /** Generates a list of requests for a specific project */ - public CompletableFuture list(String projectId) { - return this.rawClient.list(projectId).thenApply(response -> response.body()); - } - - /** Generates a list of requests for a specific project */ - public CompletableFuture list( - String projectId, RequestOptions requestOptions) { - return this.rawClient.list(projectId, requestOptions).thenApply(response -> response.body()); - } - - /** Generates a list of requests for a specific project */ - public CompletableFuture list( - String projectId, RequestsListRequest request) { - return this.rawClient.list(projectId, request).thenApply(response -> response.body()); - } - - /** Generates a list of requests for a specific project */ - public CompletableFuture list( - String projectId, RequestsListRequest request, RequestOptions requestOptions) { - return this.rawClient - .list(projectId, request, requestOptions) - .thenApply(response -> response.body()); - } - - /** Retrieves a specific request for a specific project */ - public CompletableFuture get(String projectId, String requestId) { - return this.rawClient.get(projectId, requestId).thenApply(response -> response.body()); - } - - /** Retrieves a specific request for a specific project */ - public CompletableFuture get( - String projectId, String requestId, RequestOptions requestOptions) { - return this.rawClient - .get(projectId, requestId, requestOptions) - .thenApply(response -> response.body()); - } -} diff --git a/src/main/java/resources/manage/v1/projects/requests/ProjectsGetRequest.java b/src/main/java/resources/manage/v1/projects/requests/ProjectsGetRequest.java deleted file mode 100644 index 2c992ea..0000000 --- a/src/main/java/resources/manage/v1/projects/requests/ProjectsGetRequest.java +++ /dev/null @@ -1,136 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.requests; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import 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 = ProjectsGetRequest.Builder.class) -public final class ProjectsGetRequest { - private final Optional limit; - - private final Optional page; - - private final Map additionalProperties; - - private ProjectsGetRequest( - Optional limit, Optional page, Map additionalProperties) { - this.limit = limit; - this.page = page; - this.additionalProperties = additionalProperties; - } - - /** - * @return Number of results to return per page. Default 10. Range [1,1000] - */ - @JsonIgnore - public Optional getLimit() { - return limit; - } - - /** - * @return Navigate and return the results to retrieve specific portions of information of the - * response - */ - @JsonIgnore - public Optional getPage() { - return page; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ProjectsGetRequest && equalTo((ProjectsGetRequest) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ProjectsGetRequest other) { - return limit.equals(other.limit) && page.equals(other.page); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.limit, this.page); - } - - @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 page = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ProjectsGetRequest other) { - limit(other.getLimit()); - page(other.getPage()); - return this; - } - - /** Number of results to return per page. Default 10. Range [1,1000] */ - @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; - } - - /** - * Navigate and return the results to retrieve specific portions of information of the response - */ - @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; - } - - public ProjectsGetRequest build() { - return new ProjectsGetRequest(limit, page, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/manage/v1/projects/requests/RawRequestsClient.java b/src/main/java/resources/manage/v1/projects/requests/RawRequestsClient.java deleted file mode 100644 index e0c8c4f..0000000 --- a/src/main/java/resources/manage/v1/projects/requests/RawRequestsClient.java +++ /dev/null @@ -1,192 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.requests; - -import com.fasterxml.jackson.core.JsonProcessingException; -import core.ClientOptions; -import core.DeepgramApiApiException; -import core.DeepgramApiException; -import core.DeepgramApiHttpResponse; -import core.ObjectMappers; -import core.QueryStringMapper; -import core.RequestOptions; -import errors.BadRequestError; -import java.io.IOException; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import okhttp3.ResponseBody; -import resources.manage.v1.projects.requests.requests.RequestsListRequest; -import types.GetProjectRequestV1Response; -import types.ListProjectRequestsV1Response; - -public class RawRequestsClient { - protected final ClientOptions clientOptions; - - public RawRequestsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** Generates a list of requests for a specific project */ - public DeepgramApiHttpResponse list(String projectId) { - return list(projectId, RequestsListRequest.builder().build()); - } - - /** Generates a list of requests for a specific project */ - public DeepgramApiHttpResponse list( - String projectId, RequestOptions requestOptions) { - return list(projectId, RequestsListRequest.builder().build(), requestOptions); - } - - /** Generates a list of requests for a specific project */ - public DeepgramApiHttpResponse list( - String projectId, RequestsListRequest request) { - return list(projectId, request, null); - } - - /** Generates a list of requests for a specific project */ - public DeepgramApiHttpResponse list( - String projectId, RequestsListRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("requests"); - if (request.getStart().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "start", request.getStart().get(), false); - } - if (request.getEnd().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "end", request.getEnd().get(), false); - } - if (request.getLimit().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "limit", request.getLimit().get(), false); - } - if (request.getPage().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "page", request.getPage().get(), false); - } - if (request.getAccessor().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "accessor", request.getAccessor().get(), false); - } - if (request.getRequestId().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "request_id", request.getRequestId().get(), false); - } - if (request.getDeployment().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "deployment", request.getDeployment().get(), false); - } - if (request.getEndpoint().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "endpoint", request.getEndpoint().get(), false); - } - if (request.getMethod().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "method", request.getMethod().get(), false); - } - if (request.getStatus().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "status", request.getStatus().get(), false); - } - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request.Builder _requestBuilder = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "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(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, ListProjectRequestsV1Response.class), - response); - } - try { - if (response.code() == 400) { - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new DeepgramApiApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (IOException e) { - throw new DeepgramApiException("Network error executing HTTP request", e); - } - } - - /** Retrieves a specific request for a specific project */ - public DeepgramApiHttpResponse get( - String projectId, String requestId) { - return get(projectId, requestId, null); - } - - /** Retrieves a specific request for a specific project */ - public DeepgramApiHttpResponse get( - String projectId, String requestId, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("requests") - .addPathSegment(requestId); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "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(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, GetProjectRequestV1Response.class), - response); - } - try { - if (response.code() == 400) { - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new DeepgramApiApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (IOException e) { - throw new DeepgramApiException("Network error executing HTTP request", e); - } - } -} diff --git a/src/main/java/resources/manage/v1/projects/requests/RequestsClient.java b/src/main/java/resources/manage/v1/projects/requests/RequestsClient.java deleted file mode 100644 index 10490d9..0000000 --- a/src/main/java/resources/manage/v1/projects/requests/RequestsClient.java +++ /dev/null @@ -1,56 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.requests; - -import core.ClientOptions; -import core.RequestOptions; -import resources.manage.v1.projects.requests.requests.RequestsListRequest; -import types.GetProjectRequestV1Response; -import types.ListProjectRequestsV1Response; - -public class RequestsClient { - protected final ClientOptions clientOptions; - - private final RawRequestsClient rawClient; - - public RequestsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new RawRequestsClient(clientOptions); - } - - /** Get responses with HTTP metadata like headers */ - public RawRequestsClient withRawResponse() { - return this.rawClient; - } - - /** Generates a list of requests for a specific project */ - public ListProjectRequestsV1Response list(String projectId) { - return this.rawClient.list(projectId).body(); - } - - /** Generates a list of requests for a specific project */ - public ListProjectRequestsV1Response list(String projectId, RequestOptions requestOptions) { - return this.rawClient.list(projectId, requestOptions).body(); - } - - /** Generates a list of requests for a specific project */ - public ListProjectRequestsV1Response list(String projectId, RequestsListRequest request) { - return this.rawClient.list(projectId, request).body(); - } - - /** Generates a list of requests for a specific project */ - public ListProjectRequestsV1Response list( - String projectId, RequestsListRequest request, RequestOptions requestOptions) { - return this.rawClient.list(projectId, request, requestOptions).body(); - } - - /** Retrieves a specific request for a specific project */ - public GetProjectRequestV1Response get(String projectId, String requestId) { - return this.rawClient.get(projectId, requestId).body(); - } - - /** Retrieves a specific request for a specific project */ - public GetProjectRequestV1Response get( - String projectId, String requestId, RequestOptions requestOptions) { - return this.rawClient.get(projectId, requestId, requestOptions).body(); - } -} diff --git a/src/main/java/resources/manage/v1/projects/requests/UpdateProjectV1Request.java b/src/main/java/resources/manage/v1/projects/requests/UpdateProjectV1Request.java deleted file mode 100644 index c8b3090..0000000 --- a/src/main/java/resources/manage/v1/projects/requests/UpdateProjectV1Request.java +++ /dev/null @@ -1,106 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.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 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 = UpdateProjectV1Request.Builder.class) -public final class UpdateProjectV1Request { - private final Optional name; - - private final Map additionalProperties; - - private UpdateProjectV1Request(Optional name, Map additionalProperties) { - this.name = name; - this.additionalProperties = additionalProperties; - } - - /** - * @return The name of the project - */ - @JsonProperty("name") - public Optional getName() { - return name; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpdateProjectV1Request && equalTo((UpdateProjectV1Request) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(UpdateProjectV1Request 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(UpdateProjectV1Request other) { - name(other.getName()); - return this; - } - - /** The name of the project */ - @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 UpdateProjectV1Request build() { - return new UpdateProjectV1Request(name, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/manage/v1/projects/requests/requests/RequestsListRequest.java b/src/main/java/resources/manage/v1/projects/requests/requests/RequestsListRequest.java deleted file mode 100644 index d53434b..0000000 --- a/src/main/java/resources/manage/v1/projects/requests/requests/RequestsListRequest.java +++ /dev/null @@ -1,400 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.requests.requests; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import core.ObjectMappers; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import resources.manage.v1.projects.requests.types.RequestsListRequestDeployment; -import resources.manage.v1.projects.requests.types.RequestsListRequestEndpoint; -import resources.manage.v1.projects.requests.types.RequestsListRequestMethod; -import resources.manage.v1.projects.requests.types.RequestsListRequestStatus; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = RequestsListRequest.Builder.class) -public final class RequestsListRequest { - private final Optional start; - - private final Optional end; - - private final Optional limit; - - private final Optional page; - - private final Optional accessor; - - private final Optional requestId; - - private final Optional deployment; - - private final Optional endpoint; - - private final Optional method; - - private final Optional status; - - private final Map additionalProperties; - - private RequestsListRequest( - Optional start, - Optional end, - Optional limit, - Optional page, - Optional accessor, - Optional requestId, - Optional deployment, - Optional endpoint, - Optional method, - Optional status, - Map additionalProperties) { - this.start = start; - this.end = end; - this.limit = limit; - this.page = page; - this.accessor = accessor; - this.requestId = requestId; - this.deployment = deployment; - this.endpoint = endpoint; - this.method = method; - this.status = status; - this.additionalProperties = additionalProperties; - } - - /** - * @return Start date of the requested date range. Formats accepted are YYYY-MM-DD, - * YYYY-MM-DDTHH:MM:SS, or YYYY-MM-DDTHH:MM:SS+HH:MM - */ - @JsonIgnore - public Optional getStart() { - return start; - } - - /** - * @return End date of the requested date range. Formats accepted are YYYY-MM-DD, - * YYYY-MM-DDTHH:MM:SS, or YYYY-MM-DDTHH:MM:SS+HH:MM - */ - @JsonIgnore - public Optional getEnd() { - return end; - } - - /** - * @return Number of results to return per page. Default 10. Range [1,1000] - */ - @JsonIgnore - public Optional getLimit() { - return limit; - } - - /** - * @return Navigate and return the results to retrieve specific portions of information of the - * response - */ - @JsonIgnore - public Optional getPage() { - return page; - } - - /** - * @return Filter for requests where a specific accessor was used - */ - @JsonIgnore - public Optional getAccessor() { - return accessor; - } - - /** - * @return Filter for a specific request id - */ - @JsonIgnore - public Optional getRequestId() { - return requestId; - } - - /** - * @return Filter for requests where a specific deployment was used - */ - @JsonIgnore - public Optional getDeployment() { - return deployment; - } - - /** - * @return Filter for requests where a specific endpoint was used - */ - @JsonIgnore - public Optional getEndpoint() { - return endpoint; - } - - /** - * @return Filter for requests where a specific method was used - */ - @JsonIgnore - public Optional getMethod() { - return method; - } - - /** - * @return Filter for requests that succeeded (status code < 300) or failed (status code - * >=400) - */ - @JsonIgnore - public Optional getStatus() { - return status; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof RequestsListRequest && equalTo((RequestsListRequest) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(RequestsListRequest other) { - return start.equals(other.start) - && end.equals(other.end) - && limit.equals(other.limit) - && page.equals(other.page) - && accessor.equals(other.accessor) - && requestId.equals(other.requestId) - && deployment.equals(other.deployment) - && endpoint.equals(other.endpoint) - && method.equals(other.method) - && status.equals(other.status); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.start, - this.end, - this.limit, - this.page, - this.accessor, - this.requestId, - this.deployment, - this.endpoint, - this.method, - this.status); - } - - @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 start = Optional.empty(); - - private Optional end = Optional.empty(); - - private Optional limit = Optional.empty(); - - private Optional page = Optional.empty(); - - private Optional accessor = Optional.empty(); - - private Optional requestId = Optional.empty(); - - private Optional deployment = Optional.empty(); - - private Optional endpoint = Optional.empty(); - - private Optional method = Optional.empty(); - - private Optional status = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(RequestsListRequest other) { - start(other.getStart()); - end(other.getEnd()); - limit(other.getLimit()); - page(other.getPage()); - accessor(other.getAccessor()); - requestId(other.getRequestId()); - deployment(other.getDeployment()); - endpoint(other.getEndpoint()); - method(other.getMethod()); - status(other.getStatus()); - return this; - } - - /** - * Start date of the requested date range. Formats accepted are YYYY-MM-DD, YYYY-MM-DDTHH:MM:SS, - * or YYYY-MM-DDTHH:MM:SS+HH:MM - */ - @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; - } - - /** - * End date of the requested date range. Formats accepted are YYYY-MM-DD, YYYY-MM-DDTHH:MM:SS, - * or YYYY-MM-DDTHH:MM:SS+HH:MM - */ - @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; - } - - /** Number of results to return per page. Default 10. Range [1,1000] */ - @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; - } - - /** - * Navigate and return the results to retrieve specific portions of information of the response - */ - @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; - } - - /** Filter for requests where a specific accessor was used */ - @JsonSetter(value = "accessor", nulls = Nulls.SKIP) - public Builder accessor(Optional accessor) { - this.accessor = accessor; - return this; - } - - public Builder accessor(String accessor) { - this.accessor = Optional.ofNullable(accessor); - return this; - } - - /** Filter for a specific request id */ - @JsonSetter(value = "request_id", nulls = Nulls.SKIP) - public Builder requestId(Optional requestId) { - this.requestId = requestId; - return this; - } - - public Builder requestId(String requestId) { - this.requestId = Optional.ofNullable(requestId); - return this; - } - - /** Filter for requests where a specific deployment was used */ - @JsonSetter(value = "deployment", nulls = Nulls.SKIP) - public Builder deployment(Optional deployment) { - this.deployment = deployment; - return this; - } - - public Builder deployment(RequestsListRequestDeployment deployment) { - this.deployment = Optional.ofNullable(deployment); - return this; - } - - /** Filter for requests where a specific endpoint was used */ - @JsonSetter(value = "endpoint", nulls = Nulls.SKIP) - public Builder endpoint(Optional endpoint) { - this.endpoint = endpoint; - return this; - } - - public Builder endpoint(RequestsListRequestEndpoint endpoint) { - this.endpoint = Optional.ofNullable(endpoint); - return this; - } - - /** Filter for requests where a specific method was used */ - @JsonSetter(value = "method", nulls = Nulls.SKIP) - public Builder method(Optional method) { - this.method = method; - return this; - } - - public Builder method(RequestsListRequestMethod method) { - this.method = Optional.ofNullable(method); - return this; - } - - /** - * Filter for requests that succeeded (status code < 300) or failed (status code >=400) - */ - @JsonSetter(value = "status", nulls = Nulls.SKIP) - public Builder status(Optional status) { - this.status = status; - return this; - } - - public Builder status(RequestsListRequestStatus status) { - this.status = Optional.ofNullable(status); - return this; - } - - public RequestsListRequest build() { - return new RequestsListRequest( - start, - end, - limit, - page, - accessor, - requestId, - deployment, - endpoint, - method, - status, - additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/manage/v1/projects/requests/types/RequestsListRequestDeployment.java b/src/main/java/resources/manage/v1/projects/requests/types/RequestsListRequestDeployment.java deleted file mode 100644 index 525e1c1..0000000 --- a/src/main/java/resources/manage/v1/projects/requests/types/RequestsListRequestDeployment.java +++ /dev/null @@ -1,95 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.requests.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class RequestsListRequestDeployment { - public static final RequestsListRequestDeployment SELF_HOSTED = - new RequestsListRequestDeployment(Value.SELF_HOSTED, "self-hosted"); - - public static final RequestsListRequestDeployment BETA = - new RequestsListRequestDeployment(Value.BETA, "beta"); - - public static final RequestsListRequestDeployment HOSTED = - new RequestsListRequestDeployment(Value.HOSTED, "hosted"); - - private final Value value; - - private final String string; - - RequestsListRequestDeployment(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof RequestsListRequestDeployment - && this.string.equals(((RequestsListRequestDeployment) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case SELF_HOSTED: - return visitor.visitSelfHosted(); - case BETA: - return visitor.visitBeta(); - case HOSTED: - return visitor.visitHosted(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static RequestsListRequestDeployment valueOf(String value) { - switch (value) { - case "self-hosted": - return SELF_HOSTED; - case "beta": - return BETA; - case "hosted": - return HOSTED; - default: - return new RequestsListRequestDeployment(Value.UNKNOWN, value); - } - } - - public enum Value { - HOSTED, - - BETA, - - SELF_HOSTED, - - UNKNOWN - } - - public interface Visitor { - T visitHosted(); - - T visitBeta(); - - T visitSelfHosted(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/resources/manage/v1/projects/requests/types/RequestsListRequestEndpoint.java b/src/main/java/resources/manage/v1/projects/requests/types/RequestsListRequestEndpoint.java deleted file mode 100644 index db34c74..0000000 --- a/src/main/java/resources/manage/v1/projects/requests/types/RequestsListRequestEndpoint.java +++ /dev/null @@ -1,106 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.requests.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class RequestsListRequestEndpoint { - public static final RequestsListRequestEndpoint AGENT = - new RequestsListRequestEndpoint(Value.AGENT, "agent"); - - public static final RequestsListRequestEndpoint READ = - new RequestsListRequestEndpoint(Value.READ, "read"); - - public static final RequestsListRequestEndpoint LISTEN = - new RequestsListRequestEndpoint(Value.LISTEN, "listen"); - - public static final RequestsListRequestEndpoint SPEAK = - new RequestsListRequestEndpoint(Value.SPEAK, "speak"); - - private final Value value; - - private final String string; - - RequestsListRequestEndpoint(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof RequestsListRequestEndpoint - && this.string.equals(((RequestsListRequestEndpoint) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case AGENT: - return visitor.visitAgent(); - case READ: - return visitor.visitRead(); - case LISTEN: - return visitor.visitListen(); - case SPEAK: - return visitor.visitSpeak(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static RequestsListRequestEndpoint valueOf(String value) { - switch (value) { - case "agent": - return AGENT; - case "read": - return READ; - case "listen": - return LISTEN; - case "speak": - return SPEAK; - default: - return new RequestsListRequestEndpoint(Value.UNKNOWN, value); - } - } - - public enum Value { - LISTEN, - - READ, - - SPEAK, - - AGENT, - - UNKNOWN - } - - public interface Visitor { - T visitListen(); - - T visitRead(); - - T visitSpeak(); - - T visitAgent(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/resources/manage/v1/projects/requests/types/RequestsListRequestMethod.java b/src/main/java/resources/manage/v1/projects/requests/types/RequestsListRequestMethod.java deleted file mode 100644 index 2ef4279..0000000 --- a/src/main/java/resources/manage/v1/projects/requests/types/RequestsListRequestMethod.java +++ /dev/null @@ -1,95 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.requests.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class RequestsListRequestMethod { - public static final RequestsListRequestMethod SYNC = - new RequestsListRequestMethod(Value.SYNC, "sync"); - - public static final RequestsListRequestMethod STREAMING = - new RequestsListRequestMethod(Value.STREAMING, "streaming"); - - public static final RequestsListRequestMethod ASYNC = - new RequestsListRequestMethod(Value.ASYNC, "async"); - - private final Value value; - - private final String string; - - RequestsListRequestMethod(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof RequestsListRequestMethod - && this.string.equals(((RequestsListRequestMethod) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case SYNC: - return visitor.visitSync(); - case STREAMING: - return visitor.visitStreaming(); - case ASYNC: - return visitor.visitAsync(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static RequestsListRequestMethod valueOf(String value) { - switch (value) { - case "sync": - return SYNC; - case "streaming": - return STREAMING; - case "async": - return ASYNC; - default: - return new RequestsListRequestMethod(Value.UNKNOWN, value); - } - } - - public enum Value { - SYNC, - - ASYNC, - - STREAMING, - - UNKNOWN - } - - public interface Visitor { - T visitSync(); - - T visitAsync(); - - T visitStreaming(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/resources/manage/v1/projects/requests/types/RequestsListRequestStatus.java b/src/main/java/resources/manage/v1/projects/requests/types/RequestsListRequestStatus.java deleted file mode 100644 index 841b7a4..0000000 --- a/src/main/java/resources/manage/v1/projects/requests/types/RequestsListRequestStatus.java +++ /dev/null @@ -1,84 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.requests.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class RequestsListRequestStatus { - public static final RequestsListRequestStatus SUCCEEDED = - new RequestsListRequestStatus(Value.SUCCEEDED, "succeeded"); - - public static final RequestsListRequestStatus FAILED = - new RequestsListRequestStatus(Value.FAILED, "failed"); - - private final Value value; - - private final String string; - - RequestsListRequestStatus(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof RequestsListRequestStatus - && this.string.equals(((RequestsListRequestStatus) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case SUCCEEDED: - return visitor.visitSucceeded(); - case FAILED: - return visitor.visitFailed(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static RequestsListRequestStatus valueOf(String value) { - switch (value) { - case "succeeded": - return SUCCEEDED; - case "failed": - return FAILED; - default: - return new RequestsListRequestStatus(Value.UNKNOWN, value); - } - } - - public enum Value { - SUCCEEDED, - - FAILED, - - UNKNOWN - } - - public interface Visitor { - T visitSucceeded(); - - T visitFailed(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/resources/manage/v1/projects/usage/AsyncRawUsageClient.java b/src/main/java/resources/manage/v1/projects/usage/AsyncRawUsageClient.java deleted file mode 100644 index 7b8f40b..0000000 --- a/src/main/java/resources/manage/v1/projects/usage/AsyncRawUsageClient.java +++ /dev/null @@ -1,295 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.usage; - -import com.fasterxml.jackson.core.JsonProcessingException; -import core.ClientOptions; -import core.DeepgramApiApiException; -import core.DeepgramApiException; -import core.DeepgramApiHttpResponse; -import core.ObjectMappers; -import core.QueryStringMapper; -import core.RequestOptions; -import errors.BadRequestError; -import java.io.IOException; -import java.util.concurrent.CompletableFuture; -import okhttp3.Call; -import okhttp3.Callback; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import okhttp3.ResponseBody; -import org.jetbrains.annotations.NotNull; -import resources.manage.v1.projects.usage.requests.UsageGetRequest; -import types.UsageV1Response; - -public class AsyncRawUsageClient { - protected final ClientOptions clientOptions; - - public AsyncRawUsageClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** - * Retrieves the usage for a specific project. Use Get Project Usage Breakdown for a more - * comprehensive usage summary. - */ - public CompletableFuture> get(String projectId) { - return get(projectId, UsageGetRequest.builder().build()); - } - - /** - * Retrieves the usage for a specific project. Use Get Project Usage Breakdown for a more - * comprehensive usage summary. - */ - public CompletableFuture> get( - String projectId, RequestOptions requestOptions) { - return get(projectId, UsageGetRequest.builder().build(), requestOptions); - } - - /** - * Retrieves the usage for a specific project. Use Get Project Usage Breakdown for a more - * comprehensive usage summary. - */ - public CompletableFuture> get( - String projectId, UsageGetRequest request) { - return get(projectId, request, null); - } - - /** - * Retrieves the usage for a specific project. Use Get Project Usage Breakdown for a more - * comprehensive usage summary. - */ - public CompletableFuture> get( - String projectId, UsageGetRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("usage"); - if (request.getStart().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "start", request.getStart().get(), false); - } - if (request.getEnd().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "end", request.getEnd().get(), false); - } - if (request.getAccessor().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "accessor", request.getAccessor().get(), false); - } - if (request.getAlternatives().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "alternatives", request.getAlternatives().get(), false); - } - if (request.getCallbackMethod().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "callback_method", request.getCallbackMethod().get(), false); - } - if (request.getCallback().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "callback", request.getCallback().get(), false); - } - if (request.getChannels().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "channels", request.getChannels().get(), false); - } - if (request.getCustomIntentMode().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "custom_intent_mode", request.getCustomIntentMode().get(), false); - } - if (request.getCustomIntent().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "custom_intent", request.getCustomIntent().get(), false); - } - if (request.getCustomTopicMode().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "custom_topic_mode", request.getCustomTopicMode().get(), false); - } - if (request.getCustomTopic().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "custom_topic", request.getCustomTopic().get(), false); - } - if (request.getDeployment().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "deployment", request.getDeployment().get(), false); - } - if (request.getDetectEntities().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "detect_entities", request.getDetectEntities().get(), false); - } - if (request.getDetectLanguage().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "detect_language", request.getDetectLanguage().get(), false); - } - if (request.getDiarize().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "diarize", request.getDiarize().get(), false); - } - if (request.getDictation().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "dictation", request.getDictation().get(), false); - } - if (request.getEncoding().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "encoding", request.getEncoding().get(), false); - } - if (request.getEndpoint().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "endpoint", request.getEndpoint().get(), false); - } - if (request.getExtra().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "extra", request.getExtra().get(), false); - } - if (request.getFillerWords().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "filler_words", request.getFillerWords().get(), false); - } - if (request.getIntents().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "intents", request.getIntents().get(), false); - } - if (request.getKeyterm().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "keyterm", request.getKeyterm().get(), false); - } - if (request.getKeywords().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "keywords", request.getKeywords().get(), false); - } - if (request.getLanguage().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "language", request.getLanguage().get(), false); - } - if (request.getMeasurements().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "measurements", request.getMeasurements().get(), false); - } - if (request.getMethod().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "method", request.getMethod().get(), false); - } - if (request.getModel().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "model", request.getModel().get(), false); - } - if (request.getMultichannel().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "multichannel", request.getMultichannel().get(), false); - } - if (request.getNumerals().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "numerals", request.getNumerals().get(), false); - } - if (request.getParagraphs().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "paragraphs", request.getParagraphs().get(), false); - } - if (request.getProfanityFilter().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "profanity_filter", request.getProfanityFilter().get(), false); - } - if (request.getPunctuate().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "punctuate", request.getPunctuate().get(), false); - } - if (request.getRedact().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "redact", request.getRedact().get(), false); - } - if (request.getReplace().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "replace", request.getReplace().get(), false); - } - if (request.getSampleRate().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "sample_rate", request.getSampleRate().get(), false); - } - if (request.getSearch().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "search", request.getSearch().get(), false); - } - if (request.getSentiment().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "sentiment", request.getSentiment().get(), false); - } - if (request.getSmartFormat().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "smart_format", request.getSmartFormat().get(), false); - } - if (request.getSummarize().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "summarize", request.getSummarize().get(), false); - } - if (request.getTag().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "tag", request.getTag().get(), false); - } - if (request.getTopics().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "topics", request.getTopics().get(), false); - } - if (request.getUttSplit().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "utt_split", request.getUttSplit().get(), false); - } - if (request.getUtterances().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "utterances", request.getUtterances().get(), false); - } - if (request.getVersion().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "version", request.getVersion().get(), false); - } - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request.Builder _requestBuilder = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json"); - Request okhttpRequest = _requestBuilder.build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = new CompletableFuture<>(); - client - .newCall(okhttpRequest) - .enqueue( - new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) - throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete( - new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, UsageV1Response.class), - response)); - return; - } - try { - if (response.code() == 400) { - future.completeExceptionally( - new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally( - new DeepgramApiApiException( - "Error with status code " + response.code(), - response.code(), - errorBody, - response)); - return; - } catch (IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - }); - return future; - } -} diff --git a/src/main/java/resources/manage/v1/projects/usage/AsyncUsageClient.java b/src/main/java/resources/manage/v1/projects/usage/AsyncUsageClient.java deleted file mode 100644 index 4d1028c..0000000 --- a/src/main/java/resources/manage/v1/projects/usage/AsyncUsageClient.java +++ /dev/null @@ -1,77 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.usage; - -import core.ClientOptions; -import core.RequestOptions; -import core.Suppliers; -import java.util.concurrent.CompletableFuture; -import java.util.function.Supplier; -import resources.manage.v1.projects.usage.breakdown.AsyncBreakdownClient; -import resources.manage.v1.projects.usage.fields.AsyncFieldsClient; -import resources.manage.v1.projects.usage.requests.UsageGetRequest; -import types.UsageV1Response; - -public class AsyncUsageClient { - protected final ClientOptions clientOptions; - - private final AsyncRawUsageClient rawClient; - - protected final Supplier breakdownClient; - - protected final Supplier fieldsClient; - - public AsyncUsageClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new AsyncRawUsageClient(clientOptions); - this.breakdownClient = Suppliers.memoize(() -> new AsyncBreakdownClient(clientOptions)); - this.fieldsClient = Suppliers.memoize(() -> new AsyncFieldsClient(clientOptions)); - } - - /** Get responses with HTTP metadata like headers */ - public AsyncRawUsageClient withRawResponse() { - return this.rawClient; - } - - /** - * Retrieves the usage for a specific project. Use Get Project Usage Breakdown for a more - * comprehensive usage summary. - */ - public CompletableFuture get(String projectId) { - return this.rawClient.get(projectId).thenApply(response -> response.body()); - } - - /** - * Retrieves the usage for a specific project. Use Get Project Usage Breakdown for a more - * comprehensive usage summary. - */ - public CompletableFuture get(String projectId, RequestOptions requestOptions) { - return this.rawClient.get(projectId, requestOptions).thenApply(response -> response.body()); - } - - /** - * Retrieves the usage for a specific project. Use Get Project Usage Breakdown for a more - * comprehensive usage summary. - */ - public CompletableFuture get(String projectId, UsageGetRequest request) { - return this.rawClient.get(projectId, request).thenApply(response -> response.body()); - } - - /** - * Retrieves the usage for a specific project. Use Get Project Usage Breakdown for a more - * comprehensive usage summary. - */ - public CompletableFuture get( - String projectId, UsageGetRequest request, RequestOptions requestOptions) { - return this.rawClient - .get(projectId, request, requestOptions) - .thenApply(response -> response.body()); - } - - public AsyncBreakdownClient breakdown() { - return this.breakdownClient.get(); - } - - public AsyncFieldsClient fields() { - return this.fieldsClient.get(); - } -} diff --git a/src/main/java/resources/manage/v1/projects/usage/RawUsageClient.java b/src/main/java/resources/manage/v1/projects/usage/RawUsageClient.java deleted file mode 100644 index f2c15a1..0000000 --- a/src/main/java/resources/manage/v1/projects/usage/RawUsageClient.java +++ /dev/null @@ -1,262 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.usage; - -import com.fasterxml.jackson.core.JsonProcessingException; -import core.ClientOptions; -import core.DeepgramApiApiException; -import core.DeepgramApiException; -import core.DeepgramApiHttpResponse; -import core.ObjectMappers; -import core.QueryStringMapper; -import core.RequestOptions; -import errors.BadRequestError; -import java.io.IOException; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import okhttp3.ResponseBody; -import resources.manage.v1.projects.usage.requests.UsageGetRequest; -import types.UsageV1Response; - -public class RawUsageClient { - protected final ClientOptions clientOptions; - - public RawUsageClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** - * Retrieves the usage for a specific project. Use Get Project Usage Breakdown for a more - * comprehensive usage summary. - */ - public DeepgramApiHttpResponse get(String projectId) { - return get(projectId, UsageGetRequest.builder().build()); - } - - /** - * Retrieves the usage for a specific project. Use Get Project Usage Breakdown for a more - * comprehensive usage summary. - */ - public DeepgramApiHttpResponse get( - String projectId, RequestOptions requestOptions) { - return get(projectId, UsageGetRequest.builder().build(), requestOptions); - } - - /** - * Retrieves the usage for a specific project. Use Get Project Usage Breakdown for a more - * comprehensive usage summary. - */ - public DeepgramApiHttpResponse get(String projectId, UsageGetRequest request) { - return get(projectId, request, null); - } - - /** - * Retrieves the usage for a specific project. Use Get Project Usage Breakdown for a more - * comprehensive usage summary. - */ - public DeepgramApiHttpResponse get( - String projectId, UsageGetRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("usage"); - if (request.getStart().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "start", request.getStart().get(), false); - } - if (request.getEnd().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "end", request.getEnd().get(), false); - } - if (request.getAccessor().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "accessor", request.getAccessor().get(), false); - } - if (request.getAlternatives().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "alternatives", request.getAlternatives().get(), false); - } - if (request.getCallbackMethod().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "callback_method", request.getCallbackMethod().get(), false); - } - if (request.getCallback().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "callback", request.getCallback().get(), false); - } - if (request.getChannels().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "channels", request.getChannels().get(), false); - } - if (request.getCustomIntentMode().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "custom_intent_mode", request.getCustomIntentMode().get(), false); - } - if (request.getCustomIntent().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "custom_intent", request.getCustomIntent().get(), false); - } - if (request.getCustomTopicMode().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "custom_topic_mode", request.getCustomTopicMode().get(), false); - } - if (request.getCustomTopic().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "custom_topic", request.getCustomTopic().get(), false); - } - if (request.getDeployment().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "deployment", request.getDeployment().get(), false); - } - if (request.getDetectEntities().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "detect_entities", request.getDetectEntities().get(), false); - } - if (request.getDetectLanguage().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "detect_language", request.getDetectLanguage().get(), false); - } - if (request.getDiarize().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "diarize", request.getDiarize().get(), false); - } - if (request.getDictation().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "dictation", request.getDictation().get(), false); - } - if (request.getEncoding().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "encoding", request.getEncoding().get(), false); - } - if (request.getEndpoint().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "endpoint", request.getEndpoint().get(), false); - } - if (request.getExtra().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "extra", request.getExtra().get(), false); - } - if (request.getFillerWords().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "filler_words", request.getFillerWords().get(), false); - } - if (request.getIntents().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "intents", request.getIntents().get(), false); - } - if (request.getKeyterm().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "keyterm", request.getKeyterm().get(), false); - } - if (request.getKeywords().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "keywords", request.getKeywords().get(), false); - } - if (request.getLanguage().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "language", request.getLanguage().get(), false); - } - if (request.getMeasurements().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "measurements", request.getMeasurements().get(), false); - } - if (request.getMethod().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "method", request.getMethod().get(), false); - } - if (request.getModel().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "model", request.getModel().get(), false); - } - if (request.getMultichannel().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "multichannel", request.getMultichannel().get(), false); - } - if (request.getNumerals().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "numerals", request.getNumerals().get(), false); - } - if (request.getParagraphs().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "paragraphs", request.getParagraphs().get(), false); - } - if (request.getProfanityFilter().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "profanity_filter", request.getProfanityFilter().get(), false); - } - if (request.getPunctuate().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "punctuate", request.getPunctuate().get(), false); - } - if (request.getRedact().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "redact", request.getRedact().get(), false); - } - if (request.getReplace().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "replace", request.getReplace().get(), false); - } - if (request.getSampleRate().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "sample_rate", request.getSampleRate().get(), false); - } - if (request.getSearch().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "search", request.getSearch().get(), false); - } - if (request.getSentiment().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "sentiment", request.getSentiment().get(), false); - } - if (request.getSmartFormat().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "smart_format", request.getSmartFormat().get(), false); - } - if (request.getSummarize().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "summarize", request.getSummarize().get(), false); - } - if (request.getTag().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "tag", request.getTag().get(), false); - } - if (request.getTopics().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "topics", request.getTopics().get(), false); - } - if (request.getUttSplit().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "utt_split", request.getUttSplit().get(), false); - } - if (request.getUtterances().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "utterances", request.getUtterances().get(), false); - } - if (request.getVersion().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "version", request.getVersion().get(), false); - } - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request.Builder _requestBuilder = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "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(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UsageV1Response.class), - response); - } - try { - if (response.code() == 400) { - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new DeepgramApiApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (IOException e) { - throw new DeepgramApiException("Network error executing HTTP request", e); - } - } -} diff --git a/src/main/java/resources/manage/v1/projects/usage/UsageClient.java b/src/main/java/resources/manage/v1/projects/usage/UsageClient.java deleted file mode 100644 index e642606..0000000 --- a/src/main/java/resources/manage/v1/projects/usage/UsageClient.java +++ /dev/null @@ -1,74 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.usage; - -import core.ClientOptions; -import core.RequestOptions; -import core.Suppliers; -import java.util.function.Supplier; -import resources.manage.v1.projects.usage.breakdown.BreakdownClient; -import resources.manage.v1.projects.usage.fields.FieldsClient; -import resources.manage.v1.projects.usage.requests.UsageGetRequest; -import types.UsageV1Response; - -public class UsageClient { - protected final ClientOptions clientOptions; - - private final RawUsageClient rawClient; - - protected final Supplier breakdownClient; - - protected final Supplier fieldsClient; - - public UsageClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new RawUsageClient(clientOptions); - this.breakdownClient = Suppliers.memoize(() -> new BreakdownClient(clientOptions)); - this.fieldsClient = Suppliers.memoize(() -> new FieldsClient(clientOptions)); - } - - /** Get responses with HTTP metadata like headers */ - public RawUsageClient withRawResponse() { - return this.rawClient; - } - - /** - * Retrieves the usage for a specific project. Use Get Project Usage Breakdown for a more - * comprehensive usage summary. - */ - public UsageV1Response get(String projectId) { - return this.rawClient.get(projectId).body(); - } - - /** - * Retrieves the usage for a specific project. Use Get Project Usage Breakdown for a more - * comprehensive usage summary. - */ - public UsageV1Response get(String projectId, RequestOptions requestOptions) { - return this.rawClient.get(projectId, requestOptions).body(); - } - - /** - * Retrieves the usage for a specific project. Use Get Project Usage Breakdown for a more - * comprehensive usage summary. - */ - public UsageV1Response get(String projectId, UsageGetRequest request) { - return this.rawClient.get(projectId, request).body(); - } - - /** - * Retrieves the usage for a specific project. Use Get Project Usage Breakdown for a more - * comprehensive usage summary. - */ - public UsageV1Response get( - String projectId, UsageGetRequest request, RequestOptions requestOptions) { - return this.rawClient.get(projectId, request, requestOptions).body(); - } - - public BreakdownClient breakdown() { - return this.breakdownClient.get(); - } - - public FieldsClient fields() { - return this.fieldsClient.get(); - } -} diff --git a/src/main/java/resources/manage/v1/projects/usage/breakdown/AsyncBreakdownClient.java b/src/main/java/resources/manage/v1/projects/usage/breakdown/AsyncBreakdownClient.java deleted file mode 100644 index 29b6e16..0000000 --- a/src/main/java/resources/manage/v1/projects/usage/breakdown/AsyncBreakdownClient.java +++ /dev/null @@ -1,69 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.usage.breakdown; - -import core.ClientOptions; -import core.RequestOptions; -import java.util.concurrent.CompletableFuture; -import resources.manage.v1.projects.usage.breakdown.requests.BreakdownGetRequest; -import types.UsageBreakdownV1Response; - -public class AsyncBreakdownClient { - protected final ClientOptions clientOptions; - - private final AsyncRawBreakdownClient rawClient; - - public AsyncBreakdownClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new AsyncRawBreakdownClient(clientOptions); - } - - /** Get responses with HTTP metadata like headers */ - public AsyncRawBreakdownClient withRawResponse() { - return this.rawClient; - } - - /** - * Retrieves the usage breakdown for a specific project, with various filter options by API - * feature or by groupings. Setting a feature (e.g. diarize) to true includes requests that used - * that feature, while false excludes requests that used it. Multiple true filters are combined - * with OR logic, while false filters use AND logic. - */ - public CompletableFuture get(String projectId) { - return this.rawClient.get(projectId).thenApply(response -> response.body()); - } - - /** - * Retrieves the usage breakdown for a specific project, with various filter options by API - * feature or by groupings. Setting a feature (e.g. diarize) to true includes requests that used - * that feature, while false excludes requests that used it. Multiple true filters are combined - * with OR logic, while false filters use AND logic. - */ - public CompletableFuture get( - String projectId, RequestOptions requestOptions) { - return this.rawClient.get(projectId, requestOptions).thenApply(response -> response.body()); - } - - /** - * Retrieves the usage breakdown for a specific project, with various filter options by API - * feature or by groupings. Setting a feature (e.g. diarize) to true includes requests that used - * that feature, while false excludes requests that used it. Multiple true filters are combined - * with OR logic, while false filters use AND logic. - */ - public CompletableFuture get( - String projectId, BreakdownGetRequest request) { - return this.rawClient.get(projectId, request).thenApply(response -> response.body()); - } - - /** - * Retrieves the usage breakdown for a specific project, with various filter options by API - * feature or by groupings. Setting a feature (e.g. diarize) to true includes requests that used - * that feature, while false excludes requests that used it. Multiple true filters are combined - * with OR logic, while false filters use AND logic. - */ - public CompletableFuture get( - String projectId, BreakdownGetRequest request, RequestOptions requestOptions) { - return this.rawClient - .get(projectId, request, requestOptions) - .thenApply(response -> response.body()); - } -} diff --git a/src/main/java/resources/manage/v1/projects/usage/breakdown/AsyncRawBreakdownClient.java b/src/main/java/resources/manage/v1/projects/usage/breakdown/AsyncRawBreakdownClient.java deleted file mode 100644 index d5f14bb..0000000 --- a/src/main/java/resources/manage/v1/projects/usage/breakdown/AsyncRawBreakdownClient.java +++ /dev/null @@ -1,309 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.usage.breakdown; - -import com.fasterxml.jackson.core.JsonProcessingException; -import core.ClientOptions; -import core.DeepgramApiApiException; -import core.DeepgramApiException; -import core.DeepgramApiHttpResponse; -import core.ObjectMappers; -import core.QueryStringMapper; -import core.RequestOptions; -import errors.BadRequestError; -import java.io.IOException; -import java.util.concurrent.CompletableFuture; -import okhttp3.Call; -import okhttp3.Callback; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import okhttp3.ResponseBody; -import org.jetbrains.annotations.NotNull; -import resources.manage.v1.projects.usage.breakdown.requests.BreakdownGetRequest; -import types.UsageBreakdownV1Response; - -public class AsyncRawBreakdownClient { - protected final ClientOptions clientOptions; - - public AsyncRawBreakdownClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** - * Retrieves the usage breakdown for a specific project, with various filter options by API - * feature or by groupings. Setting a feature (e.g. diarize) to true includes requests that used - * that feature, while false excludes requests that used it. Multiple true filters are combined - * with OR logic, while false filters use AND logic. - */ - public CompletableFuture> get( - String projectId) { - return get(projectId, BreakdownGetRequest.builder().build()); - } - - /** - * Retrieves the usage breakdown for a specific project, with various filter options by API - * feature or by groupings. Setting a feature (e.g. diarize) to true includes requests that used - * that feature, while false excludes requests that used it. Multiple true filters are combined - * with OR logic, while false filters use AND logic. - */ - public CompletableFuture> get( - String projectId, RequestOptions requestOptions) { - return get(projectId, BreakdownGetRequest.builder().build(), requestOptions); - } - - /** - * Retrieves the usage breakdown for a specific project, with various filter options by API - * feature or by groupings. Setting a feature (e.g. diarize) to true includes requests that used - * that feature, while false excludes requests that used it. Multiple true filters are combined - * with OR logic, while false filters use AND logic. - */ - public CompletableFuture> get( - String projectId, BreakdownGetRequest request) { - return get(projectId, request, null); - } - - /** - * Retrieves the usage breakdown for a specific project, with various filter options by API - * feature or by groupings. Setting a feature (e.g. diarize) to true includes requests that used - * that feature, while false excludes requests that used it. Multiple true filters are combined - * with OR logic, while false filters use AND logic. - */ - public CompletableFuture> get( - String projectId, BreakdownGetRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("usage") - .addPathSegments("breakdown"); - if (request.getStart().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "start", request.getStart().get(), false); - } - if (request.getEnd().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "end", request.getEnd().get(), false); - } - if (request.getGrouping().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "grouping", request.getGrouping().get(), false); - } - if (request.getAccessor().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "accessor", request.getAccessor().get(), false); - } - if (request.getAlternatives().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "alternatives", request.getAlternatives().get(), false); - } - if (request.getCallbackMethod().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "callback_method", request.getCallbackMethod().get(), false); - } - if (request.getCallback().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "callback", request.getCallback().get(), false); - } - if (request.getChannels().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "channels", request.getChannels().get(), false); - } - if (request.getCustomIntentMode().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "custom_intent_mode", request.getCustomIntentMode().get(), false); - } - if (request.getCustomIntent().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "custom_intent", request.getCustomIntent().get(), false); - } - if (request.getCustomTopicMode().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "custom_topic_mode", request.getCustomTopicMode().get(), false); - } - if (request.getCustomTopic().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "custom_topic", request.getCustomTopic().get(), false); - } - if (request.getDeployment().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "deployment", request.getDeployment().get(), false); - } - if (request.getDetectEntities().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "detect_entities", request.getDetectEntities().get(), false); - } - if (request.getDetectLanguage().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "detect_language", request.getDetectLanguage().get(), false); - } - if (request.getDiarize().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "diarize", request.getDiarize().get(), false); - } - if (request.getDictation().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "dictation", request.getDictation().get(), false); - } - if (request.getEncoding().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "encoding", request.getEncoding().get(), false); - } - if (request.getEndpoint().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "endpoint", request.getEndpoint().get(), false); - } - if (request.getExtra().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "extra", request.getExtra().get(), false); - } - if (request.getFillerWords().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "filler_words", request.getFillerWords().get(), false); - } - if (request.getIntents().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "intents", request.getIntents().get(), false); - } - if (request.getKeyterm().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "keyterm", request.getKeyterm().get(), false); - } - if (request.getKeywords().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "keywords", request.getKeywords().get(), false); - } - if (request.getLanguage().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "language", request.getLanguage().get(), false); - } - if (request.getMeasurements().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "measurements", request.getMeasurements().get(), false); - } - if (request.getMethod().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "method", request.getMethod().get(), false); - } - if (request.getModel().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "model", request.getModel().get(), false); - } - if (request.getMultichannel().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "multichannel", request.getMultichannel().get(), false); - } - if (request.getNumerals().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "numerals", request.getNumerals().get(), false); - } - if (request.getParagraphs().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "paragraphs", request.getParagraphs().get(), false); - } - if (request.getProfanityFilter().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "profanity_filter", request.getProfanityFilter().get(), false); - } - if (request.getPunctuate().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "punctuate", request.getPunctuate().get(), false); - } - if (request.getRedact().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "redact", request.getRedact().get(), false); - } - if (request.getReplace().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "replace", request.getReplace().get(), false); - } - if (request.getSampleRate().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "sample_rate", request.getSampleRate().get(), false); - } - if (request.getSearch().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "search", request.getSearch().get(), false); - } - if (request.getSentiment().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "sentiment", request.getSentiment().get(), false); - } - if (request.getSmartFormat().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "smart_format", request.getSmartFormat().get(), false); - } - if (request.getSummarize().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "summarize", request.getSummarize().get(), false); - } - if (request.getTag().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "tag", request.getTag().get(), false); - } - if (request.getTopics().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "topics", request.getTopics().get(), false); - } - if (request.getUttSplit().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "utt_split", request.getUttSplit().get(), false); - } - if (request.getUtterances().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "utterances", request.getUtterances().get(), false); - } - if (request.getVersion().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "version", request.getVersion().get(), false); - } - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request.Builder _requestBuilder = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json"); - Request okhttpRequest = _requestBuilder.build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = - new CompletableFuture<>(); - client - .newCall(okhttpRequest) - .enqueue( - new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) - throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete( - new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, UsageBreakdownV1Response.class), - response)); - return; - } - try { - if (response.code() == 400) { - future.completeExceptionally( - new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally( - new DeepgramApiApiException( - "Error with status code " + response.code(), - response.code(), - errorBody, - response)); - return; - } catch (IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - }); - return future; - } -} diff --git a/src/main/java/resources/manage/v1/projects/usage/breakdown/BreakdownClient.java b/src/main/java/resources/manage/v1/projects/usage/breakdown/BreakdownClient.java deleted file mode 100644 index 02bad11..0000000 --- a/src/main/java/resources/manage/v1/projects/usage/breakdown/BreakdownClient.java +++ /dev/null @@ -1,64 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.usage.breakdown; - -import core.ClientOptions; -import core.RequestOptions; -import resources.manage.v1.projects.usage.breakdown.requests.BreakdownGetRequest; -import types.UsageBreakdownV1Response; - -public class BreakdownClient { - protected final ClientOptions clientOptions; - - private final RawBreakdownClient rawClient; - - public BreakdownClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new RawBreakdownClient(clientOptions); - } - - /** Get responses with HTTP metadata like headers */ - public RawBreakdownClient withRawResponse() { - return this.rawClient; - } - - /** - * Retrieves the usage breakdown for a specific project, with various filter options by API - * feature or by groupings. Setting a feature (e.g. diarize) to true includes requests that used - * that feature, while false excludes requests that used it. Multiple true filters are combined - * with OR logic, while false filters use AND logic. - */ - public UsageBreakdownV1Response get(String projectId) { - return this.rawClient.get(projectId).body(); - } - - /** - * Retrieves the usage breakdown for a specific project, with various filter options by API - * feature or by groupings. Setting a feature (e.g. diarize) to true includes requests that used - * that feature, while false excludes requests that used it. Multiple true filters are combined - * with OR logic, while false filters use AND logic. - */ - public UsageBreakdownV1Response get(String projectId, RequestOptions requestOptions) { - return this.rawClient.get(projectId, requestOptions).body(); - } - - /** - * Retrieves the usage breakdown for a specific project, with various filter options by API - * feature or by groupings. Setting a feature (e.g. diarize) to true includes requests that used - * that feature, while false excludes requests that used it. Multiple true filters are combined - * with OR logic, while false filters use AND logic. - */ - public UsageBreakdownV1Response get(String projectId, BreakdownGetRequest request) { - return this.rawClient.get(projectId, request).body(); - } - - /** - * Retrieves the usage breakdown for a specific project, with various filter options by API - * feature or by groupings. Setting a feature (e.g. diarize) to true includes requests that used - * that feature, while false excludes requests that used it. Multiple true filters are combined - * with OR logic, while false filters use AND logic. - */ - public UsageBreakdownV1Response get( - String projectId, BreakdownGetRequest request, RequestOptions requestOptions) { - return this.rawClient.get(projectId, request, requestOptions).body(); - } -} diff --git a/src/main/java/resources/manage/v1/projects/usage/breakdown/RawBreakdownClient.java b/src/main/java/resources/manage/v1/projects/usage/breakdown/RawBreakdownClient.java deleted file mode 100644 index 44b75f2..0000000 --- a/src/main/java/resources/manage/v1/projects/usage/breakdown/RawBreakdownClient.java +++ /dev/null @@ -1,275 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.usage.breakdown; - -import com.fasterxml.jackson.core.JsonProcessingException; -import core.ClientOptions; -import core.DeepgramApiApiException; -import core.DeepgramApiException; -import core.DeepgramApiHttpResponse; -import core.ObjectMappers; -import core.QueryStringMapper; -import core.RequestOptions; -import errors.BadRequestError; -import java.io.IOException; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import okhttp3.ResponseBody; -import resources.manage.v1.projects.usage.breakdown.requests.BreakdownGetRequest; -import types.UsageBreakdownV1Response; - -public class RawBreakdownClient { - protected final ClientOptions clientOptions; - - public RawBreakdownClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** - * Retrieves the usage breakdown for a specific project, with various filter options by API - * feature or by groupings. Setting a feature (e.g. diarize) to true includes requests that used - * that feature, while false excludes requests that used it. Multiple true filters are combined - * with OR logic, while false filters use AND logic. - */ - public DeepgramApiHttpResponse get(String projectId) { - return get(projectId, BreakdownGetRequest.builder().build()); - } - - /** - * Retrieves the usage breakdown for a specific project, with various filter options by API - * feature or by groupings. Setting a feature (e.g. diarize) to true includes requests that used - * that feature, while false excludes requests that used it. Multiple true filters are combined - * with OR logic, while false filters use AND logic. - */ - public DeepgramApiHttpResponse get( - String projectId, RequestOptions requestOptions) { - return get(projectId, BreakdownGetRequest.builder().build(), requestOptions); - } - - /** - * Retrieves the usage breakdown for a specific project, with various filter options by API - * feature or by groupings. Setting a feature (e.g. diarize) to true includes requests that used - * that feature, while false excludes requests that used it. Multiple true filters are combined - * with OR logic, while false filters use AND logic. - */ - public DeepgramApiHttpResponse get( - String projectId, BreakdownGetRequest request) { - return get(projectId, request, null); - } - - /** - * Retrieves the usage breakdown for a specific project, with various filter options by API - * feature or by groupings. Setting a feature (e.g. diarize) to true includes requests that used - * that feature, while false excludes requests that used it. Multiple true filters are combined - * with OR logic, while false filters use AND logic. - */ - public DeepgramApiHttpResponse get( - String projectId, BreakdownGetRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("usage") - .addPathSegments("breakdown"); - if (request.getStart().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "start", request.getStart().get(), false); - } - if (request.getEnd().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "end", request.getEnd().get(), false); - } - if (request.getGrouping().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "grouping", request.getGrouping().get(), false); - } - if (request.getAccessor().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "accessor", request.getAccessor().get(), false); - } - if (request.getAlternatives().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "alternatives", request.getAlternatives().get(), false); - } - if (request.getCallbackMethod().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "callback_method", request.getCallbackMethod().get(), false); - } - if (request.getCallback().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "callback", request.getCallback().get(), false); - } - if (request.getChannels().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "channels", request.getChannels().get(), false); - } - if (request.getCustomIntentMode().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "custom_intent_mode", request.getCustomIntentMode().get(), false); - } - if (request.getCustomIntent().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "custom_intent", request.getCustomIntent().get(), false); - } - if (request.getCustomTopicMode().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "custom_topic_mode", request.getCustomTopicMode().get(), false); - } - if (request.getCustomTopic().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "custom_topic", request.getCustomTopic().get(), false); - } - if (request.getDeployment().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "deployment", request.getDeployment().get(), false); - } - if (request.getDetectEntities().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "detect_entities", request.getDetectEntities().get(), false); - } - if (request.getDetectLanguage().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "detect_language", request.getDetectLanguage().get(), false); - } - if (request.getDiarize().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "diarize", request.getDiarize().get(), false); - } - if (request.getDictation().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "dictation", request.getDictation().get(), false); - } - if (request.getEncoding().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "encoding", request.getEncoding().get(), false); - } - if (request.getEndpoint().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "endpoint", request.getEndpoint().get(), false); - } - if (request.getExtra().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "extra", request.getExtra().get(), false); - } - if (request.getFillerWords().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "filler_words", request.getFillerWords().get(), false); - } - if (request.getIntents().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "intents", request.getIntents().get(), false); - } - if (request.getKeyterm().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "keyterm", request.getKeyterm().get(), false); - } - if (request.getKeywords().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "keywords", request.getKeywords().get(), false); - } - if (request.getLanguage().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "language", request.getLanguage().get(), false); - } - if (request.getMeasurements().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "measurements", request.getMeasurements().get(), false); - } - if (request.getMethod().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "method", request.getMethod().get(), false); - } - if (request.getModel().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "model", request.getModel().get(), false); - } - if (request.getMultichannel().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "multichannel", request.getMultichannel().get(), false); - } - if (request.getNumerals().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "numerals", request.getNumerals().get(), false); - } - if (request.getParagraphs().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "paragraphs", request.getParagraphs().get(), false); - } - if (request.getProfanityFilter().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "profanity_filter", request.getProfanityFilter().get(), false); - } - if (request.getPunctuate().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "punctuate", request.getPunctuate().get(), false); - } - if (request.getRedact().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "redact", request.getRedact().get(), false); - } - if (request.getReplace().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "replace", request.getReplace().get(), false); - } - if (request.getSampleRate().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "sample_rate", request.getSampleRate().get(), false); - } - if (request.getSearch().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "search", request.getSearch().get(), false); - } - if (request.getSentiment().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "sentiment", request.getSentiment().get(), false); - } - if (request.getSmartFormat().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "smart_format", request.getSmartFormat().get(), false); - } - if (request.getSummarize().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "summarize", request.getSummarize().get(), false); - } - if (request.getTag().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "tag", request.getTag().get(), false); - } - if (request.getTopics().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "topics", request.getTopics().get(), false); - } - if (request.getUttSplit().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "utt_split", request.getUttSplit().get(), false); - } - if (request.getUtterances().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "utterances", request.getUtterances().get(), false); - } - if (request.getVersion().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "version", request.getVersion().get(), false); - } - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request.Builder _requestBuilder = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "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(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UsageBreakdownV1Response.class), - response); - } - try { - if (response.code() == 400) { - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new DeepgramApiApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (IOException e) { - throw new DeepgramApiException("Network error executing HTTP request", e); - } - } -} diff --git a/src/main/java/resources/manage/v1/projects/usage/breakdown/requests/BreakdownGetRequest.java b/src/main/java/resources/manage/v1/projects/usage/breakdown/requests/BreakdownGetRequest.java deleted file mode 100644 index ce4ac5f..0000000 --- a/src/main/java/resources/manage/v1/projects/usage/breakdown/requests/BreakdownGetRequest.java +++ /dev/null @@ -1,1435 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.usage.breakdown.requests; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import core.ObjectMappers; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import resources.manage.v1.projects.usage.breakdown.types.BreakdownGetRequestDeployment; -import resources.manage.v1.projects.usage.breakdown.types.BreakdownGetRequestEndpoint; -import resources.manage.v1.projects.usage.breakdown.types.BreakdownGetRequestGrouping; -import resources.manage.v1.projects.usage.breakdown.types.BreakdownGetRequestMethod; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = BreakdownGetRequest.Builder.class) -public final class BreakdownGetRequest { - private final Optional start; - - private final Optional end; - - private final Optional grouping; - - private final Optional accessor; - - private final Optional alternatives; - - private final Optional callbackMethod; - - private final Optional callback; - - private final Optional channels; - - private final Optional customIntentMode; - - private final Optional customIntent; - - private final Optional customTopicMode; - - private final Optional customTopic; - - private final Optional deployment; - - private final Optional detectEntities; - - private final Optional detectLanguage; - - private final Optional diarize; - - private final Optional dictation; - - private final Optional encoding; - - private final Optional endpoint; - - private final Optional extra; - - private final Optional fillerWords; - - private final Optional intents; - - private final Optional keyterm; - - private final Optional keywords; - - private final Optional language; - - private final Optional measurements; - - private final Optional method; - - private final Optional model; - - private final Optional multichannel; - - private final Optional numerals; - - private final Optional paragraphs; - - private final Optional profanityFilter; - - private final Optional punctuate; - - private final Optional redact; - - private final Optional replace; - - private final Optional sampleRate; - - private final Optional search; - - private final Optional sentiment; - - private final Optional smartFormat; - - private final Optional summarize; - - private final Optional tag; - - private final Optional topics; - - private final Optional uttSplit; - - private final Optional utterances; - - private final Optional version; - - private final Map additionalProperties; - - private BreakdownGetRequest( - Optional start, - Optional end, - Optional grouping, - Optional accessor, - Optional alternatives, - Optional callbackMethod, - Optional callback, - Optional channels, - Optional customIntentMode, - Optional customIntent, - Optional customTopicMode, - Optional customTopic, - Optional deployment, - Optional detectEntities, - Optional detectLanguage, - Optional diarize, - Optional dictation, - Optional encoding, - Optional endpoint, - Optional extra, - Optional fillerWords, - Optional intents, - Optional keyterm, - Optional keywords, - Optional language, - Optional measurements, - Optional method, - Optional model, - Optional multichannel, - Optional numerals, - Optional paragraphs, - Optional profanityFilter, - Optional punctuate, - Optional redact, - Optional replace, - Optional sampleRate, - Optional search, - Optional sentiment, - Optional smartFormat, - Optional summarize, - Optional tag, - Optional topics, - Optional uttSplit, - Optional utterances, - Optional version, - Map additionalProperties) { - this.start = start; - this.end = end; - this.grouping = grouping; - this.accessor = accessor; - this.alternatives = alternatives; - this.callbackMethod = callbackMethod; - this.callback = callback; - this.channels = channels; - this.customIntentMode = customIntentMode; - this.customIntent = customIntent; - this.customTopicMode = customTopicMode; - this.customTopic = customTopic; - this.deployment = deployment; - this.detectEntities = detectEntities; - this.detectLanguage = detectLanguage; - this.diarize = diarize; - this.dictation = dictation; - this.encoding = encoding; - this.endpoint = endpoint; - this.extra = extra; - this.fillerWords = fillerWords; - this.intents = intents; - this.keyterm = keyterm; - this.keywords = keywords; - this.language = language; - this.measurements = measurements; - this.method = method; - this.model = model; - this.multichannel = multichannel; - this.numerals = numerals; - this.paragraphs = paragraphs; - this.profanityFilter = profanityFilter; - this.punctuate = punctuate; - this.redact = redact; - this.replace = replace; - this.sampleRate = sampleRate; - this.search = search; - this.sentiment = sentiment; - this.smartFormat = smartFormat; - this.summarize = summarize; - this.tag = tag; - this.topics = topics; - this.uttSplit = uttSplit; - this.utterances = utterances; - this.version = version; - this.additionalProperties = additionalProperties; - } - - /** - * @return Start date of the requested date range. Format accepted is YYYY-MM-DD - */ - @JsonIgnore - public Optional getStart() { - return start; - } - - /** - * @return End date of the requested date range. Format accepted is YYYY-MM-DD - */ - @JsonIgnore - public Optional getEnd() { - return end; - } - - /** - * @return Common usage grouping parameters - */ - @JsonIgnore - public Optional getGrouping() { - return grouping; - } - - /** - * @return Filter for requests where a specific accessor was used - */ - @JsonIgnore - public Optional getAccessor() { - return accessor; - } - - /** - * @return Filter for requests where alternatives were used - */ - @JsonIgnore - public Optional getAlternatives() { - return alternatives; - } - - /** - * @return Filter for requests where callback method was used - */ - @JsonIgnore - public Optional getCallbackMethod() { - return callbackMethod; - } - - /** - * @return Filter for requests where callback was used - */ - @JsonIgnore - public Optional getCallback() { - return callback; - } - - /** - * @return Filter for requests where channels were used - */ - @JsonIgnore - public Optional getChannels() { - return channels; - } - - /** - * @return Filter for requests where custom intent mode was used - */ - @JsonIgnore - public Optional getCustomIntentMode() { - return customIntentMode; - } - - /** - * @return Filter for requests where custom intent was used - */ - @JsonIgnore - public Optional getCustomIntent() { - return customIntent; - } - - /** - * @return Filter for requests where custom topic mode was used - */ - @JsonIgnore - public Optional getCustomTopicMode() { - return customTopicMode; - } - - /** - * @return Filter for requests where custom topic was used - */ - @JsonIgnore - public Optional getCustomTopic() { - return customTopic; - } - - /** - * @return Filter for requests where a specific deployment was used - */ - @JsonIgnore - public Optional getDeployment() { - return deployment; - } - - /** - * @return Filter for requests where detect entities was used - */ - @JsonIgnore - public Optional getDetectEntities() { - return detectEntities; - } - - /** - * @return Filter for requests where detect language was used - */ - @JsonIgnore - public Optional getDetectLanguage() { - return detectLanguage; - } - - /** - * @return Filter for requests where diarize was used - */ - @JsonIgnore - public Optional getDiarize() { - return diarize; - } - - /** - * @return Filter for requests where dictation was used - */ - @JsonIgnore - public Optional getDictation() { - return dictation; - } - - /** - * @return Filter for requests where encoding was used - */ - @JsonIgnore - public Optional getEncoding() { - return encoding; - } - - /** - * @return Filter for requests where a specific endpoint was used - */ - @JsonIgnore - public Optional getEndpoint() { - return endpoint; - } - - /** - * @return Filter for requests where extra was used - */ - @JsonIgnore - public Optional getExtra() { - return extra; - } - - /** - * @return Filter for requests where filler words was used - */ - @JsonIgnore - public Optional getFillerWords() { - return fillerWords; - } - - /** - * @return Filter for requests where intents was used - */ - @JsonIgnore - public Optional getIntents() { - return intents; - } - - /** - * @return Filter for requests where keyterm was used - */ - @JsonIgnore - public Optional getKeyterm() { - return keyterm; - } - - /** - * @return Filter for requests where keywords was used - */ - @JsonIgnore - public Optional getKeywords() { - return keywords; - } - - /** - * @return Filter for requests where language was used - */ - @JsonIgnore - public Optional getLanguage() { - return language; - } - - /** - * @return Filter for requests where measurements were used - */ - @JsonIgnore - public Optional getMeasurements() { - return measurements; - } - - /** - * @return Filter for requests where a specific method was used - */ - @JsonIgnore - public Optional getMethod() { - return method; - } - - /** - * @return Filter for requests where a specific model uuid was used - */ - @JsonIgnore - public Optional getModel() { - return model; - } - - /** - * @return Filter for requests where multichannel was used - */ - @JsonIgnore - public Optional getMultichannel() { - return multichannel; - } - - /** - * @return Filter for requests where numerals were used - */ - @JsonIgnore - public Optional getNumerals() { - return numerals; - } - - /** - * @return Filter for requests where paragraphs were used - */ - @JsonIgnore - public Optional getParagraphs() { - return paragraphs; - } - - /** - * @return Filter for requests where profanity filter was used - */ - @JsonIgnore - public Optional getProfanityFilter() { - return profanityFilter; - } - - /** - * @return Filter for requests where punctuate was used - */ - @JsonIgnore - public Optional getPunctuate() { - return punctuate; - } - - /** - * @return Filter for requests where redact was used - */ - @JsonIgnore - public Optional getRedact() { - return redact; - } - - /** - * @return Filter for requests where replace was used - */ - @JsonIgnore - public Optional getReplace() { - return replace; - } - - /** - * @return Filter for requests where sample rate was used - */ - @JsonIgnore - public Optional getSampleRate() { - return sampleRate; - } - - /** - * @return Filter for requests where search was used - */ - @JsonIgnore - public Optional getSearch() { - return search; - } - - /** - * @return Filter for requests where sentiment was used - */ - @JsonIgnore - public Optional getSentiment() { - return sentiment; - } - - /** - * @return Filter for requests where smart format was used - */ - @JsonIgnore - public Optional getSmartFormat() { - return smartFormat; - } - - /** - * @return Filter for requests where summarize was used - */ - @JsonIgnore - public Optional getSummarize() { - return summarize; - } - - /** - * @return Filter for requests where a specific tag was used - */ - @JsonIgnore - public Optional getTag() { - return tag; - } - - /** - * @return Filter for requests where topics was used - */ - @JsonIgnore - public Optional getTopics() { - return topics; - } - - /** - * @return Filter for requests where utt split was used - */ - @JsonIgnore - public Optional getUttSplit() { - return uttSplit; - } - - /** - * @return Filter for requests where utterances was used - */ - @JsonIgnore - public Optional getUtterances() { - return utterances; - } - - /** - * @return Filter for requests where version was used - */ - @JsonIgnore - public Optional getVersion() { - return version; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof BreakdownGetRequest && equalTo((BreakdownGetRequest) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(BreakdownGetRequest other) { - return start.equals(other.start) - && end.equals(other.end) - && grouping.equals(other.grouping) - && accessor.equals(other.accessor) - && alternatives.equals(other.alternatives) - && callbackMethod.equals(other.callbackMethod) - && callback.equals(other.callback) - && channels.equals(other.channels) - && customIntentMode.equals(other.customIntentMode) - && customIntent.equals(other.customIntent) - && customTopicMode.equals(other.customTopicMode) - && customTopic.equals(other.customTopic) - && deployment.equals(other.deployment) - && detectEntities.equals(other.detectEntities) - && detectLanguage.equals(other.detectLanguage) - && diarize.equals(other.diarize) - && dictation.equals(other.dictation) - && encoding.equals(other.encoding) - && endpoint.equals(other.endpoint) - && extra.equals(other.extra) - && fillerWords.equals(other.fillerWords) - && intents.equals(other.intents) - && keyterm.equals(other.keyterm) - && keywords.equals(other.keywords) - && language.equals(other.language) - && measurements.equals(other.measurements) - && method.equals(other.method) - && model.equals(other.model) - && multichannel.equals(other.multichannel) - && numerals.equals(other.numerals) - && paragraphs.equals(other.paragraphs) - && profanityFilter.equals(other.profanityFilter) - && punctuate.equals(other.punctuate) - && redact.equals(other.redact) - && replace.equals(other.replace) - && sampleRate.equals(other.sampleRate) - && search.equals(other.search) - && sentiment.equals(other.sentiment) - && smartFormat.equals(other.smartFormat) - && summarize.equals(other.summarize) - && tag.equals(other.tag) - && topics.equals(other.topics) - && uttSplit.equals(other.uttSplit) - && utterances.equals(other.utterances) - && version.equals(other.version); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.start, - this.end, - this.grouping, - this.accessor, - this.alternatives, - this.callbackMethod, - this.callback, - this.channels, - this.customIntentMode, - this.customIntent, - this.customTopicMode, - this.customTopic, - this.deployment, - this.detectEntities, - this.detectLanguage, - this.diarize, - this.dictation, - this.encoding, - this.endpoint, - this.extra, - this.fillerWords, - this.intents, - this.keyterm, - this.keywords, - this.language, - this.measurements, - this.method, - this.model, - this.multichannel, - this.numerals, - this.paragraphs, - this.profanityFilter, - this.punctuate, - this.redact, - this.replace, - this.sampleRate, - this.search, - this.sentiment, - this.smartFormat, - this.summarize, - this.tag, - this.topics, - this.uttSplit, - this.utterances, - this.version); - } - - @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 start = Optional.empty(); - - private Optional end = Optional.empty(); - - private Optional grouping = Optional.empty(); - - private Optional accessor = Optional.empty(); - - private Optional alternatives = Optional.empty(); - - private Optional callbackMethod = Optional.empty(); - - private Optional callback = Optional.empty(); - - private Optional channels = Optional.empty(); - - private Optional customIntentMode = Optional.empty(); - - private Optional customIntent = Optional.empty(); - - private Optional customTopicMode = Optional.empty(); - - private Optional customTopic = Optional.empty(); - - private Optional deployment = Optional.empty(); - - private Optional detectEntities = Optional.empty(); - - private Optional detectLanguage = Optional.empty(); - - private Optional diarize = Optional.empty(); - - private Optional dictation = Optional.empty(); - - private Optional encoding = Optional.empty(); - - private Optional endpoint = Optional.empty(); - - private Optional extra = Optional.empty(); - - private Optional fillerWords = Optional.empty(); - - private Optional intents = Optional.empty(); - - private Optional keyterm = Optional.empty(); - - private Optional keywords = Optional.empty(); - - private Optional language = Optional.empty(); - - private Optional measurements = Optional.empty(); - - private Optional method = Optional.empty(); - - private Optional model = Optional.empty(); - - private Optional multichannel = Optional.empty(); - - private Optional numerals = Optional.empty(); - - private Optional paragraphs = Optional.empty(); - - private Optional profanityFilter = Optional.empty(); - - private Optional punctuate = Optional.empty(); - - private Optional redact = Optional.empty(); - - private Optional replace = Optional.empty(); - - private Optional sampleRate = Optional.empty(); - - private Optional search = Optional.empty(); - - private Optional sentiment = Optional.empty(); - - private Optional smartFormat = Optional.empty(); - - private Optional summarize = Optional.empty(); - - private Optional tag = Optional.empty(); - - private Optional topics = Optional.empty(); - - private Optional uttSplit = Optional.empty(); - - private Optional utterances = Optional.empty(); - - private Optional version = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(BreakdownGetRequest other) { - start(other.getStart()); - end(other.getEnd()); - grouping(other.getGrouping()); - accessor(other.getAccessor()); - alternatives(other.getAlternatives()); - callbackMethod(other.getCallbackMethod()); - callback(other.getCallback()); - channels(other.getChannels()); - customIntentMode(other.getCustomIntentMode()); - customIntent(other.getCustomIntent()); - customTopicMode(other.getCustomTopicMode()); - customTopic(other.getCustomTopic()); - deployment(other.getDeployment()); - detectEntities(other.getDetectEntities()); - detectLanguage(other.getDetectLanguage()); - diarize(other.getDiarize()); - dictation(other.getDictation()); - encoding(other.getEncoding()); - endpoint(other.getEndpoint()); - extra(other.getExtra()); - fillerWords(other.getFillerWords()); - intents(other.getIntents()); - keyterm(other.getKeyterm()); - keywords(other.getKeywords()); - language(other.getLanguage()); - measurements(other.getMeasurements()); - method(other.getMethod()); - model(other.getModel()); - multichannel(other.getMultichannel()); - numerals(other.getNumerals()); - paragraphs(other.getParagraphs()); - profanityFilter(other.getProfanityFilter()); - punctuate(other.getPunctuate()); - redact(other.getRedact()); - replace(other.getReplace()); - sampleRate(other.getSampleRate()); - search(other.getSearch()); - sentiment(other.getSentiment()); - smartFormat(other.getSmartFormat()); - summarize(other.getSummarize()); - tag(other.getTag()); - topics(other.getTopics()); - uttSplit(other.getUttSplit()); - utterances(other.getUtterances()); - version(other.getVersion()); - return this; - } - - /** Start date of the requested date range. Format accepted is YYYY-MM-DD */ - @JsonSetter(value = "start", nulls = Nulls.SKIP) - public Builder start(Optional start) { - this.start = start; - return this; - } - - public Builder start(String start) { - this.start = Optional.ofNullable(start); - return this; - } - - /** End date of the requested date range. Format accepted is YYYY-MM-DD */ - @JsonSetter(value = "end", nulls = Nulls.SKIP) - public Builder end(Optional end) { - this.end = end; - return this; - } - - public Builder end(String end) { - this.end = Optional.ofNullable(end); - return this; - } - - /** Common usage grouping parameters */ - @JsonSetter(value = "grouping", nulls = Nulls.SKIP) - public Builder grouping(Optional grouping) { - this.grouping = grouping; - return this; - } - - public Builder grouping(BreakdownGetRequestGrouping grouping) { - this.grouping = Optional.ofNullable(grouping); - return this; - } - - /** Filter for requests where a specific accessor was used */ - @JsonSetter(value = "accessor", nulls = Nulls.SKIP) - public Builder accessor(Optional accessor) { - this.accessor = accessor; - return this; - } - - public Builder accessor(String accessor) { - this.accessor = Optional.ofNullable(accessor); - return this; - } - - /** Filter for requests where alternatives were used */ - @JsonSetter(value = "alternatives", nulls = Nulls.SKIP) - public Builder alternatives(Optional alternatives) { - this.alternatives = alternatives; - return this; - } - - public Builder alternatives(Boolean alternatives) { - this.alternatives = Optional.ofNullable(alternatives); - return this; - } - - /** Filter for requests where callback method was used */ - @JsonSetter(value = "callback_method", nulls = Nulls.SKIP) - public Builder callbackMethod(Optional callbackMethod) { - this.callbackMethod = callbackMethod; - return this; - } - - public Builder callbackMethod(Boolean callbackMethod) { - this.callbackMethod = Optional.ofNullable(callbackMethod); - return this; - } - - /** Filter for requests where callback was used */ - @JsonSetter(value = "callback", nulls = Nulls.SKIP) - public Builder callback(Optional callback) { - this.callback = callback; - return this; - } - - public Builder callback(Boolean callback) { - this.callback = Optional.ofNullable(callback); - return this; - } - - /** Filter for requests where channels were used */ - @JsonSetter(value = "channels", nulls = Nulls.SKIP) - public Builder channels(Optional channels) { - this.channels = channels; - return this; - } - - public Builder channels(Boolean channels) { - this.channels = Optional.ofNullable(channels); - return this; - } - - /** Filter for requests where custom intent mode was used */ - @JsonSetter(value = "custom_intent_mode", nulls = Nulls.SKIP) - public Builder customIntentMode(Optional customIntentMode) { - this.customIntentMode = customIntentMode; - return this; - } - - public Builder customIntentMode(Boolean customIntentMode) { - this.customIntentMode = Optional.ofNullable(customIntentMode); - return this; - } - - /** Filter for requests where custom intent was used */ - @JsonSetter(value = "custom_intent", nulls = Nulls.SKIP) - public Builder customIntent(Optional customIntent) { - this.customIntent = customIntent; - return this; - } - - public Builder customIntent(Boolean customIntent) { - this.customIntent = Optional.ofNullable(customIntent); - return this; - } - - /** Filter for requests where custom topic mode was used */ - @JsonSetter(value = "custom_topic_mode", nulls = Nulls.SKIP) - public Builder customTopicMode(Optional customTopicMode) { - this.customTopicMode = customTopicMode; - return this; - } - - public Builder customTopicMode(Boolean customTopicMode) { - this.customTopicMode = Optional.ofNullable(customTopicMode); - return this; - } - - /** Filter for requests where custom topic was used */ - @JsonSetter(value = "custom_topic", nulls = Nulls.SKIP) - public Builder customTopic(Optional customTopic) { - this.customTopic = customTopic; - return this; - } - - public Builder customTopic(Boolean customTopic) { - this.customTopic = Optional.ofNullable(customTopic); - return this; - } - - /** Filter for requests where a specific deployment was used */ - @JsonSetter(value = "deployment", nulls = Nulls.SKIP) - public Builder deployment(Optional deployment) { - this.deployment = deployment; - return this; - } - - public Builder deployment(BreakdownGetRequestDeployment deployment) { - this.deployment = Optional.ofNullable(deployment); - return this; - } - - /** Filter for requests where detect entities was used */ - @JsonSetter(value = "detect_entities", nulls = Nulls.SKIP) - public Builder detectEntities(Optional detectEntities) { - this.detectEntities = detectEntities; - return this; - } - - public Builder detectEntities(Boolean detectEntities) { - this.detectEntities = Optional.ofNullable(detectEntities); - return this; - } - - /** Filter for requests where detect language was used */ - @JsonSetter(value = "detect_language", nulls = Nulls.SKIP) - public Builder detectLanguage(Optional detectLanguage) { - this.detectLanguage = detectLanguage; - return this; - } - - public Builder detectLanguage(Boolean detectLanguage) { - this.detectLanguage = Optional.ofNullable(detectLanguage); - return this; - } - - /** Filter for requests where diarize was used */ - @JsonSetter(value = "diarize", nulls = Nulls.SKIP) - public Builder diarize(Optional diarize) { - this.diarize = diarize; - return this; - } - - public Builder diarize(Boolean diarize) { - this.diarize = Optional.ofNullable(diarize); - return this; - } - - /** Filter for requests where dictation was used */ - @JsonSetter(value = "dictation", nulls = Nulls.SKIP) - public Builder dictation(Optional dictation) { - this.dictation = dictation; - return this; - } - - public Builder dictation(Boolean dictation) { - this.dictation = Optional.ofNullable(dictation); - return this; - } - - /** Filter for requests where encoding was used */ - @JsonSetter(value = "encoding", nulls = Nulls.SKIP) - public Builder encoding(Optional encoding) { - this.encoding = encoding; - return this; - } - - public Builder encoding(Boolean encoding) { - this.encoding = Optional.ofNullable(encoding); - return this; - } - - /** Filter for requests where a specific endpoint was used */ - @JsonSetter(value = "endpoint", nulls = Nulls.SKIP) - public Builder endpoint(Optional endpoint) { - this.endpoint = endpoint; - return this; - } - - public Builder endpoint(BreakdownGetRequestEndpoint endpoint) { - this.endpoint = Optional.ofNullable(endpoint); - return this; - } - - /** Filter for requests where extra was used */ - @JsonSetter(value = "extra", nulls = Nulls.SKIP) - public Builder extra(Optional extra) { - this.extra = extra; - return this; - } - - public Builder extra(Boolean extra) { - this.extra = Optional.ofNullable(extra); - return this; - } - - /** Filter for requests where filler words was used */ - @JsonSetter(value = "filler_words", nulls = Nulls.SKIP) - public Builder fillerWords(Optional fillerWords) { - this.fillerWords = fillerWords; - return this; - } - - public Builder fillerWords(Boolean fillerWords) { - this.fillerWords = Optional.ofNullable(fillerWords); - return this; - } - - /** Filter for requests where intents was used */ - @JsonSetter(value = "intents", nulls = Nulls.SKIP) - public Builder intents(Optional intents) { - this.intents = intents; - return this; - } - - public Builder intents(Boolean intents) { - this.intents = Optional.ofNullable(intents); - return this; - } - - /** Filter for requests where keyterm was used */ - @JsonSetter(value = "keyterm", nulls = Nulls.SKIP) - public Builder keyterm(Optional keyterm) { - this.keyterm = keyterm; - return this; - } - - public Builder keyterm(Boolean keyterm) { - this.keyterm = Optional.ofNullable(keyterm); - return this; - } - - /** Filter for requests where keywords was used */ - @JsonSetter(value = "keywords", nulls = Nulls.SKIP) - public Builder keywords(Optional keywords) { - this.keywords = keywords; - return this; - } - - public Builder keywords(Boolean keywords) { - this.keywords = Optional.ofNullable(keywords); - return this; - } - - /** Filter for requests where language was used */ - @JsonSetter(value = "language", nulls = Nulls.SKIP) - public Builder language(Optional language) { - this.language = language; - return this; - } - - public Builder language(Boolean language) { - this.language = Optional.ofNullable(language); - return this; - } - - /** Filter for requests where measurements were used */ - @JsonSetter(value = "measurements", nulls = Nulls.SKIP) - public Builder measurements(Optional measurements) { - this.measurements = measurements; - return this; - } - - public Builder measurements(Boolean measurements) { - this.measurements = Optional.ofNullable(measurements); - return this; - } - - /** Filter for requests where a specific method was used */ - @JsonSetter(value = "method", nulls = Nulls.SKIP) - public Builder method(Optional method) { - this.method = method; - return this; - } - - public Builder method(BreakdownGetRequestMethod method) { - this.method = Optional.ofNullable(method); - return this; - } - - /** Filter for requests where a specific model uuid was used */ - @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; - } - - /** Filter for requests where multichannel was used */ - @JsonSetter(value = "multichannel", nulls = Nulls.SKIP) - public Builder multichannel(Optional multichannel) { - this.multichannel = multichannel; - return this; - } - - public Builder multichannel(Boolean multichannel) { - this.multichannel = Optional.ofNullable(multichannel); - return this; - } - - /** Filter for requests where numerals were used */ - @JsonSetter(value = "numerals", nulls = Nulls.SKIP) - public Builder numerals(Optional numerals) { - this.numerals = numerals; - return this; - } - - public Builder numerals(Boolean numerals) { - this.numerals = Optional.ofNullable(numerals); - return this; - } - - /** Filter for requests where paragraphs were used */ - @JsonSetter(value = "paragraphs", nulls = Nulls.SKIP) - public Builder paragraphs(Optional paragraphs) { - this.paragraphs = paragraphs; - return this; - } - - public Builder paragraphs(Boolean paragraphs) { - this.paragraphs = Optional.ofNullable(paragraphs); - return this; - } - - /** Filter for requests where profanity filter was used */ - @JsonSetter(value = "profanity_filter", nulls = Nulls.SKIP) - public Builder profanityFilter(Optional profanityFilter) { - this.profanityFilter = profanityFilter; - return this; - } - - public Builder profanityFilter(Boolean profanityFilter) { - this.profanityFilter = Optional.ofNullable(profanityFilter); - return this; - } - - /** Filter for requests where punctuate was used */ - @JsonSetter(value = "punctuate", nulls = Nulls.SKIP) - public Builder punctuate(Optional punctuate) { - this.punctuate = punctuate; - return this; - } - - public Builder punctuate(Boolean punctuate) { - this.punctuate = Optional.ofNullable(punctuate); - return this; - } - - /** Filter for requests where redact was used */ - @JsonSetter(value = "redact", nulls = Nulls.SKIP) - public Builder redact(Optional redact) { - this.redact = redact; - return this; - } - - public Builder redact(Boolean redact) { - this.redact = Optional.ofNullable(redact); - return this; - } - - /** Filter for requests where replace was used */ - @JsonSetter(value = "replace", nulls = Nulls.SKIP) - public Builder replace(Optional replace) { - this.replace = replace; - return this; - } - - public Builder replace(Boolean replace) { - this.replace = Optional.ofNullable(replace); - return this; - } - - /** Filter for requests where sample rate was used */ - @JsonSetter(value = "sample_rate", nulls = Nulls.SKIP) - public Builder sampleRate(Optional sampleRate) { - this.sampleRate = sampleRate; - return this; - } - - public Builder sampleRate(Boolean sampleRate) { - this.sampleRate = Optional.ofNullable(sampleRate); - return this; - } - - /** Filter for requests where search was used */ - @JsonSetter(value = "search", nulls = Nulls.SKIP) - public Builder search(Optional search) { - this.search = search; - return this; - } - - public Builder search(Boolean search) { - this.search = Optional.ofNullable(search); - return this; - } - - /** Filter for requests where sentiment was used */ - @JsonSetter(value = "sentiment", nulls = Nulls.SKIP) - public Builder sentiment(Optional sentiment) { - this.sentiment = sentiment; - return this; - } - - public Builder sentiment(Boolean sentiment) { - this.sentiment = Optional.ofNullable(sentiment); - return this; - } - - /** Filter for requests where smart format was used */ - @JsonSetter(value = "smart_format", 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; - } - - /** Filter for requests where summarize was used */ - @JsonSetter(value = "summarize", nulls = Nulls.SKIP) - public Builder summarize(Optional summarize) { - this.summarize = summarize; - return this; - } - - public Builder summarize(Boolean summarize) { - this.summarize = Optional.ofNullable(summarize); - return this; - } - - /** Filter for requests where a specific tag was used */ - @JsonSetter(value = "tag", nulls = Nulls.SKIP) - public Builder tag(Optional tag) { - this.tag = tag; - return this; - } - - public Builder tag(String tag) { - this.tag = Optional.ofNullable(tag); - return this; - } - - /** Filter for requests where topics was used */ - @JsonSetter(value = "topics", nulls = Nulls.SKIP) - public Builder topics(Optional topics) { - this.topics = topics; - return this; - } - - public Builder topics(Boolean topics) { - this.topics = Optional.ofNullable(topics); - return this; - } - - /** Filter for requests where utt split was used */ - @JsonSetter(value = "utt_split", nulls = Nulls.SKIP) - public Builder uttSplit(Optional uttSplit) { - this.uttSplit = uttSplit; - return this; - } - - public Builder uttSplit(Boolean uttSplit) { - this.uttSplit = Optional.ofNullable(uttSplit); - return this; - } - - /** Filter for requests where utterances was used */ - @JsonSetter(value = "utterances", nulls = Nulls.SKIP) - public Builder utterances(Optional utterances) { - this.utterances = utterances; - return this; - } - - public Builder utterances(Boolean utterances) { - this.utterances = Optional.ofNullable(utterances); - return this; - } - - /** Filter for requests where version was used */ - @JsonSetter(value = "version", nulls = Nulls.SKIP) - public Builder version(Optional version) { - this.version = version; - return this; - } - - public Builder version(Boolean version) { - this.version = Optional.ofNullable(version); - return this; - } - - public BreakdownGetRequest build() { - return new BreakdownGetRequest( - start, - end, - grouping, - accessor, - alternatives, - callbackMethod, - callback, - channels, - customIntentMode, - customIntent, - customTopicMode, - customTopic, - deployment, - detectEntities, - detectLanguage, - diarize, - dictation, - encoding, - endpoint, - extra, - fillerWords, - intents, - keyterm, - keywords, - language, - measurements, - method, - model, - multichannel, - numerals, - paragraphs, - profanityFilter, - punctuate, - redact, - replace, - sampleRate, - search, - sentiment, - smartFormat, - summarize, - tag, - topics, - uttSplit, - utterances, - version, - additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/manage/v1/projects/usage/breakdown/types/BreakdownGetRequestDeployment.java b/src/main/java/resources/manage/v1/projects/usage/breakdown/types/BreakdownGetRequestDeployment.java deleted file mode 100644 index 26cf552..0000000 --- a/src/main/java/resources/manage/v1/projects/usage/breakdown/types/BreakdownGetRequestDeployment.java +++ /dev/null @@ -1,95 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.usage.breakdown.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class BreakdownGetRequestDeployment { - public static final BreakdownGetRequestDeployment SELF_HOSTED = - new BreakdownGetRequestDeployment(Value.SELF_HOSTED, "self-hosted"); - - public static final BreakdownGetRequestDeployment BETA = - new BreakdownGetRequestDeployment(Value.BETA, "beta"); - - public static final BreakdownGetRequestDeployment HOSTED = - new BreakdownGetRequestDeployment(Value.HOSTED, "hosted"); - - private final Value value; - - private final String string; - - BreakdownGetRequestDeployment(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof BreakdownGetRequestDeployment - && this.string.equals(((BreakdownGetRequestDeployment) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case SELF_HOSTED: - return visitor.visitSelfHosted(); - case BETA: - return visitor.visitBeta(); - case HOSTED: - return visitor.visitHosted(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static BreakdownGetRequestDeployment valueOf(String value) { - switch (value) { - case "self-hosted": - return SELF_HOSTED; - case "beta": - return BETA; - case "hosted": - return HOSTED; - default: - return new BreakdownGetRequestDeployment(Value.UNKNOWN, value); - } - } - - public enum Value { - HOSTED, - - BETA, - - SELF_HOSTED, - - UNKNOWN - } - - public interface Visitor { - T visitHosted(); - - T visitBeta(); - - T visitSelfHosted(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/resources/manage/v1/projects/usage/breakdown/types/BreakdownGetRequestEndpoint.java b/src/main/java/resources/manage/v1/projects/usage/breakdown/types/BreakdownGetRequestEndpoint.java deleted file mode 100644 index e99c22d..0000000 --- a/src/main/java/resources/manage/v1/projects/usage/breakdown/types/BreakdownGetRequestEndpoint.java +++ /dev/null @@ -1,106 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.usage.breakdown.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class BreakdownGetRequestEndpoint { - public static final BreakdownGetRequestEndpoint AGENT = - new BreakdownGetRequestEndpoint(Value.AGENT, "agent"); - - public static final BreakdownGetRequestEndpoint READ = - new BreakdownGetRequestEndpoint(Value.READ, "read"); - - public static final BreakdownGetRequestEndpoint LISTEN = - new BreakdownGetRequestEndpoint(Value.LISTEN, "listen"); - - public static final BreakdownGetRequestEndpoint SPEAK = - new BreakdownGetRequestEndpoint(Value.SPEAK, "speak"); - - private final Value value; - - private final String string; - - BreakdownGetRequestEndpoint(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof BreakdownGetRequestEndpoint - && this.string.equals(((BreakdownGetRequestEndpoint) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case AGENT: - return visitor.visitAgent(); - case READ: - return visitor.visitRead(); - case LISTEN: - return visitor.visitListen(); - case SPEAK: - return visitor.visitSpeak(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static BreakdownGetRequestEndpoint valueOf(String value) { - switch (value) { - case "agent": - return AGENT; - case "read": - return READ; - case "listen": - return LISTEN; - case "speak": - return SPEAK; - default: - return new BreakdownGetRequestEndpoint(Value.UNKNOWN, value); - } - } - - public enum Value { - LISTEN, - - READ, - - SPEAK, - - AGENT, - - UNKNOWN - } - - public interface Visitor { - T visitListen(); - - T visitRead(); - - T visitSpeak(); - - T visitAgent(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/resources/manage/v1/projects/usage/breakdown/types/BreakdownGetRequestGrouping.java b/src/main/java/resources/manage/v1/projects/usage/breakdown/types/BreakdownGetRequestGrouping.java deleted file mode 100644 index ee9839a..0000000 --- a/src/main/java/resources/manage/v1/projects/usage/breakdown/types/BreakdownGetRequestGrouping.java +++ /dev/null @@ -1,139 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.usage.breakdown.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class BreakdownGetRequestGrouping { - public static final BreakdownGetRequestGrouping METHOD = - new BreakdownGetRequestGrouping(Value.METHOD, "method"); - - public static final BreakdownGetRequestGrouping MODELS = - new BreakdownGetRequestGrouping(Value.MODELS, "models"); - - public static final BreakdownGetRequestGrouping ENDPOINT = - new BreakdownGetRequestGrouping(Value.ENDPOINT, "endpoint"); - - public static final BreakdownGetRequestGrouping TAGS = - new BreakdownGetRequestGrouping(Value.TAGS, "tags"); - - public static final BreakdownGetRequestGrouping ACCESSOR = - new BreakdownGetRequestGrouping(Value.ACCESSOR, "accessor"); - - public static final BreakdownGetRequestGrouping FEATURE_SET = - new BreakdownGetRequestGrouping(Value.FEATURE_SET, "feature_set"); - - public static final BreakdownGetRequestGrouping DEPLOYMENT = - new BreakdownGetRequestGrouping(Value.DEPLOYMENT, "deployment"); - - private final Value value; - - private final String string; - - BreakdownGetRequestGrouping(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof BreakdownGetRequestGrouping - && this.string.equals(((BreakdownGetRequestGrouping) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case METHOD: - return visitor.visitMethod(); - case MODELS: - return visitor.visitModels(); - case ENDPOINT: - return visitor.visitEndpoint(); - case TAGS: - return visitor.visitTags(); - case ACCESSOR: - return visitor.visitAccessor(); - case FEATURE_SET: - return visitor.visitFeatureSet(); - case DEPLOYMENT: - return visitor.visitDeployment(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static BreakdownGetRequestGrouping valueOf(String value) { - switch (value) { - case "method": - return METHOD; - case "models": - return MODELS; - case "endpoint": - return ENDPOINT; - case "tags": - return TAGS; - case "accessor": - return ACCESSOR; - case "feature_set": - return FEATURE_SET; - case "deployment": - return DEPLOYMENT; - default: - return new BreakdownGetRequestGrouping(Value.UNKNOWN, value); - } - } - - public enum Value { - ACCESSOR, - - ENDPOINT, - - FEATURE_SET, - - MODELS, - - METHOD, - - TAGS, - - DEPLOYMENT, - - UNKNOWN - } - - public interface Visitor { - T visitAccessor(); - - T visitEndpoint(); - - T visitFeatureSet(); - - T visitModels(); - - T visitMethod(); - - T visitTags(); - - T visitDeployment(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/resources/manage/v1/projects/usage/breakdown/types/BreakdownGetRequestMethod.java b/src/main/java/resources/manage/v1/projects/usage/breakdown/types/BreakdownGetRequestMethod.java deleted file mode 100644 index 6caad44..0000000 --- a/src/main/java/resources/manage/v1/projects/usage/breakdown/types/BreakdownGetRequestMethod.java +++ /dev/null @@ -1,95 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.usage.breakdown.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class BreakdownGetRequestMethod { - public static final BreakdownGetRequestMethod SYNC = - new BreakdownGetRequestMethod(Value.SYNC, "sync"); - - public static final BreakdownGetRequestMethod STREAMING = - new BreakdownGetRequestMethod(Value.STREAMING, "streaming"); - - public static final BreakdownGetRequestMethod ASYNC = - new BreakdownGetRequestMethod(Value.ASYNC, "async"); - - private final Value value; - - private final String string; - - BreakdownGetRequestMethod(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof BreakdownGetRequestMethod - && this.string.equals(((BreakdownGetRequestMethod) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case SYNC: - return visitor.visitSync(); - case STREAMING: - return visitor.visitStreaming(); - case ASYNC: - return visitor.visitAsync(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static BreakdownGetRequestMethod valueOf(String value) { - switch (value) { - case "sync": - return SYNC; - case "streaming": - return STREAMING; - case "async": - return ASYNC; - default: - return new BreakdownGetRequestMethod(Value.UNKNOWN, value); - } - } - - public enum Value { - SYNC, - - ASYNC, - - STREAMING, - - UNKNOWN - } - - public interface Visitor { - T visitSync(); - - T visitAsync(); - - T visitStreaming(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/resources/manage/v1/projects/usage/fields/AsyncFieldsClient.java b/src/main/java/resources/manage/v1/projects/usage/fields/AsyncFieldsClient.java deleted file mode 100644 index 8ee46a3..0000000 --- a/src/main/java/resources/manage/v1/projects/usage/fields/AsyncFieldsClient.java +++ /dev/null @@ -1,61 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.usage.fields; - -import core.ClientOptions; -import core.RequestOptions; -import java.util.concurrent.CompletableFuture; -import resources.manage.v1.projects.usage.fields.requests.FieldsListRequest; -import types.UsageFieldsV1Response; - -public class AsyncFieldsClient { - protected final ClientOptions clientOptions; - - private final AsyncRawFieldsClient rawClient; - - public AsyncFieldsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new AsyncRawFieldsClient(clientOptions); - } - - /** Get responses with HTTP metadata like headers */ - public AsyncRawFieldsClient withRawResponse() { - return this.rawClient; - } - - /** - * Lists the features, models, tags, languages, and processing method used for requests in the - * specified project - */ - public CompletableFuture list(String projectId) { - return this.rawClient.list(projectId).thenApply(response -> response.body()); - } - - /** - * Lists the features, models, tags, languages, and processing method used for requests in the - * specified project - */ - public CompletableFuture list( - String projectId, RequestOptions requestOptions) { - return this.rawClient.list(projectId, requestOptions).thenApply(response -> response.body()); - } - - /** - * Lists the features, models, tags, languages, and processing method used for requests in the - * specified project - */ - public CompletableFuture list( - String projectId, FieldsListRequest request) { - return this.rawClient.list(projectId, request).thenApply(response -> response.body()); - } - - /** - * Lists the features, models, tags, languages, and processing method used for requests in the - * specified project - */ - public CompletableFuture list( - String projectId, FieldsListRequest request, RequestOptions requestOptions) { - return this.rawClient - .list(projectId, request, requestOptions) - .thenApply(response -> response.body()); - } -} diff --git a/src/main/java/resources/manage/v1/projects/usage/fields/AsyncRawFieldsClient.java b/src/main/java/resources/manage/v1/projects/usage/fields/AsyncRawFieldsClient.java deleted file mode 100644 index 82bed76..0000000 --- a/src/main/java/resources/manage/v1/projects/usage/fields/AsyncRawFieldsClient.java +++ /dev/null @@ -1,150 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.usage.fields; - -import com.fasterxml.jackson.core.JsonProcessingException; -import core.ClientOptions; -import core.DeepgramApiApiException; -import core.DeepgramApiException; -import core.DeepgramApiHttpResponse; -import core.ObjectMappers; -import core.QueryStringMapper; -import core.RequestOptions; -import errors.BadRequestError; -import java.io.IOException; -import java.util.concurrent.CompletableFuture; -import okhttp3.Call; -import okhttp3.Callback; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import okhttp3.ResponseBody; -import org.jetbrains.annotations.NotNull; -import resources.manage.v1.projects.usage.fields.requests.FieldsListRequest; -import types.UsageFieldsV1Response; - -public class AsyncRawFieldsClient { - protected final ClientOptions clientOptions; - - public AsyncRawFieldsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** - * Lists the features, models, tags, languages, and processing method used for requests in the - * specified project - */ - public CompletableFuture> list(String projectId) { - return list(projectId, FieldsListRequest.builder().build()); - } - - /** - * Lists the features, models, tags, languages, and processing method used for requests in the - * specified project - */ - public CompletableFuture> list( - String projectId, RequestOptions requestOptions) { - return list(projectId, FieldsListRequest.builder().build(), requestOptions); - } - - /** - * Lists the features, models, tags, languages, and processing method used for requests in the - * specified project - */ - public CompletableFuture> list( - String projectId, FieldsListRequest request) { - return list(projectId, request, null); - } - - /** - * Lists the features, models, tags, languages, and processing method used for requests in the - * specified project - */ - public CompletableFuture> list( - String projectId, FieldsListRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("usage") - .addPathSegments("fields"); - if (request.getStart().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "start", request.getStart().get(), false); - } - if (request.getEnd().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "end", request.getEnd().get(), false); - } - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request.Builder _requestBuilder = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json"); - Request okhttpRequest = _requestBuilder.build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = - new CompletableFuture<>(); - client - .newCall(okhttpRequest) - .enqueue( - new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) - throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete( - new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, UsageFieldsV1Response.class), - response)); - return; - } - try { - if (response.code() == 400) { - future.completeExceptionally( - new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally( - new DeepgramApiApiException( - "Error with status code " + response.code(), - response.code(), - errorBody, - response)); - return; - } catch (IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - }); - return future; - } -} diff --git a/src/main/java/resources/manage/v1/projects/usage/fields/FieldsClient.java b/src/main/java/resources/manage/v1/projects/usage/fields/FieldsClient.java deleted file mode 100644 index 9e73878..0000000 --- a/src/main/java/resources/manage/v1/projects/usage/fields/FieldsClient.java +++ /dev/null @@ -1,56 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.usage.fields; - -import core.ClientOptions; -import core.RequestOptions; -import resources.manage.v1.projects.usage.fields.requests.FieldsListRequest; -import types.UsageFieldsV1Response; - -public class FieldsClient { - protected final ClientOptions clientOptions; - - private final RawFieldsClient rawClient; - - public FieldsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new RawFieldsClient(clientOptions); - } - - /** Get responses with HTTP metadata like headers */ - public RawFieldsClient withRawResponse() { - return this.rawClient; - } - - /** - * Lists the features, models, tags, languages, and processing method used for requests in the - * specified project - */ - public UsageFieldsV1Response list(String projectId) { - return this.rawClient.list(projectId).body(); - } - - /** - * Lists the features, models, tags, languages, and processing method used for requests in the - * specified project - */ - public UsageFieldsV1Response list(String projectId, RequestOptions requestOptions) { - return this.rawClient.list(projectId, requestOptions).body(); - } - - /** - * Lists the features, models, tags, languages, and processing method used for requests in the - * specified project - */ - public UsageFieldsV1Response list(String projectId, FieldsListRequest request) { - return this.rawClient.list(projectId, request).body(); - } - - /** - * Lists the features, models, tags, languages, and processing method used for requests in the - * specified project - */ - public UsageFieldsV1Response list( - String projectId, FieldsListRequest request, RequestOptions requestOptions) { - return this.rawClient.list(projectId, request, requestOptions).body(); - } -} diff --git a/src/main/java/resources/manage/v1/projects/usage/fields/RawFieldsClient.java b/src/main/java/resources/manage/v1/projects/usage/fields/RawFieldsClient.java deleted file mode 100644 index 623095d..0000000 --- a/src/main/java/resources/manage/v1/projects/usage/fields/RawFieldsClient.java +++ /dev/null @@ -1,117 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.usage.fields; - -import com.fasterxml.jackson.core.JsonProcessingException; -import core.ClientOptions; -import core.DeepgramApiApiException; -import core.DeepgramApiException; -import core.DeepgramApiHttpResponse; -import core.ObjectMappers; -import core.QueryStringMapper; -import core.RequestOptions; -import errors.BadRequestError; -import java.io.IOException; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import okhttp3.ResponseBody; -import resources.manage.v1.projects.usage.fields.requests.FieldsListRequest; -import types.UsageFieldsV1Response; - -public class RawFieldsClient { - protected final ClientOptions clientOptions; - - public RawFieldsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** - * Lists the features, models, tags, languages, and processing method used for requests in the - * specified project - */ - public DeepgramApiHttpResponse list(String projectId) { - return list(projectId, FieldsListRequest.builder().build()); - } - - /** - * Lists the features, models, tags, languages, and processing method used for requests in the - * specified project - */ - public DeepgramApiHttpResponse list( - String projectId, RequestOptions requestOptions) { - return list(projectId, FieldsListRequest.builder().build(), requestOptions); - } - - /** - * Lists the features, models, tags, languages, and processing method used for requests in the - * specified project - */ - public DeepgramApiHttpResponse list( - String projectId, FieldsListRequest request) { - return list(projectId, request, null); - } - - /** - * Lists the features, models, tags, languages, and processing method used for requests in the - * specified project - */ - public DeepgramApiHttpResponse list( - String projectId, FieldsListRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("usage") - .addPathSegments("fields"); - if (request.getStart().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "start", request.getStart().get(), false); - } - if (request.getEnd().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "end", request.getEnd().get(), false); - } - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request.Builder _requestBuilder = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "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(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, UsageFieldsV1Response.class), - response); - } - try { - if (response.code() == 400) { - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new DeepgramApiApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (IOException e) { - throw new DeepgramApiException("Network error executing HTTP request", e); - } - } -} diff --git a/src/main/java/resources/manage/v1/projects/usage/fields/requests/FieldsListRequest.java b/src/main/java/resources/manage/v1/projects/usage/fields/requests/FieldsListRequest.java deleted file mode 100644 index 59bb8bf..0000000 --- a/src/main/java/resources/manage/v1/projects/usage/fields/requests/FieldsListRequest.java +++ /dev/null @@ -1,133 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.usage.fields.requests; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import 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 = FieldsListRequest.Builder.class) -public final class FieldsListRequest { - private final Optional start; - - private final Optional end; - - private final Map additionalProperties; - - private FieldsListRequest( - Optional start, Optional end, Map additionalProperties) { - this.start = start; - this.end = end; - this.additionalProperties = additionalProperties; - } - - /** - * @return Start date of the requested date range. Format accepted is YYYY-MM-DD - */ - @JsonIgnore - public Optional getStart() { - return start; - } - - /** - * @return End date of the requested date range. Format accepted is YYYY-MM-DD - */ - @JsonIgnore - public Optional getEnd() { - return end; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof FieldsListRequest && equalTo((FieldsListRequest) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(FieldsListRequest other) { - return start.equals(other.start) && end.equals(other.end); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.start, this.end); - } - - @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 start = Optional.empty(); - - private Optional end = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(FieldsListRequest other) { - start(other.getStart()); - end(other.getEnd()); - return this; - } - - /** Start date of the requested date range. Format accepted is YYYY-MM-DD */ - @JsonSetter(value = "start", nulls = Nulls.SKIP) - public Builder start(Optional start) { - this.start = start; - return this; - } - - public Builder start(String start) { - this.start = Optional.ofNullable(start); - return this; - } - - /** End date of the requested date range. Format accepted is YYYY-MM-DD */ - @JsonSetter(value = "end", nulls = Nulls.SKIP) - public Builder end(Optional end) { - this.end = end; - return this; - } - - public Builder end(String end) { - this.end = Optional.ofNullable(end); - return this; - } - - public FieldsListRequest build() { - return new FieldsListRequest(start, end, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/manage/v1/projects/usage/requests/UsageGetRequest.java b/src/main/java/resources/manage/v1/projects/usage/requests/UsageGetRequest.java deleted file mode 100644 index 1330c3b..0000000 --- a/src/main/java/resources/manage/v1/projects/usage/requests/UsageGetRequest.java +++ /dev/null @@ -1,1404 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.usage.requests; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import core.ObjectMappers; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import resources.manage.v1.projects.usage.types.UsageGetRequestDeployment; -import resources.manage.v1.projects.usage.types.UsageGetRequestEndpoint; -import resources.manage.v1.projects.usage.types.UsageGetRequestMethod; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = UsageGetRequest.Builder.class) -public final class UsageGetRequest { - private final Optional start; - - private final Optional end; - - private final Optional accessor; - - private final Optional alternatives; - - private final Optional callbackMethod; - - private final Optional callback; - - private final Optional channels; - - private final Optional customIntentMode; - - private final Optional customIntent; - - private final Optional customTopicMode; - - private final Optional customTopic; - - private final Optional deployment; - - private final Optional detectEntities; - - private final Optional detectLanguage; - - private final Optional diarize; - - private final Optional dictation; - - private final Optional encoding; - - private final Optional endpoint; - - private final Optional extra; - - private final Optional fillerWords; - - private final Optional intents; - - private final Optional keyterm; - - private final Optional keywords; - - private final Optional language; - - private final Optional measurements; - - private final Optional method; - - private final Optional model; - - private final Optional multichannel; - - private final Optional numerals; - - private final Optional paragraphs; - - private final Optional profanityFilter; - - private final Optional punctuate; - - private final Optional redact; - - private final Optional replace; - - private final Optional sampleRate; - - private final Optional search; - - private final Optional sentiment; - - private final Optional smartFormat; - - private final Optional summarize; - - private final Optional tag; - - private final Optional topics; - - private final Optional uttSplit; - - private final Optional utterances; - - private final Optional version; - - private final Map additionalProperties; - - private UsageGetRequest( - Optional start, - Optional end, - Optional accessor, - Optional alternatives, - Optional callbackMethod, - Optional callback, - Optional channels, - Optional customIntentMode, - Optional customIntent, - Optional customTopicMode, - Optional customTopic, - Optional deployment, - Optional detectEntities, - Optional detectLanguage, - Optional diarize, - Optional dictation, - Optional encoding, - Optional endpoint, - Optional extra, - Optional fillerWords, - Optional intents, - Optional keyterm, - Optional keywords, - Optional language, - Optional measurements, - Optional method, - Optional model, - Optional multichannel, - Optional numerals, - Optional paragraphs, - Optional profanityFilter, - Optional punctuate, - Optional redact, - Optional replace, - Optional sampleRate, - Optional search, - Optional sentiment, - Optional smartFormat, - Optional summarize, - Optional tag, - Optional topics, - Optional uttSplit, - Optional utterances, - Optional version, - Map additionalProperties) { - this.start = start; - this.end = end; - this.accessor = accessor; - this.alternatives = alternatives; - this.callbackMethod = callbackMethod; - this.callback = callback; - this.channels = channels; - this.customIntentMode = customIntentMode; - this.customIntent = customIntent; - this.customTopicMode = customTopicMode; - this.customTopic = customTopic; - this.deployment = deployment; - this.detectEntities = detectEntities; - this.detectLanguage = detectLanguage; - this.diarize = diarize; - this.dictation = dictation; - this.encoding = encoding; - this.endpoint = endpoint; - this.extra = extra; - this.fillerWords = fillerWords; - this.intents = intents; - this.keyterm = keyterm; - this.keywords = keywords; - this.language = language; - this.measurements = measurements; - this.method = method; - this.model = model; - this.multichannel = multichannel; - this.numerals = numerals; - this.paragraphs = paragraphs; - this.profanityFilter = profanityFilter; - this.punctuate = punctuate; - this.redact = redact; - this.replace = replace; - this.sampleRate = sampleRate; - this.search = search; - this.sentiment = sentiment; - this.smartFormat = smartFormat; - this.summarize = summarize; - this.tag = tag; - this.topics = topics; - this.uttSplit = uttSplit; - this.utterances = utterances; - this.version = version; - this.additionalProperties = additionalProperties; - } - - /** - * @return Start date of the requested date range. Format accepted is YYYY-MM-DD - */ - @JsonIgnore - public Optional getStart() { - return start; - } - - /** - * @return End date of the requested date range. Format accepted is YYYY-MM-DD - */ - @JsonIgnore - public Optional getEnd() { - return end; - } - - /** - * @return Filter for requests where a specific accessor was used - */ - @JsonIgnore - public Optional getAccessor() { - return accessor; - } - - /** - * @return Filter for requests where alternatives were used - */ - @JsonIgnore - public Optional getAlternatives() { - return alternatives; - } - - /** - * @return Filter for requests where callback method was used - */ - @JsonIgnore - public Optional getCallbackMethod() { - return callbackMethod; - } - - /** - * @return Filter for requests where callback was used - */ - @JsonIgnore - public Optional getCallback() { - return callback; - } - - /** - * @return Filter for requests where channels were used - */ - @JsonIgnore - public Optional getChannels() { - return channels; - } - - /** - * @return Filter for requests where custom intent mode was used - */ - @JsonIgnore - public Optional getCustomIntentMode() { - return customIntentMode; - } - - /** - * @return Filter for requests where custom intent was used - */ - @JsonIgnore - public Optional getCustomIntent() { - return customIntent; - } - - /** - * @return Filter for requests where custom topic mode was used - */ - @JsonIgnore - public Optional getCustomTopicMode() { - return customTopicMode; - } - - /** - * @return Filter for requests where custom topic was used - */ - @JsonIgnore - public Optional getCustomTopic() { - return customTopic; - } - - /** - * @return Filter for requests where a specific deployment was used - */ - @JsonIgnore - public Optional getDeployment() { - return deployment; - } - - /** - * @return Filter for requests where detect entities was used - */ - @JsonIgnore - public Optional getDetectEntities() { - return detectEntities; - } - - /** - * @return Filter for requests where detect language was used - */ - @JsonIgnore - public Optional getDetectLanguage() { - return detectLanguage; - } - - /** - * @return Filter for requests where diarize was used - */ - @JsonIgnore - public Optional getDiarize() { - return diarize; - } - - /** - * @return Filter for requests where dictation was used - */ - @JsonIgnore - public Optional getDictation() { - return dictation; - } - - /** - * @return Filter for requests where encoding was used - */ - @JsonIgnore - public Optional getEncoding() { - return encoding; - } - - /** - * @return Filter for requests where a specific endpoint was used - */ - @JsonIgnore - public Optional getEndpoint() { - return endpoint; - } - - /** - * @return Filter for requests where extra was used - */ - @JsonIgnore - public Optional getExtra() { - return extra; - } - - /** - * @return Filter for requests where filler words was used - */ - @JsonIgnore - public Optional getFillerWords() { - return fillerWords; - } - - /** - * @return Filter for requests where intents was used - */ - @JsonIgnore - public Optional getIntents() { - return intents; - } - - /** - * @return Filter for requests where keyterm was used - */ - @JsonIgnore - public Optional getKeyterm() { - return keyterm; - } - - /** - * @return Filter for requests where keywords was used - */ - @JsonIgnore - public Optional getKeywords() { - return keywords; - } - - /** - * @return Filter for requests where language was used - */ - @JsonIgnore - public Optional getLanguage() { - return language; - } - - /** - * @return Filter for requests where measurements were used - */ - @JsonIgnore - public Optional getMeasurements() { - return measurements; - } - - /** - * @return Filter for requests where a specific method was used - */ - @JsonIgnore - public Optional getMethod() { - return method; - } - - /** - * @return Filter for requests where a specific model uuid was used - */ - @JsonIgnore - public Optional getModel() { - return model; - } - - /** - * @return Filter for requests where multichannel was used - */ - @JsonIgnore - public Optional getMultichannel() { - return multichannel; - } - - /** - * @return Filter for requests where numerals were used - */ - @JsonIgnore - public Optional getNumerals() { - return numerals; - } - - /** - * @return Filter for requests where paragraphs were used - */ - @JsonIgnore - public Optional getParagraphs() { - return paragraphs; - } - - /** - * @return Filter for requests where profanity filter was used - */ - @JsonIgnore - public Optional getProfanityFilter() { - return profanityFilter; - } - - /** - * @return Filter for requests where punctuate was used - */ - @JsonIgnore - public Optional getPunctuate() { - return punctuate; - } - - /** - * @return Filter for requests where redact was used - */ - @JsonIgnore - public Optional getRedact() { - return redact; - } - - /** - * @return Filter for requests where replace was used - */ - @JsonIgnore - public Optional getReplace() { - return replace; - } - - /** - * @return Filter for requests where sample rate was used - */ - @JsonIgnore - public Optional getSampleRate() { - return sampleRate; - } - - /** - * @return Filter for requests where search was used - */ - @JsonIgnore - public Optional getSearch() { - return search; - } - - /** - * @return Filter for requests where sentiment was used - */ - @JsonIgnore - public Optional getSentiment() { - return sentiment; - } - - /** - * @return Filter for requests where smart format was used - */ - @JsonIgnore - public Optional getSmartFormat() { - return smartFormat; - } - - /** - * @return Filter for requests where summarize was used - */ - @JsonIgnore - public Optional getSummarize() { - return summarize; - } - - /** - * @return Filter for requests where a specific tag was used - */ - @JsonIgnore - public Optional getTag() { - return tag; - } - - /** - * @return Filter for requests where topics was used - */ - @JsonIgnore - public Optional getTopics() { - return topics; - } - - /** - * @return Filter for requests where utt split was used - */ - @JsonIgnore - public Optional getUttSplit() { - return uttSplit; - } - - /** - * @return Filter for requests where utterances was used - */ - @JsonIgnore - public Optional getUtterances() { - return utterances; - } - - /** - * @return Filter for requests where version was used - */ - @JsonIgnore - public Optional getVersion() { - return version; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UsageGetRequest && equalTo((UsageGetRequest) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(UsageGetRequest other) { - return start.equals(other.start) - && end.equals(other.end) - && accessor.equals(other.accessor) - && alternatives.equals(other.alternatives) - && callbackMethod.equals(other.callbackMethod) - && callback.equals(other.callback) - && channels.equals(other.channels) - && customIntentMode.equals(other.customIntentMode) - && customIntent.equals(other.customIntent) - && customTopicMode.equals(other.customTopicMode) - && customTopic.equals(other.customTopic) - && deployment.equals(other.deployment) - && detectEntities.equals(other.detectEntities) - && detectLanguage.equals(other.detectLanguage) - && diarize.equals(other.diarize) - && dictation.equals(other.dictation) - && encoding.equals(other.encoding) - && endpoint.equals(other.endpoint) - && extra.equals(other.extra) - && fillerWords.equals(other.fillerWords) - && intents.equals(other.intents) - && keyterm.equals(other.keyterm) - && keywords.equals(other.keywords) - && language.equals(other.language) - && measurements.equals(other.measurements) - && method.equals(other.method) - && model.equals(other.model) - && multichannel.equals(other.multichannel) - && numerals.equals(other.numerals) - && paragraphs.equals(other.paragraphs) - && profanityFilter.equals(other.profanityFilter) - && punctuate.equals(other.punctuate) - && redact.equals(other.redact) - && replace.equals(other.replace) - && sampleRate.equals(other.sampleRate) - && search.equals(other.search) - && sentiment.equals(other.sentiment) - && smartFormat.equals(other.smartFormat) - && summarize.equals(other.summarize) - && tag.equals(other.tag) - && topics.equals(other.topics) - && uttSplit.equals(other.uttSplit) - && utterances.equals(other.utterances) - && version.equals(other.version); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.start, - this.end, - this.accessor, - this.alternatives, - this.callbackMethod, - this.callback, - this.channels, - this.customIntentMode, - this.customIntent, - this.customTopicMode, - this.customTopic, - this.deployment, - this.detectEntities, - this.detectLanguage, - this.diarize, - this.dictation, - this.encoding, - this.endpoint, - this.extra, - this.fillerWords, - this.intents, - this.keyterm, - this.keywords, - this.language, - this.measurements, - this.method, - this.model, - this.multichannel, - this.numerals, - this.paragraphs, - this.profanityFilter, - this.punctuate, - this.redact, - this.replace, - this.sampleRate, - this.search, - this.sentiment, - this.smartFormat, - this.summarize, - this.tag, - this.topics, - this.uttSplit, - this.utterances, - this.version); - } - - @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 start = Optional.empty(); - - private Optional end = Optional.empty(); - - private Optional accessor = Optional.empty(); - - private Optional alternatives = Optional.empty(); - - private Optional callbackMethod = Optional.empty(); - - private Optional callback = Optional.empty(); - - private Optional channels = Optional.empty(); - - private Optional customIntentMode = Optional.empty(); - - private Optional customIntent = Optional.empty(); - - private Optional customTopicMode = Optional.empty(); - - private Optional customTopic = Optional.empty(); - - private Optional deployment = Optional.empty(); - - private Optional detectEntities = Optional.empty(); - - private Optional detectLanguage = Optional.empty(); - - private Optional diarize = Optional.empty(); - - private Optional dictation = Optional.empty(); - - private Optional encoding = Optional.empty(); - - private Optional endpoint = Optional.empty(); - - private Optional extra = Optional.empty(); - - private Optional fillerWords = Optional.empty(); - - private Optional intents = Optional.empty(); - - private Optional keyterm = Optional.empty(); - - private Optional keywords = Optional.empty(); - - private Optional language = Optional.empty(); - - private Optional measurements = Optional.empty(); - - private Optional method = Optional.empty(); - - private Optional model = Optional.empty(); - - private Optional multichannel = Optional.empty(); - - private Optional numerals = Optional.empty(); - - private Optional paragraphs = Optional.empty(); - - private Optional profanityFilter = Optional.empty(); - - private Optional punctuate = Optional.empty(); - - private Optional redact = Optional.empty(); - - private Optional replace = Optional.empty(); - - private Optional sampleRate = Optional.empty(); - - private Optional search = Optional.empty(); - - private Optional sentiment = Optional.empty(); - - private Optional smartFormat = Optional.empty(); - - private Optional summarize = Optional.empty(); - - private Optional tag = Optional.empty(); - - private Optional topics = Optional.empty(); - - private Optional uttSplit = Optional.empty(); - - private Optional utterances = Optional.empty(); - - private Optional version = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(UsageGetRequest other) { - start(other.getStart()); - end(other.getEnd()); - accessor(other.getAccessor()); - alternatives(other.getAlternatives()); - callbackMethod(other.getCallbackMethod()); - callback(other.getCallback()); - channels(other.getChannels()); - customIntentMode(other.getCustomIntentMode()); - customIntent(other.getCustomIntent()); - customTopicMode(other.getCustomTopicMode()); - customTopic(other.getCustomTopic()); - deployment(other.getDeployment()); - detectEntities(other.getDetectEntities()); - detectLanguage(other.getDetectLanguage()); - diarize(other.getDiarize()); - dictation(other.getDictation()); - encoding(other.getEncoding()); - endpoint(other.getEndpoint()); - extra(other.getExtra()); - fillerWords(other.getFillerWords()); - intents(other.getIntents()); - keyterm(other.getKeyterm()); - keywords(other.getKeywords()); - language(other.getLanguage()); - measurements(other.getMeasurements()); - method(other.getMethod()); - model(other.getModel()); - multichannel(other.getMultichannel()); - numerals(other.getNumerals()); - paragraphs(other.getParagraphs()); - profanityFilter(other.getProfanityFilter()); - punctuate(other.getPunctuate()); - redact(other.getRedact()); - replace(other.getReplace()); - sampleRate(other.getSampleRate()); - search(other.getSearch()); - sentiment(other.getSentiment()); - smartFormat(other.getSmartFormat()); - summarize(other.getSummarize()); - tag(other.getTag()); - topics(other.getTopics()); - uttSplit(other.getUttSplit()); - utterances(other.getUtterances()); - version(other.getVersion()); - return this; - } - - /** Start date of the requested date range. Format accepted is YYYY-MM-DD */ - @JsonSetter(value = "start", nulls = Nulls.SKIP) - public Builder start(Optional start) { - this.start = start; - return this; - } - - public Builder start(String start) { - this.start = Optional.ofNullable(start); - return this; - } - - /** End date of the requested date range. Format accepted is YYYY-MM-DD */ - @JsonSetter(value = "end", nulls = Nulls.SKIP) - public Builder end(Optional end) { - this.end = end; - return this; - } - - public Builder end(String end) { - this.end = Optional.ofNullable(end); - return this; - } - - /** Filter for requests where a specific accessor was used */ - @JsonSetter(value = "accessor", nulls = Nulls.SKIP) - public Builder accessor(Optional accessor) { - this.accessor = accessor; - return this; - } - - public Builder accessor(String accessor) { - this.accessor = Optional.ofNullable(accessor); - return this; - } - - /** Filter for requests where alternatives were used */ - @JsonSetter(value = "alternatives", nulls = Nulls.SKIP) - public Builder alternatives(Optional alternatives) { - this.alternatives = alternatives; - return this; - } - - public Builder alternatives(Boolean alternatives) { - this.alternatives = Optional.ofNullable(alternatives); - return this; - } - - /** Filter for requests where callback method was used */ - @JsonSetter(value = "callback_method", nulls = Nulls.SKIP) - public Builder callbackMethod(Optional callbackMethod) { - this.callbackMethod = callbackMethod; - return this; - } - - public Builder callbackMethod(Boolean callbackMethod) { - this.callbackMethod = Optional.ofNullable(callbackMethod); - return this; - } - - /** Filter for requests where callback was used */ - @JsonSetter(value = "callback", nulls = Nulls.SKIP) - public Builder callback(Optional callback) { - this.callback = callback; - return this; - } - - public Builder callback(Boolean callback) { - this.callback = Optional.ofNullable(callback); - return this; - } - - /** Filter for requests where channels were used */ - @JsonSetter(value = "channels", nulls = Nulls.SKIP) - public Builder channels(Optional channels) { - this.channels = channels; - return this; - } - - public Builder channels(Boolean channels) { - this.channels = Optional.ofNullable(channels); - return this; - } - - /** Filter for requests where custom intent mode was used */ - @JsonSetter(value = "custom_intent_mode", nulls = Nulls.SKIP) - public Builder customIntentMode(Optional customIntentMode) { - this.customIntentMode = customIntentMode; - return this; - } - - public Builder customIntentMode(Boolean customIntentMode) { - this.customIntentMode = Optional.ofNullable(customIntentMode); - return this; - } - - /** Filter for requests where custom intent was used */ - @JsonSetter(value = "custom_intent", nulls = Nulls.SKIP) - public Builder customIntent(Optional customIntent) { - this.customIntent = customIntent; - return this; - } - - public Builder customIntent(Boolean customIntent) { - this.customIntent = Optional.ofNullable(customIntent); - return this; - } - - /** Filter for requests where custom topic mode was used */ - @JsonSetter(value = "custom_topic_mode", nulls = Nulls.SKIP) - public Builder customTopicMode(Optional customTopicMode) { - this.customTopicMode = customTopicMode; - return this; - } - - public Builder customTopicMode(Boolean customTopicMode) { - this.customTopicMode = Optional.ofNullable(customTopicMode); - return this; - } - - /** Filter for requests where custom topic was used */ - @JsonSetter(value = "custom_topic", nulls = Nulls.SKIP) - public Builder customTopic(Optional customTopic) { - this.customTopic = customTopic; - return this; - } - - public Builder customTopic(Boolean customTopic) { - this.customTopic = Optional.ofNullable(customTopic); - return this; - } - - /** Filter for requests where a specific deployment was used */ - @JsonSetter(value = "deployment", nulls = Nulls.SKIP) - public Builder deployment(Optional deployment) { - this.deployment = deployment; - return this; - } - - public Builder deployment(UsageGetRequestDeployment deployment) { - this.deployment = Optional.ofNullable(deployment); - return this; - } - - /** Filter for requests where detect entities was used */ - @JsonSetter(value = "detect_entities", nulls = Nulls.SKIP) - public Builder detectEntities(Optional detectEntities) { - this.detectEntities = detectEntities; - return this; - } - - public Builder detectEntities(Boolean detectEntities) { - this.detectEntities = Optional.ofNullable(detectEntities); - return this; - } - - /** Filter for requests where detect language was used */ - @JsonSetter(value = "detect_language", nulls = Nulls.SKIP) - public Builder detectLanguage(Optional detectLanguage) { - this.detectLanguage = detectLanguage; - return this; - } - - public Builder detectLanguage(Boolean detectLanguage) { - this.detectLanguage = Optional.ofNullable(detectLanguage); - return this; - } - - /** Filter for requests where diarize was used */ - @JsonSetter(value = "diarize", nulls = Nulls.SKIP) - public Builder diarize(Optional diarize) { - this.diarize = diarize; - return this; - } - - public Builder diarize(Boolean diarize) { - this.diarize = Optional.ofNullable(diarize); - return this; - } - - /** Filter for requests where dictation was used */ - @JsonSetter(value = "dictation", nulls = Nulls.SKIP) - public Builder dictation(Optional dictation) { - this.dictation = dictation; - return this; - } - - public Builder dictation(Boolean dictation) { - this.dictation = Optional.ofNullable(dictation); - return this; - } - - /** Filter for requests where encoding was used */ - @JsonSetter(value = "encoding", nulls = Nulls.SKIP) - public Builder encoding(Optional encoding) { - this.encoding = encoding; - return this; - } - - public Builder encoding(Boolean encoding) { - this.encoding = Optional.ofNullable(encoding); - return this; - } - - /** Filter for requests where a specific endpoint was used */ - @JsonSetter(value = "endpoint", nulls = Nulls.SKIP) - public Builder endpoint(Optional endpoint) { - this.endpoint = endpoint; - return this; - } - - public Builder endpoint(UsageGetRequestEndpoint endpoint) { - this.endpoint = Optional.ofNullable(endpoint); - return this; - } - - /** Filter for requests where extra was used */ - @JsonSetter(value = "extra", nulls = Nulls.SKIP) - public Builder extra(Optional extra) { - this.extra = extra; - return this; - } - - public Builder extra(Boolean extra) { - this.extra = Optional.ofNullable(extra); - return this; - } - - /** Filter for requests where filler words was used */ - @JsonSetter(value = "filler_words", nulls = Nulls.SKIP) - public Builder fillerWords(Optional fillerWords) { - this.fillerWords = fillerWords; - return this; - } - - public Builder fillerWords(Boolean fillerWords) { - this.fillerWords = Optional.ofNullable(fillerWords); - return this; - } - - /** Filter for requests where intents was used */ - @JsonSetter(value = "intents", nulls = Nulls.SKIP) - public Builder intents(Optional intents) { - this.intents = intents; - return this; - } - - public Builder intents(Boolean intents) { - this.intents = Optional.ofNullable(intents); - return this; - } - - /** Filter for requests where keyterm was used */ - @JsonSetter(value = "keyterm", nulls = Nulls.SKIP) - public Builder keyterm(Optional keyterm) { - this.keyterm = keyterm; - return this; - } - - public Builder keyterm(Boolean keyterm) { - this.keyterm = Optional.ofNullable(keyterm); - return this; - } - - /** Filter for requests where keywords was used */ - @JsonSetter(value = "keywords", nulls = Nulls.SKIP) - public Builder keywords(Optional keywords) { - this.keywords = keywords; - return this; - } - - public Builder keywords(Boolean keywords) { - this.keywords = Optional.ofNullable(keywords); - return this; - } - - /** Filter for requests where language was used */ - @JsonSetter(value = "language", nulls = Nulls.SKIP) - public Builder language(Optional language) { - this.language = language; - return this; - } - - public Builder language(Boolean language) { - this.language = Optional.ofNullable(language); - return this; - } - - /** Filter for requests where measurements were used */ - @JsonSetter(value = "measurements", nulls = Nulls.SKIP) - public Builder measurements(Optional measurements) { - this.measurements = measurements; - return this; - } - - public Builder measurements(Boolean measurements) { - this.measurements = Optional.ofNullable(measurements); - return this; - } - - /** Filter for requests where a specific method was used */ - @JsonSetter(value = "method", nulls = Nulls.SKIP) - public Builder method(Optional method) { - this.method = method; - return this; - } - - public Builder method(UsageGetRequestMethod method) { - this.method = Optional.ofNullable(method); - return this; - } - - /** Filter for requests where a specific model uuid was used */ - @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; - } - - /** Filter for requests where multichannel was used */ - @JsonSetter(value = "multichannel", nulls = Nulls.SKIP) - public Builder multichannel(Optional multichannel) { - this.multichannel = multichannel; - return this; - } - - public Builder multichannel(Boolean multichannel) { - this.multichannel = Optional.ofNullable(multichannel); - return this; - } - - /** Filter for requests where numerals were used */ - @JsonSetter(value = "numerals", nulls = Nulls.SKIP) - public Builder numerals(Optional numerals) { - this.numerals = numerals; - return this; - } - - public Builder numerals(Boolean numerals) { - this.numerals = Optional.ofNullable(numerals); - return this; - } - - /** Filter for requests where paragraphs were used */ - @JsonSetter(value = "paragraphs", nulls = Nulls.SKIP) - public Builder paragraphs(Optional paragraphs) { - this.paragraphs = paragraphs; - return this; - } - - public Builder paragraphs(Boolean paragraphs) { - this.paragraphs = Optional.ofNullable(paragraphs); - return this; - } - - /** Filter for requests where profanity filter was used */ - @JsonSetter(value = "profanity_filter", nulls = Nulls.SKIP) - public Builder profanityFilter(Optional profanityFilter) { - this.profanityFilter = profanityFilter; - return this; - } - - public Builder profanityFilter(Boolean profanityFilter) { - this.profanityFilter = Optional.ofNullable(profanityFilter); - return this; - } - - /** Filter for requests where punctuate was used */ - @JsonSetter(value = "punctuate", nulls = Nulls.SKIP) - public Builder punctuate(Optional punctuate) { - this.punctuate = punctuate; - return this; - } - - public Builder punctuate(Boolean punctuate) { - this.punctuate = Optional.ofNullable(punctuate); - return this; - } - - /** Filter for requests where redact was used */ - @JsonSetter(value = "redact", nulls = Nulls.SKIP) - public Builder redact(Optional redact) { - this.redact = redact; - return this; - } - - public Builder redact(Boolean redact) { - this.redact = Optional.ofNullable(redact); - return this; - } - - /** Filter for requests where replace was used */ - @JsonSetter(value = "replace", nulls = Nulls.SKIP) - public Builder replace(Optional replace) { - this.replace = replace; - return this; - } - - public Builder replace(Boolean replace) { - this.replace = Optional.ofNullable(replace); - return this; - } - - /** Filter for requests where sample rate was used */ - @JsonSetter(value = "sample_rate", nulls = Nulls.SKIP) - public Builder sampleRate(Optional sampleRate) { - this.sampleRate = sampleRate; - return this; - } - - public Builder sampleRate(Boolean sampleRate) { - this.sampleRate = Optional.ofNullable(sampleRate); - return this; - } - - /** Filter for requests where search was used */ - @JsonSetter(value = "search", nulls = Nulls.SKIP) - public Builder search(Optional search) { - this.search = search; - return this; - } - - public Builder search(Boolean search) { - this.search = Optional.ofNullable(search); - return this; - } - - /** Filter for requests where sentiment was used */ - @JsonSetter(value = "sentiment", nulls = Nulls.SKIP) - public Builder sentiment(Optional sentiment) { - this.sentiment = sentiment; - return this; - } - - public Builder sentiment(Boolean sentiment) { - this.sentiment = Optional.ofNullable(sentiment); - return this; - } - - /** Filter for requests where smart format was used */ - @JsonSetter(value = "smart_format", 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; - } - - /** Filter for requests where summarize was used */ - @JsonSetter(value = "summarize", nulls = Nulls.SKIP) - public Builder summarize(Optional summarize) { - this.summarize = summarize; - return this; - } - - public Builder summarize(Boolean summarize) { - this.summarize = Optional.ofNullable(summarize); - return this; - } - - /** Filter for requests where a specific tag was used */ - @JsonSetter(value = "tag", nulls = Nulls.SKIP) - public Builder tag(Optional tag) { - this.tag = tag; - return this; - } - - public Builder tag(String tag) { - this.tag = Optional.ofNullable(tag); - return this; - } - - /** Filter for requests where topics was used */ - @JsonSetter(value = "topics", nulls = Nulls.SKIP) - public Builder topics(Optional topics) { - this.topics = topics; - return this; - } - - public Builder topics(Boolean topics) { - this.topics = Optional.ofNullable(topics); - return this; - } - - /** Filter for requests where utt split was used */ - @JsonSetter(value = "utt_split", nulls = Nulls.SKIP) - public Builder uttSplit(Optional uttSplit) { - this.uttSplit = uttSplit; - return this; - } - - public Builder uttSplit(Boolean uttSplit) { - this.uttSplit = Optional.ofNullable(uttSplit); - return this; - } - - /** Filter for requests where utterances was used */ - @JsonSetter(value = "utterances", nulls = Nulls.SKIP) - public Builder utterances(Optional utterances) { - this.utterances = utterances; - return this; - } - - public Builder utterances(Boolean utterances) { - this.utterances = Optional.ofNullable(utterances); - return this; - } - - /** Filter for requests where version was used */ - @JsonSetter(value = "version", nulls = Nulls.SKIP) - public Builder version(Optional version) { - this.version = version; - return this; - } - - public Builder version(Boolean version) { - this.version = Optional.ofNullable(version); - return this; - } - - public UsageGetRequest build() { - return new UsageGetRequest( - start, - end, - accessor, - alternatives, - callbackMethod, - callback, - channels, - customIntentMode, - customIntent, - customTopicMode, - customTopic, - deployment, - detectEntities, - detectLanguage, - diarize, - dictation, - encoding, - endpoint, - extra, - fillerWords, - intents, - keyterm, - keywords, - language, - measurements, - method, - model, - multichannel, - numerals, - paragraphs, - profanityFilter, - punctuate, - redact, - replace, - sampleRate, - search, - sentiment, - smartFormat, - summarize, - tag, - topics, - uttSplit, - utterances, - version, - additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/manage/v1/projects/usage/types/UsageGetRequestDeployment.java b/src/main/java/resources/manage/v1/projects/usage/types/UsageGetRequestDeployment.java deleted file mode 100644 index eb1be2b..0000000 --- a/src/main/java/resources/manage/v1/projects/usage/types/UsageGetRequestDeployment.java +++ /dev/null @@ -1,95 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.usage.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class UsageGetRequestDeployment { - public static final UsageGetRequestDeployment SELF_HOSTED = - new UsageGetRequestDeployment(Value.SELF_HOSTED, "self-hosted"); - - public static final UsageGetRequestDeployment BETA = - new UsageGetRequestDeployment(Value.BETA, "beta"); - - public static final UsageGetRequestDeployment HOSTED = - new UsageGetRequestDeployment(Value.HOSTED, "hosted"); - - private final Value value; - - private final String string; - - UsageGetRequestDeployment(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof UsageGetRequestDeployment - && this.string.equals(((UsageGetRequestDeployment) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case SELF_HOSTED: - return visitor.visitSelfHosted(); - case BETA: - return visitor.visitBeta(); - case HOSTED: - return visitor.visitHosted(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static UsageGetRequestDeployment valueOf(String value) { - switch (value) { - case "self-hosted": - return SELF_HOSTED; - case "beta": - return BETA; - case "hosted": - return HOSTED; - default: - return new UsageGetRequestDeployment(Value.UNKNOWN, value); - } - } - - public enum Value { - HOSTED, - - BETA, - - SELF_HOSTED, - - UNKNOWN - } - - public interface Visitor { - T visitHosted(); - - T visitBeta(); - - T visitSelfHosted(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/resources/manage/v1/projects/usage/types/UsageGetRequestEndpoint.java b/src/main/java/resources/manage/v1/projects/usage/types/UsageGetRequestEndpoint.java deleted file mode 100644 index 781e940..0000000 --- a/src/main/java/resources/manage/v1/projects/usage/types/UsageGetRequestEndpoint.java +++ /dev/null @@ -1,106 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.usage.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class UsageGetRequestEndpoint { - public static final UsageGetRequestEndpoint AGENT = - new UsageGetRequestEndpoint(Value.AGENT, "agent"); - - public static final UsageGetRequestEndpoint READ = - new UsageGetRequestEndpoint(Value.READ, "read"); - - public static final UsageGetRequestEndpoint LISTEN = - new UsageGetRequestEndpoint(Value.LISTEN, "listen"); - - public static final UsageGetRequestEndpoint SPEAK = - new UsageGetRequestEndpoint(Value.SPEAK, "speak"); - - private final Value value; - - private final String string; - - UsageGetRequestEndpoint(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof UsageGetRequestEndpoint - && this.string.equals(((UsageGetRequestEndpoint) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case AGENT: - return visitor.visitAgent(); - case READ: - return visitor.visitRead(); - case LISTEN: - return visitor.visitListen(); - case SPEAK: - return visitor.visitSpeak(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static UsageGetRequestEndpoint valueOf(String value) { - switch (value) { - case "agent": - return AGENT; - case "read": - return READ; - case "listen": - return LISTEN; - case "speak": - return SPEAK; - default: - return new UsageGetRequestEndpoint(Value.UNKNOWN, value); - } - } - - public enum Value { - LISTEN, - - READ, - - SPEAK, - - AGENT, - - UNKNOWN - } - - public interface Visitor { - T visitListen(); - - T visitRead(); - - T visitSpeak(); - - T visitAgent(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/resources/manage/v1/projects/usage/types/UsageGetRequestMethod.java b/src/main/java/resources/manage/v1/projects/usage/types/UsageGetRequestMethod.java deleted file mode 100644 index dc0314b..0000000 --- a/src/main/java/resources/manage/v1/projects/usage/types/UsageGetRequestMethod.java +++ /dev/null @@ -1,93 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.manage.v1.projects.usage.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class UsageGetRequestMethod { - public static final UsageGetRequestMethod SYNC = new UsageGetRequestMethod(Value.SYNC, "sync"); - - public static final UsageGetRequestMethod STREAMING = - new UsageGetRequestMethod(Value.STREAMING, "streaming"); - - public static final UsageGetRequestMethod ASYNC = new UsageGetRequestMethod(Value.ASYNC, "async"); - - private final Value value; - - private final String string; - - UsageGetRequestMethod(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof UsageGetRequestMethod - && this.string.equals(((UsageGetRequestMethod) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case SYNC: - return visitor.visitSync(); - case STREAMING: - return visitor.visitStreaming(); - case ASYNC: - return visitor.visitAsync(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static UsageGetRequestMethod valueOf(String value) { - switch (value) { - case "sync": - return SYNC; - case "streaming": - return STREAMING; - case "async": - return ASYNC; - default: - return new UsageGetRequestMethod(Value.UNKNOWN, value); - } - } - - public enum Value { - SYNC, - - ASYNC, - - STREAMING, - - UNKNOWN - } - - public interface Visitor { - T visitSync(); - - T visitAsync(); - - T visitStreaming(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/resources/read/AsyncReadClient.java b/src/main/java/resources/read/AsyncReadClient.java deleted file mode 100644 index 234485e..0000000 --- a/src/main/java/resources/read/AsyncReadClient.java +++ /dev/null @@ -1,22 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.read; - -import core.ClientOptions; -import core.Suppliers; -import java.util.function.Supplier; -import resources.read.v1.AsyncV1Client; - -public class AsyncReadClient { - protected final ClientOptions clientOptions; - - protected final Supplier v1Client; - - public AsyncReadClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.v1Client = Suppliers.memoize(() -> new AsyncV1Client(clientOptions)); - } - - public AsyncV1Client v1() { - return this.v1Client.get(); - } -} diff --git a/src/main/java/resources/read/ReadClient.java b/src/main/java/resources/read/ReadClient.java deleted file mode 100644 index 155a94b..0000000 --- a/src/main/java/resources/read/ReadClient.java +++ /dev/null @@ -1,22 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.read; - -import core.ClientOptions; -import core.Suppliers; -import java.util.function.Supplier; -import resources.read.v1.V1Client; - -public class ReadClient { - protected final ClientOptions clientOptions; - - protected final Supplier v1Client; - - public ReadClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.v1Client = Suppliers.memoize(() -> new V1Client(clientOptions)); - } - - public V1Client v1() { - return this.v1Client.get(); - } -} diff --git a/src/main/java/resources/read/v1/AsyncV1Client.java b/src/main/java/resources/read/v1/AsyncV1Client.java deleted file mode 100644 index e2188ca..0000000 --- a/src/main/java/resources/read/v1/AsyncV1Client.java +++ /dev/null @@ -1,22 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.read.v1; - -import core.ClientOptions; -import core.Suppliers; -import java.util.function.Supplier; -import resources.read.v1.text.AsyncTextClient; - -public class AsyncV1Client { - protected final ClientOptions clientOptions; - - protected final Supplier textClient; - - public AsyncV1Client(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.textClient = Suppliers.memoize(() -> new AsyncTextClient(clientOptions)); - } - - public AsyncTextClient text() { - return this.textClient.get(); - } -} diff --git a/src/main/java/resources/read/v1/V1Client.java b/src/main/java/resources/read/v1/V1Client.java deleted file mode 100644 index 335de79..0000000 --- a/src/main/java/resources/read/v1/V1Client.java +++ /dev/null @@ -1,22 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.read.v1; - -import core.ClientOptions; -import core.Suppliers; -import java.util.function.Supplier; -import resources.read.v1.text.TextClient; - -public class V1Client { - protected final ClientOptions clientOptions; - - protected final Supplier textClient; - - public V1Client(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.textClient = Suppliers.memoize(() -> new TextClient(clientOptions)); - } - - public TextClient text() { - return this.textClient.get(); - } -} diff --git a/src/main/java/resources/read/v1/text/AsyncRawTextClient.java b/src/main/java/resources/read/v1/text/AsyncRawTextClient.java deleted file mode 100644 index 4fb17b7..0000000 --- a/src/main/java/resources/read/v1/text/AsyncRawTextClient.java +++ /dev/null @@ -1,184 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.read.v1.text; - -import com.fasterxml.jackson.core.JsonProcessingException; -import core.ClientOptions; -import core.DeepgramApiApiException; -import core.DeepgramApiException; -import core.DeepgramApiHttpResponse; -import core.MediaTypes; -import core.ObjectMappers; -import core.QueryStringMapper; -import core.RequestOptions; -import errors.BadRequestError; -import java.io.IOException; -import java.util.concurrent.CompletableFuture; -import okhttp3.Call; -import okhttp3.Callback; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; -import okhttp3.ResponseBody; -import org.jetbrains.annotations.NotNull; -import resources.read.v1.text.requests.TextAnalyzeRequest; -import types.ReadV1Request; -import types.ReadV1Response; - -public class AsyncRawTextClient { - protected final ClientOptions clientOptions; - - public AsyncRawTextClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** Analyze text content using Deepgrams text analysis API */ - public CompletableFuture> analyze(ReadV1Request body) { - return analyze(TextAnalyzeRequest.builder().body(body).build()); - } - - /** Analyze text content using Deepgrams text analysis API */ - public CompletableFuture> analyze( - ReadV1Request body, RequestOptions requestOptions) { - return analyze(TextAnalyzeRequest.builder().body(body).build(), requestOptions); - } - - /** Analyze text content using Deepgrams text analysis API */ - public CompletableFuture> analyze( - TextAnalyzeRequest request) { - return analyze(request, null); - } - - /** Analyze text content using Deepgrams text analysis API */ - public CompletableFuture> analyze( - TextAnalyzeRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/read"); - if (request.getCallback().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "callback", request.getCallback().get(), false); - } - if (request.getCallbackMethod().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "callback_method", request.getCallbackMethod().get(), false); - } - if (request.getSentiment().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "sentiment", request.getSentiment().get(), false); - } - if (request.getSummarize().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "summarize", request.getSummarize().get(), false); - } - if (request.getTopics().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "topics", request.getTopics().get(), false); - } - if (request.getCustomTopicMode().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "custom_topic_mode", request.getCustomTopicMode().get(), false); - } - if (request.getIntents().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "intents", request.getIntents().get(), false); - } - if (request.getCustomIntentMode().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "custom_intent_mode", request.getCustomIntentMode().get(), false); - } - if (request.getLanguage().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "language", request.getLanguage().get(), false); - } - if (request.getTag().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "tag", request.getTag().get(), true); - } - if (request.getCustomTopic().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "custom_topic", request.getCustomTopic().get(), true); - } - if (request.getCustomIntent().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "custom_intent", request.getCustomIntent().get(), true); - } - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - RequestBody body; - try { - body = - RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), - MediaTypes.APPLICATION_JSON); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = - new Request.Builder() - .url(httpUrl.build()) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .addHeader("Accept", "application/json"); - Request okhttpRequest = _requestBuilder.build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = new CompletableFuture<>(); - client - .newCall(okhttpRequest) - .enqueue( - new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) - throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete( - new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, ReadV1Response.class), - response)); - return; - } - try { - if (response.code() == 400) { - future.completeExceptionally( - new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally( - new DeepgramApiApiException( - "Error with status code " + response.code(), - response.code(), - errorBody, - response)); - return; - } catch (IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - }); - return future; - } -} diff --git a/src/main/java/resources/read/v1/text/AsyncTextClient.java b/src/main/java/resources/read/v1/text/AsyncTextClient.java deleted file mode 100644 index 1811145..0000000 --- a/src/main/java/resources/read/v1/text/AsyncTextClient.java +++ /dev/null @@ -1,47 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.read.v1.text; - -import core.ClientOptions; -import core.RequestOptions; -import java.util.concurrent.CompletableFuture; -import resources.read.v1.text.requests.TextAnalyzeRequest; -import types.ReadV1Request; -import types.ReadV1Response; - -public class AsyncTextClient { - protected final ClientOptions clientOptions; - - private final AsyncRawTextClient rawClient; - - public AsyncTextClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new AsyncRawTextClient(clientOptions); - } - - /** Get responses with HTTP metadata like headers */ - public AsyncRawTextClient withRawResponse() { - return this.rawClient; - } - - /** Analyze text content using Deepgrams text analysis API */ - public CompletableFuture analyze(ReadV1Request body) { - return this.rawClient.analyze(body).thenApply(response -> response.body()); - } - - /** Analyze text content using Deepgrams text analysis API */ - public CompletableFuture analyze( - ReadV1Request body, RequestOptions requestOptions) { - return this.rawClient.analyze(body, requestOptions).thenApply(response -> response.body()); - } - - /** Analyze text content using Deepgrams text analysis API */ - public CompletableFuture analyze(TextAnalyzeRequest request) { - return this.rawClient.analyze(request).thenApply(response -> response.body()); - } - - /** Analyze text content using Deepgrams text analysis API */ - public CompletableFuture analyze( - TextAnalyzeRequest request, RequestOptions requestOptions) { - return this.rawClient.analyze(request, requestOptions).thenApply(response -> response.body()); - } -} diff --git a/src/main/java/resources/read/v1/text/RawTextClient.java b/src/main/java/resources/read/v1/text/RawTextClient.java deleted file mode 100644 index 0260fa7..0000000 --- a/src/main/java/resources/read/v1/text/RawTextClient.java +++ /dev/null @@ -1,151 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.read.v1.text; - -import com.fasterxml.jackson.core.JsonProcessingException; -import core.ClientOptions; -import core.DeepgramApiApiException; -import core.DeepgramApiException; -import core.DeepgramApiHttpResponse; -import core.MediaTypes; -import core.ObjectMappers; -import core.QueryStringMapper; -import core.RequestOptions; -import errors.BadRequestError; -import java.io.IOException; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; -import okhttp3.ResponseBody; -import resources.read.v1.text.requests.TextAnalyzeRequest; -import types.ReadV1Request; -import types.ReadV1Response; - -public class RawTextClient { - protected final ClientOptions clientOptions; - - public RawTextClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** Analyze text content using Deepgrams text analysis API */ - public DeepgramApiHttpResponse analyze(ReadV1Request body) { - return analyze(TextAnalyzeRequest.builder().body(body).build()); - } - - /** Analyze text content using Deepgrams text analysis API */ - public DeepgramApiHttpResponse analyze( - ReadV1Request body, RequestOptions requestOptions) { - return analyze(TextAnalyzeRequest.builder().body(body).build(), requestOptions); - } - - /** Analyze text content using Deepgrams text analysis API */ - public DeepgramApiHttpResponse analyze(TextAnalyzeRequest request) { - return analyze(request, null); - } - - /** Analyze text content using Deepgrams text analysis API */ - public DeepgramApiHttpResponse analyze( - TextAnalyzeRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/read"); - if (request.getCallback().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "callback", request.getCallback().get(), false); - } - if (request.getCallbackMethod().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "callback_method", request.getCallbackMethod().get(), false); - } - if (request.getSentiment().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "sentiment", request.getSentiment().get(), false); - } - if (request.getSummarize().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "summarize", request.getSummarize().get(), false); - } - if (request.getTopics().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "topics", request.getTopics().get(), false); - } - if (request.getCustomTopicMode().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "custom_topic_mode", request.getCustomTopicMode().get(), false); - } - if (request.getIntents().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "intents", request.getIntents().get(), false); - } - if (request.getCustomIntentMode().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "custom_intent_mode", request.getCustomIntentMode().get(), false); - } - if (request.getLanguage().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "language", request.getLanguage().get(), false); - } - if (request.getTag().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "tag", request.getTag().get(), true); - } - if (request.getCustomTopic().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "custom_topic", request.getCustomTopic().get(), true); - } - if (request.getCustomIntent().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "custom_intent", request.getCustomIntent().get(), true); - } - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - RequestBody body; - try { - body = - RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), - MediaTypes.APPLICATION_JSON); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = - new Request.Builder() - .url(httpUrl.build()) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .addHeader("Accept", "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(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ReadV1Response.class), - response); - } - try { - if (response.code() == 400) { - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new DeepgramApiApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (IOException e) { - throw new DeepgramApiException("Network error executing HTTP request", e); - } - } -} diff --git a/src/main/java/resources/read/v1/text/TextClient.java b/src/main/java/resources/read/v1/text/TextClient.java deleted file mode 100644 index c4bc612..0000000 --- a/src/main/java/resources/read/v1/text/TextClient.java +++ /dev/null @@ -1,44 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.read.v1.text; - -import core.ClientOptions; -import core.RequestOptions; -import resources.read.v1.text.requests.TextAnalyzeRequest; -import types.ReadV1Request; -import types.ReadV1Response; - -public class TextClient { - protected final ClientOptions clientOptions; - - private final RawTextClient rawClient; - - public TextClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new RawTextClient(clientOptions); - } - - /** Get responses with HTTP metadata like headers */ - public RawTextClient withRawResponse() { - return this.rawClient; - } - - /** Analyze text content using Deepgrams text analysis API */ - public ReadV1Response analyze(ReadV1Request body) { - return this.rawClient.analyze(body).body(); - } - - /** Analyze text content using Deepgrams text analysis API */ - public ReadV1Response analyze(ReadV1Request body, RequestOptions requestOptions) { - return this.rawClient.analyze(body, requestOptions).body(); - } - - /** Analyze text content using Deepgrams text analysis API */ - public ReadV1Response analyze(TextAnalyzeRequest request) { - return this.rawClient.analyze(request).body(); - } - - /** Analyze text content using Deepgrams text analysis API */ - public ReadV1Response analyze(TextAnalyzeRequest request, RequestOptions requestOptions) { - return this.rawClient.analyze(request, requestOptions).body(); - } -} diff --git a/src/main/java/resources/read/v1/text/requests/TextAnalyzeRequest.java b/src/main/java/resources/read/v1/text/requests/TextAnalyzeRequest.java deleted file mode 100644 index 16823fa..0000000 --- a/src/main/java/resources/read/v1/text/requests/TextAnalyzeRequest.java +++ /dev/null @@ -1,720 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.read.v1.text.requests; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.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 core.ObjectMappers; -import java.util.Collections; -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; -import resources.read.v1.text.types.TextAnalyzeRequestCallbackMethod; -import resources.read.v1.text.types.TextAnalyzeRequestCustomIntentMode; -import resources.read.v1.text.types.TextAnalyzeRequestCustomTopicMode; -import resources.read.v1.text.types.TextAnalyzeRequestSummarize; -import types.ReadV1Request; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = TextAnalyzeRequest.Builder.class) -public final class TextAnalyzeRequest { - private final Optional> tag; - - private final Optional> customTopic; - - private final Optional> customIntent; - - private final Optional callback; - - private final Optional callbackMethod; - - private final Optional sentiment; - - private final Optional summarize; - - private final Optional topics; - - private final Optional customTopicMode; - - private final Optional intents; - - private final Optional customIntentMode; - - private final Optional language; - - private final ReadV1Request body; - - private final Map additionalProperties; - - private TextAnalyzeRequest( - Optional> tag, - Optional> customTopic, - Optional> customIntent, - Optional callback, - Optional callbackMethod, - Optional sentiment, - Optional summarize, - Optional topics, - Optional customTopicMode, - Optional intents, - Optional customIntentMode, - Optional language, - ReadV1Request body, - Map additionalProperties) { - this.tag = tag; - this.customTopic = customTopic; - this.customIntent = customIntent; - this.callback = callback; - this.callbackMethod = callbackMethod; - this.sentiment = sentiment; - this.summarize = summarize; - this.topics = topics; - this.customTopicMode = customTopicMode; - this.intents = intents; - this.customIntentMode = customIntentMode; - this.language = language; - this.body = body; - this.additionalProperties = additionalProperties; - } - - /** - * @return Label your requests for the purpose of identification during usage reporting - */ - @JsonIgnore - public Optional> getTag() { - return tag; - } - - /** - * @return Custom topics you want the model to detect within your input audio or text if present - * Submit up to 100. - */ - @JsonIgnore - public Optional> getCustomTopic() { - return customTopic; - } - - /** - * @return Custom intents you want the model to detect within your input audio if present - */ - @JsonIgnore - public Optional> getCustomIntent() { - return customIntent; - } - - /** - * @return URL to which we'll make the callback request - */ - @JsonIgnore - public Optional getCallback() { - return callback; - } - - /** - * @return HTTP method by which the callback request will be made - */ - @JsonIgnore - public Optional getCallbackMethod() { - return callbackMethod; - } - - /** - * @return Recognizes the sentiment throughout a transcript or text - */ - @JsonIgnore - public Optional getSentiment() { - return sentiment; - } - - /** - * @return Summarize content. For Listen API, supports string version option. For Read API, - * accepts boolean only. - */ - @JsonIgnore - public Optional getSummarize() { - return summarize; - } - - /** - * @return Detect topics throughout a transcript or text - */ - @JsonIgnore - public Optional getTopics() { - return topics; - } - - /** - * @return Sets how the model will interpret strings submitted to the custom_topic - * param. When strict, the model will only return topics submitted using the - * custom_topic param. When extended, the model will return its own - * detected topics in addition to those submitted using the custom_topic param - */ - @JsonIgnore - public Optional getCustomTopicMode() { - return customTopicMode; - } - - /** - * @return Recognizes speaker intent throughout a transcript or text - */ - @JsonIgnore - public Optional getIntents() { - return intents; - } - - /** - * @return Sets how the model will interpret intents submitted to the custom_intent - * param. When strict, the model will only return intents submitted using the - * custom_intent param. When extended, the model will return its own - * detected intents in the custom_intent param. - */ - @JsonIgnore - public Optional getCustomIntentMode() { - return customIntentMode; - } - - /** - * @return The BCP-47 language tag that hints at - * the primary spoken language. Depending on the Model and API endpoint you choose only - * certain languages are available - */ - @JsonIgnore - public Optional getLanguage() { - return language; - } - - @JsonProperty("body") - public ReadV1Request getBody() { - return body; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof TextAnalyzeRequest && equalTo((TextAnalyzeRequest) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(TextAnalyzeRequest other) { - return tag.equals(other.tag) - && customTopic.equals(other.customTopic) - && customIntent.equals(other.customIntent) - && callback.equals(other.callback) - && callbackMethod.equals(other.callbackMethod) - && sentiment.equals(other.sentiment) - && summarize.equals(other.summarize) - && topics.equals(other.topics) - && customTopicMode.equals(other.customTopicMode) - && intents.equals(other.intents) - && customIntentMode.equals(other.customIntentMode) - && language.equals(other.language) - && body.equals(other.body); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.tag, - this.customTopic, - this.customIntent, - this.callback, - this.callbackMethod, - this.sentiment, - this.summarize, - this.topics, - this.customTopicMode, - this.intents, - this.customIntentMode, - this.language, - this.body); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static BodyStage builder() { - return new Builder(); - } - - public interface BodyStage { - _FinalStage body(@NotNull ReadV1Request body); - - Builder from(TextAnalyzeRequest other); - } - - public interface _FinalStage { - TextAnalyzeRequest build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** Label your requests for the purpose of identification during usage reporting */ - _FinalStage tag(Optional> tag); - - _FinalStage tag(List tag); - - _FinalStage tag(String tag); - - /** - * Custom topics you want the model to detect within your input audio or text if present Submit - * up to 100. - */ - _FinalStage customTopic(Optional> customTopic); - - _FinalStage customTopic(List customTopic); - - _FinalStage customTopic(String customTopic); - - /** Custom intents you want the model to detect within your input audio if present */ - _FinalStage customIntent(Optional> customIntent); - - _FinalStage customIntent(List customIntent); - - _FinalStage customIntent(String customIntent); - - /** URL to which we'll make the callback request */ - _FinalStage callback(Optional callback); - - _FinalStage callback(String callback); - - /** HTTP method by which the callback request will be made */ - _FinalStage callbackMethod(Optional callbackMethod); - - _FinalStage callbackMethod(TextAnalyzeRequestCallbackMethod callbackMethod); - - /** Recognizes the sentiment throughout a transcript or text */ - _FinalStage sentiment(Optional sentiment); - - _FinalStage sentiment(Boolean sentiment); - - /** - * Summarize content. For Listen API, supports string version option. For Read API, accepts - * boolean only. - */ - _FinalStage summarize(Optional summarize); - - _FinalStage summarize(TextAnalyzeRequestSummarize summarize); - - /** Detect topics throughout a transcript or text */ - _FinalStage topics(Optional topics); - - _FinalStage topics(Boolean topics); - - /** - * Sets how the model will interpret strings submitted to the custom_topic param. - * When strict, the model will only return topics submitted using the - * custom_topic param. When extended, the model will return its own detected - * topics in addition to those submitted using the custom_topic param - */ - _FinalStage customTopicMode(Optional customTopicMode); - - _FinalStage customTopicMode(TextAnalyzeRequestCustomTopicMode customTopicMode); - - /** Recognizes speaker intent throughout a transcript or text */ - _FinalStage intents(Optional intents); - - _FinalStage intents(Boolean intents); - - /** - * Sets how the model will interpret intents submitted to the custom_intent param. - * When strict, the model will only return intents submitted using the - * custom_intent param. When extended, the model will return its own - * detected intents in the custom_intent param. - */ - _FinalStage customIntentMode(Optional customIntentMode); - - _FinalStage customIntentMode(TextAnalyzeRequestCustomIntentMode customIntentMode); - - /** - * The BCP-47 language tag that hints at the - * primary spoken language. Depending on the Model and API endpoint you choose only certain - * languages are available - */ - _FinalStage language(Optional language); - - _FinalStage language(String language); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements BodyStage, _FinalStage { - private ReadV1Request body; - - private Optional language = Optional.empty(); - - private Optional customIntentMode = Optional.empty(); - - private Optional intents = Optional.empty(); - - private Optional customTopicMode = Optional.empty(); - - private Optional topics = Optional.empty(); - - private Optional summarize = Optional.empty(); - - private Optional sentiment = Optional.empty(); - - private Optional callbackMethod = Optional.empty(); - - private Optional callback = Optional.empty(); - - private Optional> customIntent = Optional.empty(); - - private Optional> customTopic = Optional.empty(); - - private Optional> tag = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(TextAnalyzeRequest other) { - tag(other.getTag()); - customTopic(other.getCustomTopic()); - customIntent(other.getCustomIntent()); - callback(other.getCallback()); - callbackMethod(other.getCallbackMethod()); - sentiment(other.getSentiment()); - summarize(other.getSummarize()); - topics(other.getTopics()); - customTopicMode(other.getCustomTopicMode()); - intents(other.getIntents()); - customIntentMode(other.getCustomIntentMode()); - language(other.getLanguage()); - body(other.getBody()); - return this; - } - - @java.lang.Override - @JsonSetter("body") - public _FinalStage body(@NotNull ReadV1Request body) { - this.body = Objects.requireNonNull(body, "body must not be null"); - return this; - } - - /** - * The BCP-47 language tag that hints at the - * primary spoken language. Depending on the Model and API endpoint you choose only certain - * languages are available - * - * @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; - } - - /** - * The BCP-47 language tag that hints at the - * primary spoken language. Depending on the Model and API endpoint you choose only certain - * languages are available - */ - @java.lang.Override - @JsonSetter(value = "language", nulls = Nulls.SKIP) - public _FinalStage language(Optional language) { - this.language = language; - return this; - } - - /** - * Sets how the model will interpret intents submitted to the custom_intent param. - * When strict, the model will only return intents submitted using the - * custom_intent param. When extended, the model will return its own - * detected intents in the custom_intent param. - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage customIntentMode(TextAnalyzeRequestCustomIntentMode customIntentMode) { - this.customIntentMode = Optional.ofNullable(customIntentMode); - return this; - } - - /** - * Sets how the model will interpret intents submitted to the custom_intent param. - * When strict, the model will only return intents submitted using the - * custom_intent param. When extended, the model will return its own - * detected intents in the custom_intent param. - */ - @java.lang.Override - @JsonSetter(value = "custom_intent_mode", nulls = Nulls.SKIP) - public _FinalStage customIntentMode( - Optional customIntentMode) { - this.customIntentMode = customIntentMode; - return this; - } - - /** - * Recognizes speaker intent throughout a transcript or text - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage intents(Boolean intents) { - this.intents = Optional.ofNullable(intents); - return this; - } - - /** Recognizes speaker intent throughout a transcript or text */ - @java.lang.Override - @JsonSetter(value = "intents", nulls = Nulls.SKIP) - public _FinalStage intents(Optional intents) { - this.intents = intents; - return this; - } - - /** - * Sets how the model will interpret strings submitted to the custom_topic param. - * When strict, the model will only return topics submitted using the - * custom_topic param. When extended, the model will return its own detected - * topics in addition to those submitted using the custom_topic param - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage customTopicMode(TextAnalyzeRequestCustomTopicMode customTopicMode) { - this.customTopicMode = Optional.ofNullable(customTopicMode); - return this; - } - - /** - * Sets how the model will interpret strings submitted to the custom_topic param. - * When strict, the model will only return topics submitted using the - * custom_topic param. When extended, the model will return its own detected - * topics in addition to those submitted using the custom_topic param - */ - @java.lang.Override - @JsonSetter(value = "custom_topic_mode", nulls = Nulls.SKIP) - public _FinalStage customTopicMode( - Optional customTopicMode) { - this.customTopicMode = customTopicMode; - return this; - } - - /** - * Detect topics throughout a transcript or text - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage topics(Boolean topics) { - this.topics = Optional.ofNullable(topics); - return this; - } - - /** Detect topics throughout a transcript or text */ - @java.lang.Override - @JsonSetter(value = "topics", nulls = Nulls.SKIP) - public _FinalStage topics(Optional topics) { - this.topics = topics; - return this; - } - - /** - * Summarize content. For Listen API, supports string version option. For Read API, accepts - * boolean only. - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage summarize(TextAnalyzeRequestSummarize summarize) { - this.summarize = Optional.ofNullable(summarize); - return this; - } - - /** - * Summarize content. For Listen API, supports string version option. For Read API, accepts - * boolean only. - */ - @java.lang.Override - @JsonSetter(value = "summarize", nulls = Nulls.SKIP) - public _FinalStage summarize(Optional summarize) { - this.summarize = summarize; - return this; - } - - /** - * Recognizes the sentiment throughout a transcript or text - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage sentiment(Boolean sentiment) { - this.sentiment = Optional.ofNullable(sentiment); - return this; - } - - /** Recognizes the sentiment throughout a transcript or text */ - @java.lang.Override - @JsonSetter(value = "sentiment", nulls = Nulls.SKIP) - public _FinalStage sentiment(Optional sentiment) { - this.sentiment = sentiment; - return this; - } - - /** - * HTTP method by which the callback request will be made - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage callbackMethod(TextAnalyzeRequestCallbackMethod callbackMethod) { - this.callbackMethod = Optional.ofNullable(callbackMethod); - return this; - } - - /** HTTP method by which the callback request will be made */ - @java.lang.Override - @JsonSetter(value = "callback_method", nulls = Nulls.SKIP) - public _FinalStage callbackMethod(Optional callbackMethod) { - this.callbackMethod = callbackMethod; - return this; - } - - /** - * URL to which we'll make the callback request - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage callback(String callback) { - this.callback = Optional.ofNullable(callback); - return this; - } - - /** URL to which we'll make the callback request */ - @java.lang.Override - @JsonSetter(value = "callback", nulls = Nulls.SKIP) - public _FinalStage callback(Optional callback) { - this.callback = callback; - return this; - } - - @java.lang.Override - public _FinalStage customIntent(String customIntent) { - this.customIntent = Optional.of(Collections.singletonList(customIntent)); - return this; - } - - /** - * Custom intents you want the model to detect within your input audio if present - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage customIntent(List customIntent) { - this.customIntent = Optional.ofNullable(customIntent); - return this; - } - - /** Custom intents you want the model to detect within your input audio if present */ - @java.lang.Override - @JsonSetter(value = "custom_intent", nulls = Nulls.SKIP) - public _FinalStage customIntent(Optional> customIntent) { - this.customIntent = customIntent; - return this; - } - - @java.lang.Override - public _FinalStage customTopic(String customTopic) { - this.customTopic = Optional.of(Collections.singletonList(customTopic)); - return this; - } - - /** - * Custom topics you want the model to detect within your input audio or text if present Submit - * up to 100. - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage customTopic(List customTopic) { - this.customTopic = Optional.ofNullable(customTopic); - return this; - } - - /** - * Custom topics you want the model to detect within your input audio or text if present Submit - * up to 100. - */ - @java.lang.Override - @JsonSetter(value = "custom_topic", nulls = Nulls.SKIP) - public _FinalStage customTopic(Optional> customTopic) { - this.customTopic = customTopic; - return this; - } - - @java.lang.Override - public _FinalStage tag(String tag) { - this.tag = Optional.of(Collections.singletonList(tag)); - return this; - } - - /** - * Label your requests for the purpose of identification during usage reporting - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage tag(List tag) { - this.tag = Optional.ofNullable(tag); - return this; - } - - /** Label your requests for the purpose of identification during usage reporting */ - @java.lang.Override - @JsonSetter(value = "tag", nulls = Nulls.SKIP) - public _FinalStage tag(Optional> tag) { - this.tag = tag; - return this; - } - - @java.lang.Override - public TextAnalyzeRequest build() { - return new TextAnalyzeRequest( - tag, - customTopic, - customIntent, - callback, - callbackMethod, - sentiment, - summarize, - topics, - customTopicMode, - intents, - customIntentMode, - language, - body, - additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/read/v1/text/types/TextAnalyzeRequestCallbackMethod.java b/src/main/java/resources/read/v1/text/types/TextAnalyzeRequestCallbackMethod.java deleted file mode 100644 index 16a862c..0000000 --- a/src/main/java/resources/read/v1/text/types/TextAnalyzeRequestCallbackMethod.java +++ /dev/null @@ -1,84 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.read.v1.text.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class TextAnalyzeRequestCallbackMethod { - public static final TextAnalyzeRequestCallbackMethod PUT = - new TextAnalyzeRequestCallbackMethod(Value.PUT, "PUT"); - - public static final TextAnalyzeRequestCallbackMethod POST = - new TextAnalyzeRequestCallbackMethod(Value.POST, "POST"); - - private final Value value; - - private final String string; - - TextAnalyzeRequestCallbackMethod(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof TextAnalyzeRequestCallbackMethod - && this.string.equals(((TextAnalyzeRequestCallbackMethod) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case PUT: - return visitor.visitPut(); - case POST: - return visitor.visitPost(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static TextAnalyzeRequestCallbackMethod valueOf(String value) { - switch (value) { - case "PUT": - return PUT; - case "POST": - return POST; - default: - return new TextAnalyzeRequestCallbackMethod(Value.UNKNOWN, value); - } - } - - public enum Value { - POST, - - PUT, - - UNKNOWN - } - - public interface Visitor { - T visitPost(); - - T visitPut(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/resources/read/v1/text/types/TextAnalyzeRequestCustomIntentMode.java b/src/main/java/resources/read/v1/text/types/TextAnalyzeRequestCustomIntentMode.java deleted file mode 100644 index 0f0a1ca..0000000 --- a/src/main/java/resources/read/v1/text/types/TextAnalyzeRequestCustomIntentMode.java +++ /dev/null @@ -1,84 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.read.v1.text.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class TextAnalyzeRequestCustomIntentMode { - public static final TextAnalyzeRequestCustomIntentMode STRICT = - new TextAnalyzeRequestCustomIntentMode(Value.STRICT, "strict"); - - public static final TextAnalyzeRequestCustomIntentMode EXTENDED = - new TextAnalyzeRequestCustomIntentMode(Value.EXTENDED, "extended"); - - private final Value value; - - private final String string; - - TextAnalyzeRequestCustomIntentMode(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof TextAnalyzeRequestCustomIntentMode - && this.string.equals(((TextAnalyzeRequestCustomIntentMode) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case STRICT: - return visitor.visitStrict(); - case EXTENDED: - return visitor.visitExtended(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static TextAnalyzeRequestCustomIntentMode valueOf(String value) { - switch (value) { - case "strict": - return STRICT; - case "extended": - return EXTENDED; - default: - return new TextAnalyzeRequestCustomIntentMode(Value.UNKNOWN, value); - } - } - - public enum Value { - EXTENDED, - - STRICT, - - UNKNOWN - } - - public interface Visitor { - T visitExtended(); - - T visitStrict(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/resources/read/v1/text/types/TextAnalyzeRequestCustomTopicMode.java b/src/main/java/resources/read/v1/text/types/TextAnalyzeRequestCustomTopicMode.java deleted file mode 100644 index 7a1423c..0000000 --- a/src/main/java/resources/read/v1/text/types/TextAnalyzeRequestCustomTopicMode.java +++ /dev/null @@ -1,84 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.read.v1.text.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class TextAnalyzeRequestCustomTopicMode { - public static final TextAnalyzeRequestCustomTopicMode STRICT = - new TextAnalyzeRequestCustomTopicMode(Value.STRICT, "strict"); - - public static final TextAnalyzeRequestCustomTopicMode EXTENDED = - new TextAnalyzeRequestCustomTopicMode(Value.EXTENDED, "extended"); - - private final Value value; - - private final String string; - - TextAnalyzeRequestCustomTopicMode(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof TextAnalyzeRequestCustomTopicMode - && this.string.equals(((TextAnalyzeRequestCustomTopicMode) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case STRICT: - return visitor.visitStrict(); - case EXTENDED: - return visitor.visitExtended(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static TextAnalyzeRequestCustomTopicMode valueOf(String value) { - switch (value) { - case "strict": - return STRICT; - case "extended": - return EXTENDED; - default: - return new TextAnalyzeRequestCustomTopicMode(Value.UNKNOWN, value); - } - } - - public enum Value { - EXTENDED, - - STRICT, - - UNKNOWN - } - - public interface Visitor { - T visitExtended(); - - T visitStrict(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/resources/read/v1/text/types/TextAnalyzeRequestSummarize.java b/src/main/java/resources/read/v1/text/types/TextAnalyzeRequestSummarize.java deleted file mode 100644 index 0863d7e..0000000 --- a/src/main/java/resources/read/v1/text/types/TextAnalyzeRequestSummarize.java +++ /dev/null @@ -1,73 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.read.v1.text.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class TextAnalyzeRequestSummarize { - public static final TextAnalyzeRequestSummarize V2 = - new TextAnalyzeRequestSummarize(Value.V2, "v2"); - - private final Value value; - - private final String string; - - TextAnalyzeRequestSummarize(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof TextAnalyzeRequestSummarize - && this.string.equals(((TextAnalyzeRequestSummarize) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case V2: - return visitor.visitV2(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static TextAnalyzeRequestSummarize valueOf(String value) { - switch (value) { - case "v2": - return V2; - default: - return new TextAnalyzeRequestSummarize(Value.UNKNOWN, value); - } - } - - public enum Value { - V2, - - UNKNOWN - } - - public interface Visitor { - T visitV2(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/resources/selfhosted/AsyncSelfHostedClient.java b/src/main/java/resources/selfhosted/AsyncSelfHostedClient.java deleted file mode 100644 index e8442cc..0000000 --- a/src/main/java/resources/selfhosted/AsyncSelfHostedClient.java +++ /dev/null @@ -1,22 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.selfhosted; - -import core.ClientOptions; -import core.Suppliers; -import java.util.function.Supplier; -import resources.selfhosted.v1.AsyncV1Client; - -public class AsyncSelfHostedClient { - protected final ClientOptions clientOptions; - - protected final Supplier v1Client; - - public AsyncSelfHostedClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.v1Client = Suppliers.memoize(() -> new AsyncV1Client(clientOptions)); - } - - public AsyncV1Client v1() { - return this.v1Client.get(); - } -} diff --git a/src/main/java/resources/selfhosted/SelfHostedClient.java b/src/main/java/resources/selfhosted/SelfHostedClient.java deleted file mode 100644 index 8274c47..0000000 --- a/src/main/java/resources/selfhosted/SelfHostedClient.java +++ /dev/null @@ -1,22 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.selfhosted; - -import core.ClientOptions; -import core.Suppliers; -import java.util.function.Supplier; -import resources.selfhosted.v1.V1Client; - -public class SelfHostedClient { - protected final ClientOptions clientOptions; - - protected final Supplier v1Client; - - public SelfHostedClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.v1Client = Suppliers.memoize(() -> new V1Client(clientOptions)); - } - - public V1Client v1() { - return this.v1Client.get(); - } -} diff --git a/src/main/java/resources/selfhosted/v1/AsyncV1Client.java b/src/main/java/resources/selfhosted/v1/AsyncV1Client.java deleted file mode 100644 index 71901c7..0000000 --- a/src/main/java/resources/selfhosted/v1/AsyncV1Client.java +++ /dev/null @@ -1,23 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.selfhosted.v1; - -import core.ClientOptions; -import core.Suppliers; -import java.util.function.Supplier; -import resources.selfhosted.v1.distributioncredentials.AsyncDistributionCredentialsClient; - -public class AsyncV1Client { - protected final ClientOptions clientOptions; - - protected final Supplier distributionCredentialsClient; - - public AsyncV1Client(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.distributionCredentialsClient = - Suppliers.memoize(() -> new AsyncDistributionCredentialsClient(clientOptions)); - } - - public AsyncDistributionCredentialsClient distributionCredentials() { - return this.distributionCredentialsClient.get(); - } -} diff --git a/src/main/java/resources/selfhosted/v1/V1Client.java b/src/main/java/resources/selfhosted/v1/V1Client.java deleted file mode 100644 index cf1c12d..0000000 --- a/src/main/java/resources/selfhosted/v1/V1Client.java +++ /dev/null @@ -1,23 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.selfhosted.v1; - -import core.ClientOptions; -import core.Suppliers; -import java.util.function.Supplier; -import resources.selfhosted.v1.distributioncredentials.DistributionCredentialsClient; - -public class V1Client { - protected final ClientOptions clientOptions; - - protected final Supplier distributionCredentialsClient; - - public V1Client(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.distributionCredentialsClient = - Suppliers.memoize(() -> new DistributionCredentialsClient(clientOptions)); - } - - public DistributionCredentialsClient distributionCredentials() { - return this.distributionCredentialsClient.get(); - } -} diff --git a/src/main/java/resources/selfhosted/v1/distributioncredentials/AsyncDistributionCredentialsClient.java b/src/main/java/resources/selfhosted/v1/distributioncredentials/AsyncDistributionCredentialsClient.java deleted file mode 100644 index 3baeaea..0000000 --- a/src/main/java/resources/selfhosted/v1/distributioncredentials/AsyncDistributionCredentialsClient.java +++ /dev/null @@ -1,97 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.selfhosted.v1.distributioncredentials; - -import core.ClientOptions; -import core.RequestOptions; -import java.util.concurrent.CompletableFuture; -import resources.selfhosted.v1.distributioncredentials.requests.CreateProjectDistributionCredentialsV1Request; -import types.CreateProjectDistributionCredentialsV1Response; -import types.GetProjectDistributionCredentialsV1Response; -import types.ListProjectDistributionCredentialsV1Response; - -public class AsyncDistributionCredentialsClient { - protected final ClientOptions clientOptions; - - private final AsyncRawDistributionCredentialsClient rawClient; - - public AsyncDistributionCredentialsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new AsyncRawDistributionCredentialsClient(clientOptions); - } - - /** Get responses with HTTP metadata like headers */ - public AsyncRawDistributionCredentialsClient withRawResponse() { - return this.rawClient; - } - - /** Lists sets of distribution credentials for the specified project */ - public CompletableFuture list(String projectId) { - return this.rawClient.list(projectId).thenApply(response -> response.body()); - } - - /** Lists sets of distribution credentials for the specified project */ - public CompletableFuture list( - String projectId, RequestOptions requestOptions) { - return this.rawClient.list(projectId, requestOptions).thenApply(response -> response.body()); - } - - /** Creates a set of distribution credentials for the specified project */ - public CompletableFuture create( - String projectId) { - return this.rawClient.create(projectId).thenApply(response -> response.body()); - } - - /** Creates a set of distribution credentials for the specified project */ - public CompletableFuture create( - String projectId, RequestOptions requestOptions) { - return this.rawClient.create(projectId, requestOptions).thenApply(response -> response.body()); - } - - /** Creates a set of distribution credentials for the specified project */ - public CompletableFuture create( - String projectId, CreateProjectDistributionCredentialsV1Request request) { - return this.rawClient.create(projectId, request).thenApply(response -> response.body()); - } - - /** Creates a set of distribution credentials for the specified project */ - public CompletableFuture create( - String projectId, - CreateProjectDistributionCredentialsV1Request request, - RequestOptions requestOptions) { - return this.rawClient - .create(projectId, request, requestOptions) - .thenApply(response -> response.body()); - } - - /** Returns a set of distribution credentials for the specified project */ - public CompletableFuture get( - String projectId, String distributionCredentialsId) { - return this.rawClient - .get(projectId, distributionCredentialsId) - .thenApply(response -> response.body()); - } - - /** Returns a set of distribution credentials for the specified project */ - public CompletableFuture get( - String projectId, String distributionCredentialsId, RequestOptions requestOptions) { - return this.rawClient - .get(projectId, distributionCredentialsId, requestOptions) - .thenApply(response -> response.body()); - } - - /** Deletes a set of distribution credentials for the specified project */ - public CompletableFuture delete( - String projectId, String distributionCredentialsId) { - return this.rawClient - .delete(projectId, distributionCredentialsId) - .thenApply(response -> response.body()); - } - - /** Deletes a set of distribution credentials for the specified project */ - public CompletableFuture delete( - String projectId, String distributionCredentialsId, RequestOptions requestOptions) { - return this.rawClient - .delete(projectId, distributionCredentialsId, requestOptions) - .thenApply(response -> response.body()); - } -} diff --git a/src/main/java/resources/selfhosted/v1/distributioncredentials/AsyncRawDistributionCredentialsClient.java b/src/main/java/resources/selfhosted/v1/distributioncredentials/AsyncRawDistributionCredentialsClient.java deleted file mode 100644 index 3a77cd6..0000000 --- a/src/main/java/resources/selfhosted/v1/distributioncredentials/AsyncRawDistributionCredentialsClient.java +++ /dev/null @@ -1,424 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.selfhosted.v1.distributioncredentials; - -import com.fasterxml.jackson.core.JsonProcessingException; -import core.ClientOptions; -import core.DeepgramApiApiException; -import core.DeepgramApiException; -import core.DeepgramApiHttpResponse; -import core.MediaTypes; -import core.ObjectMappers; -import core.QueryStringMapper; -import core.RequestOptions; -import errors.BadRequestError; -import java.io.IOException; -import java.util.concurrent.CompletableFuture; -import okhttp3.Call; -import okhttp3.Callback; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; -import okhttp3.ResponseBody; -import org.jetbrains.annotations.NotNull; -import resources.selfhosted.v1.distributioncredentials.requests.CreateProjectDistributionCredentialsV1Request; -import types.CreateProjectDistributionCredentialsV1Response; -import types.GetProjectDistributionCredentialsV1Response; -import types.ListProjectDistributionCredentialsV1Response; - -public class AsyncRawDistributionCredentialsClient { - protected final ClientOptions clientOptions; - - public AsyncRawDistributionCredentialsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** Lists sets of distribution credentials for the specified project */ - public CompletableFuture> - list(String projectId) { - return list(projectId, null); - } - - /** Lists sets of distribution credentials for the specified project */ - public CompletableFuture> - list(String projectId, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("self-hosted/distribution") - .addPathSegments("credentials"); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> - future = new CompletableFuture<>(); - client - .newCall(okhttpRequest) - .enqueue( - new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) - throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete( - new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, - ListProjectDistributionCredentialsV1Response.class), - response)); - return; - } - try { - if (response.code() == 400) { - future.completeExceptionally( - new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally( - new DeepgramApiApiException( - "Error with status code " + response.code(), - response.code(), - errorBody, - response)); - return; - } catch (IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - }); - return future; - } - - /** Creates a set of distribution credentials for the specified project */ - public CompletableFuture> - create(String projectId) { - return create(projectId, CreateProjectDistributionCredentialsV1Request.builder().build()); - } - - /** Creates a set of distribution credentials for the specified project */ - public CompletableFuture> - create(String projectId, RequestOptions requestOptions) { - return create( - projectId, CreateProjectDistributionCredentialsV1Request.builder().build(), requestOptions); - } - - /** Creates a set of distribution credentials for the specified project */ - public CompletableFuture> - create(String projectId, CreateProjectDistributionCredentialsV1Request request) { - return create(projectId, request, null); - } - - /** Creates a set of distribution credentials for the specified project */ - public CompletableFuture> - create( - String projectId, - CreateProjectDistributionCredentialsV1Request request, - RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("self-hosted/distribution") - .addPathSegments("credentials"); - if (request.getProvider().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "provider", request.getProvider().get(), false); - } - if (request.getScopes().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "scopes", request.getScopes().get(), true); - } - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - RequestBody body; - try { - body = - RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = - new Request.Builder() - .url(httpUrl.build()) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .addHeader("Accept", "application/json"); - Request okhttpRequest = _requestBuilder.build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> - future = new CompletableFuture<>(); - client - .newCall(okhttpRequest) - .enqueue( - new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) - throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete( - new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, - CreateProjectDistributionCredentialsV1Response.class), - response)); - return; - } - try { - if (response.code() == 400) { - future.completeExceptionally( - new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally( - new DeepgramApiApiException( - "Error with status code " + response.code(), - response.code(), - errorBody, - response)); - return; - } catch (IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - }); - return future; - } - - /** Returns a set of distribution credentials for the specified project */ - public CompletableFuture> - get(String projectId, String distributionCredentialsId) { - return get(projectId, distributionCredentialsId, null); - } - - /** Returns a set of distribution credentials for the specified project */ - public CompletableFuture> - get(String projectId, String distributionCredentialsId, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("self-hosted/distribution/credentials") - .addPathSegment(distributionCredentialsId); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = - new CompletableFuture<>(); - client - .newCall(okhttpRequest) - .enqueue( - new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) - throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete( - new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, - GetProjectDistributionCredentialsV1Response.class), - response)); - return; - } - try { - if (response.code() == 400) { - future.completeExceptionally( - new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally( - new DeepgramApiApiException( - "Error with status code " + response.code(), - response.code(), - errorBody, - response)); - return; - } catch (IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - }); - return future; - } - - /** Deletes a set of distribution credentials for the specified project */ - public CompletableFuture> - delete(String projectId, String distributionCredentialsId) { - return delete(projectId, distributionCredentialsId, null); - } - - /** Deletes a set of distribution credentials for the specified project */ - public CompletableFuture> - delete(String projectId, String distributionCredentialsId, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("self-hosted/distribution/credentials") - .addPathSegment(distributionCredentialsId); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = - new CompletableFuture<>(); - client - .newCall(okhttpRequest) - .enqueue( - new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) - throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete( - new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, - GetProjectDistributionCredentialsV1Response.class), - response)); - return; - } - try { - if (response.code() == 400) { - future.completeExceptionally( - new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally( - new DeepgramApiApiException( - "Error with status code " + response.code(), - response.code(), - errorBody, - response)); - return; - } catch (IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - }); - return future; - } -} diff --git a/src/main/java/resources/selfhosted/v1/distributioncredentials/DistributionCredentialsClient.java b/src/main/java/resources/selfhosted/v1/distributioncredentials/DistributionCredentialsClient.java deleted file mode 100644 index e879d4e..0000000 --- a/src/main/java/resources/selfhosted/v1/distributioncredentials/DistributionCredentialsClient.java +++ /dev/null @@ -1,85 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.selfhosted.v1.distributioncredentials; - -import core.ClientOptions; -import core.RequestOptions; -import resources.selfhosted.v1.distributioncredentials.requests.CreateProjectDistributionCredentialsV1Request; -import types.CreateProjectDistributionCredentialsV1Response; -import types.GetProjectDistributionCredentialsV1Response; -import types.ListProjectDistributionCredentialsV1Response; - -public class DistributionCredentialsClient { - protected final ClientOptions clientOptions; - - private final RawDistributionCredentialsClient rawClient; - - public DistributionCredentialsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new RawDistributionCredentialsClient(clientOptions); - } - - /** Get responses with HTTP metadata like headers */ - public RawDistributionCredentialsClient withRawResponse() { - return this.rawClient; - } - - /** Lists sets of distribution credentials for the specified project */ - public ListProjectDistributionCredentialsV1Response list(String projectId) { - return this.rawClient.list(projectId).body(); - } - - /** Lists sets of distribution credentials for the specified project */ - public ListProjectDistributionCredentialsV1Response list( - String projectId, RequestOptions requestOptions) { - return this.rawClient.list(projectId, requestOptions).body(); - } - - /** Creates a set of distribution credentials for the specified project */ - public CreateProjectDistributionCredentialsV1Response create(String projectId) { - return this.rawClient.create(projectId).body(); - } - - /** Creates a set of distribution credentials for the specified project */ - public CreateProjectDistributionCredentialsV1Response create( - String projectId, RequestOptions requestOptions) { - return this.rawClient.create(projectId, requestOptions).body(); - } - - /** Creates a set of distribution credentials for the specified project */ - public CreateProjectDistributionCredentialsV1Response create( - String projectId, CreateProjectDistributionCredentialsV1Request request) { - return this.rawClient.create(projectId, request).body(); - } - - /** Creates a set of distribution credentials for the specified project */ - public CreateProjectDistributionCredentialsV1Response create( - String projectId, - CreateProjectDistributionCredentialsV1Request request, - RequestOptions requestOptions) { - return this.rawClient.create(projectId, request, requestOptions).body(); - } - - /** Returns a set of distribution credentials for the specified project */ - public GetProjectDistributionCredentialsV1Response get( - String projectId, String distributionCredentialsId) { - return this.rawClient.get(projectId, distributionCredentialsId).body(); - } - - /** Returns a set of distribution credentials for the specified project */ - public GetProjectDistributionCredentialsV1Response get( - String projectId, String distributionCredentialsId, RequestOptions requestOptions) { - return this.rawClient.get(projectId, distributionCredentialsId, requestOptions).body(); - } - - /** Deletes a set of distribution credentials for the specified project */ - public GetProjectDistributionCredentialsV1Response delete( - String projectId, String distributionCredentialsId) { - return this.rawClient.delete(projectId, distributionCredentialsId).body(); - } - - /** Deletes a set of distribution credentials for the specified project */ - public GetProjectDistributionCredentialsV1Response delete( - String projectId, String distributionCredentialsId, RequestOptions requestOptions) { - return this.rawClient.delete(projectId, distributionCredentialsId, requestOptions).body(); - } -} diff --git a/src/main/java/resources/selfhosted/v1/distributioncredentials/RawDistributionCredentialsClient.java b/src/main/java/resources/selfhosted/v1/distributioncredentials/RawDistributionCredentialsClient.java deleted file mode 100644 index b2c9dfe..0000000 --- a/src/main/java/resources/selfhosted/v1/distributioncredentials/RawDistributionCredentialsClient.java +++ /dev/null @@ -1,303 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.selfhosted.v1.distributioncredentials; - -import com.fasterxml.jackson.core.JsonProcessingException; -import core.ClientOptions; -import core.DeepgramApiApiException; -import core.DeepgramApiException; -import core.DeepgramApiHttpResponse; -import core.MediaTypes; -import core.ObjectMappers; -import core.QueryStringMapper; -import core.RequestOptions; -import errors.BadRequestError; -import java.io.IOException; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; -import okhttp3.ResponseBody; -import resources.selfhosted.v1.distributioncredentials.requests.CreateProjectDistributionCredentialsV1Request; -import types.CreateProjectDistributionCredentialsV1Response; -import types.GetProjectDistributionCredentialsV1Response; -import types.ListProjectDistributionCredentialsV1Response; - -public class RawDistributionCredentialsClient { - protected final ClientOptions clientOptions; - - public RawDistributionCredentialsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** Lists sets of distribution credentials for the specified project */ - public DeepgramApiHttpResponse list( - String projectId) { - return list(projectId, null); - } - - /** Lists sets of distribution credentials for the specified project */ - public DeepgramApiHttpResponse list( - String projectId, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("self-hosted/distribution") - .addPathSegments("credentials"); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "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(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, ListProjectDistributionCredentialsV1Response.class), - response); - } - try { - if (response.code() == 400) { - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new DeepgramApiApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (IOException e) { - throw new DeepgramApiException("Network error executing HTTP request", e); - } - } - - /** Creates a set of distribution credentials for the specified project */ - public DeepgramApiHttpResponse create( - String projectId) { - return create(projectId, CreateProjectDistributionCredentialsV1Request.builder().build()); - } - - /** Creates a set of distribution credentials for the specified project */ - public DeepgramApiHttpResponse create( - String projectId, RequestOptions requestOptions) { - return create( - projectId, CreateProjectDistributionCredentialsV1Request.builder().build(), requestOptions); - } - - /** Creates a set of distribution credentials for the specified project */ - public DeepgramApiHttpResponse create( - String projectId, CreateProjectDistributionCredentialsV1Request request) { - return create(projectId, request, null); - } - - /** Creates a set of distribution credentials for the specified project */ - public DeepgramApiHttpResponse create( - String projectId, - CreateProjectDistributionCredentialsV1Request request, - RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("self-hosted/distribution") - .addPathSegments("credentials"); - if (request.getProvider().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "provider", request.getProvider().get(), false); - } - if (request.getScopes().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "scopes", request.getScopes().get(), true); - } - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - RequestBody body; - try { - body = - RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = - new Request.Builder() - .url(httpUrl.build()) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .addHeader("Accept", "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(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, CreateProjectDistributionCredentialsV1Response.class), - response); - } - try { - if (response.code() == 400) { - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new DeepgramApiApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (IOException e) { - throw new DeepgramApiException("Network error executing HTTP request", e); - } - } - - /** Returns a set of distribution credentials for the specified project */ - public DeepgramApiHttpResponse get( - String projectId, String distributionCredentialsId) { - return get(projectId, distributionCredentialsId, null); - } - - /** Returns a set of distribution credentials for the specified project */ - public DeepgramApiHttpResponse get( - String projectId, String distributionCredentialsId, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("self-hosted/distribution/credentials") - .addPathSegment(distributionCredentialsId); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "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(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, GetProjectDistributionCredentialsV1Response.class), - response); - } - try { - if (response.code() == 400) { - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new DeepgramApiApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (IOException e) { - throw new DeepgramApiException("Network error executing HTTP request", e); - } - } - - /** Deletes a set of distribution credentials for the specified project */ - public DeepgramApiHttpResponse delete( - String projectId, String distributionCredentialsId) { - return delete(projectId, distributionCredentialsId, null); - } - - /** Deletes a set of distribution credentials for the specified project */ - public DeepgramApiHttpResponse delete( - String projectId, String distributionCredentialsId, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/projects") - .addPathSegment(projectId) - .addPathSegments("self-hosted/distribution/credentials") - .addPathSegment(distributionCredentialsId); - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - Request okhttpRequest = - new Request.Builder() - .url(httpUrl.build()) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "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(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new DeepgramApiHttpResponse<>( - ObjectMappers.JSON_MAPPER.readValue( - responseBodyString, GetProjectDistributionCredentialsV1Response.class), - response); - } - try { - if (response.code() == 400) { - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new DeepgramApiApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (IOException e) { - throw new DeepgramApiException("Network error executing HTTP request", e); - } - } -} diff --git a/src/main/java/resources/selfhosted/v1/distributioncredentials/requests/CreateProjectDistributionCredentialsV1Request.java b/src/main/java/resources/selfhosted/v1/distributioncredentials/requests/CreateProjectDistributionCredentialsV1Request.java deleted file mode 100644 index 0795e43..0000000 --- a/src/main/java/resources/selfhosted/v1/distributioncredentials/requests/CreateProjectDistributionCredentialsV1Request.java +++ /dev/null @@ -1,176 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.selfhosted.v1.distributioncredentials.requests; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.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 core.ObjectMappers; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import resources.selfhosted.v1.distributioncredentials.types.DistributionCredentialsCreateRequestScopesItem; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = CreateProjectDistributionCredentialsV1Request.Builder.class) -public final class CreateProjectDistributionCredentialsV1Request { - private final Optional> scopes; - - private final Optional provider; - - private final Optional comment; - - private final Map additionalProperties; - - private CreateProjectDistributionCredentialsV1Request( - Optional> scopes, - Optional provider, - Optional comment, - Map additionalProperties) { - this.scopes = scopes; - this.provider = provider; - this.comment = comment; - this.additionalProperties = additionalProperties; - } - - /** - * @return List of permission scopes for the credentials - */ - @JsonIgnore - public Optional> getScopes() { - return scopes; - } - - /** - * @return The provider of the distribution service - */ - @JsonIgnore - public Optional getProvider() { - return provider; - } - - /** - * @return Optional comment about the credentials - */ - @JsonProperty("comment") - public Optional getComment() { - return comment; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CreateProjectDistributionCredentialsV1Request - && equalTo((CreateProjectDistributionCredentialsV1Request) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(CreateProjectDistributionCredentialsV1Request other) { - return scopes.equals(other.scopes) - && provider.equals(other.provider) - && comment.equals(other.comment); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.scopes, this.provider, this.comment); - } - - @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> scopes = - Optional.empty(); - - private Optional provider = Optional.empty(); - - private Optional comment = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(CreateProjectDistributionCredentialsV1Request other) { - scopes(other.getScopes()); - provider(other.getProvider()); - comment(other.getComment()); - return this; - } - - /** List of permission scopes for the credentials */ - @JsonSetter(value = "scopes", nulls = Nulls.SKIP) - public Builder scopes(Optional> scopes) { - this.scopes = scopes; - return this; - } - - public Builder scopes(List scopes) { - this.scopes = Optional.ofNullable(scopes); - return this; - } - - public Builder scopes(DistributionCredentialsCreateRequestScopesItem scopes) { - this.scopes = Optional.of(Collections.singletonList(scopes)); - return this; - } - - /** The provider of the distribution service */ - @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; - } - - /** Optional comment about the credentials */ - @JsonSetter(value = "comment", nulls = Nulls.SKIP) - public Builder comment(Optional comment) { - this.comment = comment; - return this; - } - - public Builder comment(String comment) { - this.comment = Optional.ofNullable(comment); - return this; - } - - public CreateProjectDistributionCredentialsV1Request build() { - return new CreateProjectDistributionCredentialsV1Request( - scopes, provider, comment, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/selfhosted/v1/distributioncredentials/types/DistributionCredentialsCreateRequestScopesItem.java b/src/main/java/resources/selfhosted/v1/distributioncredentials/types/DistributionCredentialsCreateRequestScopesItem.java deleted file mode 100644 index ac06ad4..0000000 --- a/src/main/java/resources/selfhosted/v1/distributioncredentials/types/DistributionCredentialsCreateRequestScopesItem.java +++ /dev/null @@ -1,160 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.selfhosted.v1.distributioncredentials.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class DistributionCredentialsCreateRequestScopesItem { - public static final DistributionCredentialsCreateRequestScopesItem SELF_HOSTED_PRODUCTS = - new DistributionCredentialsCreateRequestScopesItem( - Value.SELF_HOSTED_PRODUCTS, "self-hosted:products"); - - public static final DistributionCredentialsCreateRequestScopesItem SELF_HOSTED_PRODUCT_DGTOOLS = - new DistributionCredentialsCreateRequestScopesItem( - Value.SELF_HOSTED_PRODUCT_DGTOOLS, "self-hosted:product:dgtools"); - - public static final DistributionCredentialsCreateRequestScopesItem SELF_HOSTED_PRODUCT_HOTPEPPER = - new DistributionCredentialsCreateRequestScopesItem( - Value.SELF_HOSTED_PRODUCT_HOTPEPPER, "self-hosted:product:hotpepper"); - - public static final DistributionCredentialsCreateRequestScopesItem SELF_HOSTED_PRODUCT_API = - new DistributionCredentialsCreateRequestScopesItem( - Value.SELF_HOSTED_PRODUCT_API, "self-hosted:product:api"); - - public static final DistributionCredentialsCreateRequestScopesItem SELF_HOSTED_PRODUCT_ENGINE = - new DistributionCredentialsCreateRequestScopesItem( - Value.SELF_HOSTED_PRODUCT_ENGINE, "self-hosted:product:engine"); - - public static final DistributionCredentialsCreateRequestScopesItem - SELF_HOSTED_PRODUCT_LICENSE_PROXY = - new DistributionCredentialsCreateRequestScopesItem( - Value.SELF_HOSTED_PRODUCT_LICENSE_PROXY, "self-hosted:product:license-proxy"); - - public static final DistributionCredentialsCreateRequestScopesItem SELF_HOSTED_PRODUCT_BILLING = - new DistributionCredentialsCreateRequestScopesItem( - Value.SELF_HOSTED_PRODUCT_BILLING, "self-hosted:product:billing"); - - public static final DistributionCredentialsCreateRequestScopesItem - SELF_HOSTED_PRODUCT_METRICS_SERVER = - new DistributionCredentialsCreateRequestScopesItem( - Value.SELF_HOSTED_PRODUCT_METRICS_SERVER, "self-hosted:product:metrics-server"); - - private final Value value; - - private final String string; - - DistributionCredentialsCreateRequestScopesItem(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof DistributionCredentialsCreateRequestScopesItem - && this.string.equals(((DistributionCredentialsCreateRequestScopesItem) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case SELF_HOSTED_PRODUCTS: - return visitor.visitSelfHostedProducts(); - case SELF_HOSTED_PRODUCT_DGTOOLS: - return visitor.visitSelfHostedProductDgtools(); - case SELF_HOSTED_PRODUCT_HOTPEPPER: - return visitor.visitSelfHostedProductHotpepper(); - case SELF_HOSTED_PRODUCT_API: - return visitor.visitSelfHostedProductApi(); - case SELF_HOSTED_PRODUCT_ENGINE: - return visitor.visitSelfHostedProductEngine(); - case SELF_HOSTED_PRODUCT_LICENSE_PROXY: - return visitor.visitSelfHostedProductLicenseProxy(); - case SELF_HOSTED_PRODUCT_BILLING: - return visitor.visitSelfHostedProductBilling(); - case SELF_HOSTED_PRODUCT_METRICS_SERVER: - return visitor.visitSelfHostedProductMetricsServer(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static DistributionCredentialsCreateRequestScopesItem valueOf(String value) { - switch (value) { - case "self-hosted:products": - return SELF_HOSTED_PRODUCTS; - case "self-hosted:product:dgtools": - return SELF_HOSTED_PRODUCT_DGTOOLS; - case "self-hosted:product:hotpepper": - return SELF_HOSTED_PRODUCT_HOTPEPPER; - case "self-hosted:product:api": - return SELF_HOSTED_PRODUCT_API; - case "self-hosted:product:engine": - return SELF_HOSTED_PRODUCT_ENGINE; - case "self-hosted:product:license-proxy": - return SELF_HOSTED_PRODUCT_LICENSE_PROXY; - case "self-hosted:product:billing": - return SELF_HOSTED_PRODUCT_BILLING; - case "self-hosted:product:metrics-server": - return SELF_HOSTED_PRODUCT_METRICS_SERVER; - default: - return new DistributionCredentialsCreateRequestScopesItem(Value.UNKNOWN, value); - } - } - - public enum Value { - SELF_HOSTED_PRODUCTS, - - SELF_HOSTED_PRODUCT_API, - - SELF_HOSTED_PRODUCT_ENGINE, - - SELF_HOSTED_PRODUCT_LICENSE_PROXY, - - SELF_HOSTED_PRODUCT_DGTOOLS, - - SELF_HOSTED_PRODUCT_BILLING, - - SELF_HOSTED_PRODUCT_HOTPEPPER, - - SELF_HOSTED_PRODUCT_METRICS_SERVER, - - UNKNOWN - } - - public interface Visitor { - T visitSelfHostedProducts(); - - T visitSelfHostedProductApi(); - - T visitSelfHostedProductEngine(); - - T visitSelfHostedProductLicenseProxy(); - - T visitSelfHostedProductDgtools(); - - T visitSelfHostedProductBilling(); - - T visitSelfHostedProductHotpepper(); - - T visitSelfHostedProductMetricsServer(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/resources/speak/AsyncSpeakClient.java b/src/main/java/resources/speak/AsyncSpeakClient.java deleted file mode 100644 index 2d24b99..0000000 --- a/src/main/java/resources/speak/AsyncSpeakClient.java +++ /dev/null @@ -1,22 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.speak; - -import core.ClientOptions; -import core.Suppliers; -import java.util.function.Supplier; -import resources.speak.v1.AsyncV1Client; - -public class AsyncSpeakClient { - protected final ClientOptions clientOptions; - - protected final Supplier v1Client; - - public AsyncSpeakClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.v1Client = Suppliers.memoize(() -> new AsyncV1Client(clientOptions)); - } - - public AsyncV1Client v1() { - return this.v1Client.get(); - } -} diff --git a/src/main/java/resources/speak/SpeakClient.java b/src/main/java/resources/speak/SpeakClient.java deleted file mode 100644 index e949b65..0000000 --- a/src/main/java/resources/speak/SpeakClient.java +++ /dev/null @@ -1,22 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.speak; - -import core.ClientOptions; -import core.Suppliers; -import java.util.function.Supplier; -import resources.speak.v1.V1Client; - -public class SpeakClient { - protected final ClientOptions clientOptions; - - protected final Supplier v1Client; - - public SpeakClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.v1Client = Suppliers.memoize(() -> new V1Client(clientOptions)); - } - - public V1Client v1() { - return this.v1Client.get(); - } -} diff --git a/src/main/java/resources/speak/v1/AsyncV1Client.java b/src/main/java/resources/speak/v1/AsyncV1Client.java deleted file mode 100644 index e373964..0000000 --- a/src/main/java/resources/speak/v1/AsyncV1Client.java +++ /dev/null @@ -1,28 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.speak.v1; - -import core.ClientOptions; -import core.Suppliers; -import java.util.function.Supplier; -import resources.speak.v1.audio.AsyncAudioClient; -import resources.speak.v1.websocket.V1WebSocketClient; - -public class AsyncV1Client { - protected final ClientOptions clientOptions; - - protected final Supplier audioClient; - - public AsyncV1Client(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.audioClient = Suppliers.memoize(() -> new AsyncAudioClient(clientOptions)); - } - - /** Creates a new WebSocket client for the v1 channel. */ - public V1WebSocketClient v1WebSocket() { - return new V1WebSocketClient(clientOptions); - } - - public AsyncAudioClient audio() { - return this.audioClient.get(); - } -} diff --git a/src/main/java/resources/speak/v1/V1Client.java b/src/main/java/resources/speak/v1/V1Client.java deleted file mode 100644 index 1adabf3..0000000 --- a/src/main/java/resources/speak/v1/V1Client.java +++ /dev/null @@ -1,28 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.speak.v1; - -import core.ClientOptions; -import core.Suppliers; -import java.util.function.Supplier; -import resources.speak.v1.audio.AudioClient; -import resources.speak.v1.websocket.V1WebSocketClient; - -public class V1Client { - protected final ClientOptions clientOptions; - - protected final Supplier audioClient; - - public V1Client(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.audioClient = Suppliers.memoize(() -> new AudioClient(clientOptions)); - } - - /** Creates a new WebSocket client for the v1 channel. */ - public V1WebSocketClient v1WebSocket() { - return new V1WebSocketClient(clientOptions); - } - - public AudioClient audio() { - return this.audioClient.get(); - } -} diff --git a/src/main/java/resources/speak/v1/audio/AsyncAudioClient.java b/src/main/java/resources/speak/v1/audio/AsyncAudioClient.java deleted file mode 100644 index a950c70..0000000 --- a/src/main/java/resources/speak/v1/audio/AsyncAudioClient.java +++ /dev/null @@ -1,35 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.speak.v1.audio; - -import core.ClientOptions; -import core.RequestOptions; -import java.io.InputStream; -import java.util.concurrent.CompletableFuture; -import resources.speak.v1.audio.requests.SpeakV1Request; - -public class AsyncAudioClient { - protected final ClientOptions clientOptions; - - private final AsyncRawAudioClient rawClient; - - public AsyncAudioClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new AsyncRawAudioClient(clientOptions); - } - - /** Get responses with HTTP metadata like headers */ - public AsyncRawAudioClient withRawResponse() { - return this.rawClient; - } - - /** Convert text into natural-sounding speech using Deepgram's TTS REST API */ - public CompletableFuture generate(SpeakV1Request request) { - return this.rawClient.generate(request).thenApply(response -> response.body()); - } - - /** Convert text into natural-sounding speech using Deepgram's TTS REST API */ - public CompletableFuture generate( - SpeakV1Request request, RequestOptions requestOptions) { - return this.rawClient.generate(request, requestOptions).thenApply(response -> response.body()); - } -} diff --git a/src/main/java/resources/speak/v1/audio/AsyncRawAudioClient.java b/src/main/java/resources/speak/v1/audio/AsyncRawAudioClient.java deleted file mode 100644 index 915a4d5..0000000 --- a/src/main/java/resources/speak/v1/audio/AsyncRawAudioClient.java +++ /dev/null @@ -1,158 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.speak.v1.audio; - -import com.fasterxml.jackson.core.JsonProcessingException; -import core.ClientOptions; -import core.DeepgramApiApiException; -import core.DeepgramApiException; -import core.DeepgramApiHttpResponse; -import core.MediaTypes; -import core.ObjectMappers; -import core.QueryStringMapper; -import core.RequestOptions; -import core.ResponseBodyInputStream; -import errors.BadRequestError; -import java.io.IOException; -import java.io.InputStream; -import java.util.concurrent.CompletableFuture; -import okhttp3.Call; -import okhttp3.Callback; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; -import okhttp3.ResponseBody; -import org.jetbrains.annotations.NotNull; -import resources.speak.v1.audio.requests.SpeakV1Request; - -public class AsyncRawAudioClient { - protected final ClientOptions clientOptions; - - public AsyncRawAudioClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** Convert text into natural-sounding speech using Deepgram's TTS REST API */ - public CompletableFuture> generate(SpeakV1Request request) { - return generate(request, null); - } - - /** Convert text into natural-sounding speech using Deepgram's TTS REST API */ - public CompletableFuture> generate( - SpeakV1Request request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/speak"); - if (request.getCallback().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "callback", request.getCallback().get(), false); - } - if (request.getCallbackMethod().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "callback_method", request.getCallbackMethod().get(), false); - } - if (request.getMipOptOut().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "mip_opt_out", request.getMipOptOut().get(), false); - } - if (request.getBitRate().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "bit_rate", request.getBitRate().get(), false); - } - if (request.getContainer().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "container", request.getContainer().get(), false); - } - if (request.getEncoding().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "encoding", request.getEncoding().get(), false); - } - if (request.getModel().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "model", request.getModel().get(), false); - } - if (request.getSampleRate().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "sample_rate", request.getSampleRate().get(), false); - } - if (request.getTag().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "tag", request.getTag().get(), true); - } - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - RequestBody body; - try { - body = - RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = - new Request.Builder() - .url(httpUrl.build()) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .addHeader("Accept", "application/json"); - Request okhttpRequest = _requestBuilder.build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = new CompletableFuture<>(); - client - .newCall(okhttpRequest) - .enqueue( - new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) - throws IOException { - try { - ResponseBody responseBody = response.body(); - if (response.isSuccessful()) { - future.complete( - new DeepgramApiHttpResponse<>( - new ResponseBodyInputStream(response), response)); - return; - } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - try { - if (response.code() == 400) { - future.completeExceptionally( - new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), - response)); - return; - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally( - new DeepgramApiApiException( - "Error with status code " + response.code(), - response.code(), - errorBody, - response)); - return; - } catch (IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally( - new DeepgramApiException("Network error executing HTTP request", e)); - } - }); - return future; - } -} diff --git a/src/main/java/resources/speak/v1/audio/AudioClient.java b/src/main/java/resources/speak/v1/audio/AudioClient.java deleted file mode 100644 index 634b42f..0000000 --- a/src/main/java/resources/speak/v1/audio/AudioClient.java +++ /dev/null @@ -1,33 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.speak.v1.audio; - -import core.ClientOptions; -import core.RequestOptions; -import java.io.InputStream; -import resources.speak.v1.audio.requests.SpeakV1Request; - -public class AudioClient { - protected final ClientOptions clientOptions; - - private final RawAudioClient rawClient; - - public AudioClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new RawAudioClient(clientOptions); - } - - /** Get responses with HTTP metadata like headers */ - public RawAudioClient withRawResponse() { - return this.rawClient; - } - - /** Convert text into natural-sounding speech using Deepgram's TTS REST API */ - public InputStream generate(SpeakV1Request request) { - return this.rawClient.generate(request).body(); - } - - /** Convert text into natural-sounding speech using Deepgram's TTS REST API */ - public InputStream generate(SpeakV1Request request, RequestOptions requestOptions) { - return this.rawClient.generate(request, requestOptions).body(); - } -} diff --git a/src/main/java/resources/speak/v1/audio/RawAudioClient.java b/src/main/java/resources/speak/v1/audio/RawAudioClient.java deleted file mode 100644 index a7d5afb..0000000 --- a/src/main/java/resources/speak/v1/audio/RawAudioClient.java +++ /dev/null @@ -1,126 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.speak.v1.audio; - -import com.fasterxml.jackson.core.JsonProcessingException; -import core.ClientOptions; -import core.DeepgramApiApiException; -import core.DeepgramApiException; -import core.DeepgramApiHttpResponse; -import core.MediaTypes; -import core.ObjectMappers; -import core.QueryStringMapper; -import core.RequestOptions; -import core.ResponseBodyInputStream; -import errors.BadRequestError; -import java.io.IOException; -import java.io.InputStream; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; -import okhttp3.ResponseBody; -import resources.speak.v1.audio.requests.SpeakV1Request; - -public class RawAudioClient { - protected final ClientOptions clientOptions; - - public RawAudioClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** Convert text into natural-sounding speech using Deepgram's TTS REST API */ - public DeepgramApiHttpResponse generate(SpeakV1Request request) { - return generate(request, null); - } - - /** Convert text into natural-sounding speech using Deepgram's TTS REST API */ - public DeepgramApiHttpResponse generate( - SpeakV1Request request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = - HttpUrl.parse(this.clientOptions.environment().getBaseURL()) - .newBuilder() - .addPathSegments("v1/speak"); - if (request.getCallback().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "callback", request.getCallback().get(), false); - } - if (request.getCallbackMethod().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "callback_method", request.getCallbackMethod().get(), false); - } - if (request.getMipOptOut().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "mip_opt_out", request.getMipOptOut().get(), false); - } - if (request.getBitRate().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "bit_rate", request.getBitRate().get(), false); - } - if (request.getContainer().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "container", request.getContainer().get(), false); - } - if (request.getEncoding().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "encoding", request.getEncoding().get(), false); - } - if (request.getModel().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "model", request.getModel().get(), false); - } - if (request.getSampleRate().isPresent()) { - QueryStringMapper.addQueryParameter( - httpUrl, "sample_rate", request.getSampleRate().get(), false); - } - if (request.getTag().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "tag", request.getTag().get(), true); - } - if (requestOptions != null) { - requestOptions - .getQueryParameters() - .forEach( - (_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - }); - } - RequestBody body; - try { - body = - RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = - new Request.Builder() - .url(httpUrl.build()) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .addHeader("Accept", "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 new DeepgramApiHttpResponse<>(new ResponseBodyInputStream(response), response); - } - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - try { - if (response.code() == 400) { - throw new BadRequestError( - ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new DeepgramApiApiException( - "Error with status code " + response.code(), response.code(), errorBody, response); - } catch (IOException e) { - throw new DeepgramApiException("Network error executing HTTP request", e); - } - } -} diff --git a/src/main/java/resources/speak/v1/audio/requests/SpeakV1Request.java b/src/main/java/resources/speak/v1/audio/requests/SpeakV1Request.java deleted file mode 100644 index d0e32e2..0000000 --- a/src/main/java/resources/speak/v1/audio/requests/SpeakV1Request.java +++ /dev/null @@ -1,559 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.speak.v1.audio.requests; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.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 core.ObjectMappers; -import java.util.Collections; -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; -import resources.speak.v1.audio.types.AudioGenerateRequestCallbackMethod; -import resources.speak.v1.audio.types.AudioGenerateRequestContainer; -import resources.speak.v1.audio.types.AudioGenerateRequestEncoding; -import resources.speak.v1.audio.types.AudioGenerateRequestModel; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = SpeakV1Request.Builder.class) -public final class SpeakV1Request { - private final Optional> tag; - - private final Optional callback; - - private final Optional callbackMethod; - - private final Optional mipOptOut; - - private final Optional bitRate; - - private final Optional container; - - private final Optional encoding; - - private final Optional model; - - private final Optional sampleRate; - - private final String text; - - private final Map additionalProperties; - - private SpeakV1Request( - Optional> tag, - Optional callback, - Optional callbackMethod, - Optional mipOptOut, - Optional bitRate, - Optional container, - Optional encoding, - Optional model, - Optional sampleRate, - String text, - Map additionalProperties) { - this.tag = tag; - this.callback = callback; - this.callbackMethod = callbackMethod; - this.mipOptOut = mipOptOut; - this.bitRate = bitRate; - this.container = container; - this.encoding = encoding; - this.model = model; - this.sampleRate = sampleRate; - this.text = text; - this.additionalProperties = additionalProperties; - } - - /** - * @return Label your requests for the purpose of identification during usage reporting - */ - @JsonIgnore - public Optional> getTag() { - return tag; - } - - /** - * @return URL to which we'll make the callback request - */ - @JsonIgnore - public Optional getCallback() { - return callback; - } - - /** - * @return HTTP method by which the callback request will be made - */ - @JsonIgnore - public Optional getCallbackMethod() { - return callbackMethod; - } - - /** - * @return Opts out requests from the Deepgram Model Improvement Program. Refer to our Docs for - * pricing impacts before setting this to true. https://dpgr.am/deepgram-mip - */ - @JsonIgnore - public Optional getMipOptOut() { - return mipOptOut; - } - - /** - * @return The bitrate of the audio in bits per second. Choose from predefined ranges or specific - * values based on the encoding type. - */ - @JsonIgnore - public Optional getBitRate() { - return bitRate; - } - - /** - * @return Container specifies the file format wrapper for the output audio. The available options - * depend on the encoding type. - */ - @JsonIgnore - public Optional getContainer() { - return container; - } - - /** - * @return Encoding allows you to specify the expected encoding of your audio output - */ - @JsonIgnore - public Optional getEncoding() { - return encoding; - } - - /** - * @return AI model used to process submitted text - */ - @JsonIgnore - public Optional getModel() { - return model; - } - - /** - * @return Sample Rate specifies the sample rate for the output audio. Based on the encoding, - * different sample rates are supported. For some encodings, the sample rate is not - * configurable - */ - @JsonIgnore - public Optional getSampleRate() { - return sampleRate; - } - - /** - * @return The text content to be converted to speech - */ - @JsonProperty("text") - public String getText() { - return text; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SpeakV1Request && equalTo((SpeakV1Request) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(SpeakV1Request other) { - return tag.equals(other.tag) - && callback.equals(other.callback) - && callbackMethod.equals(other.callbackMethod) - && mipOptOut.equals(other.mipOptOut) - && bitRate.equals(other.bitRate) - && container.equals(other.container) - && encoding.equals(other.encoding) - && model.equals(other.model) - && sampleRate.equals(other.sampleRate) - && text.equals(other.text); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.tag, - this.callback, - this.callbackMethod, - this.mipOptOut, - this.bitRate, - this.container, - this.encoding, - this.model, - this.sampleRate, - this.text); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static TextStage builder() { - return new Builder(); - } - - public interface TextStage { - /** The text content to be converted to speech */ - _FinalStage text(@NotNull String text); - - Builder from(SpeakV1Request other); - } - - public interface _FinalStage { - SpeakV1Request build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** Label your requests for the purpose of identification during usage reporting */ - _FinalStage tag(Optional> tag); - - _FinalStage tag(List tag); - - _FinalStage tag(String tag); - - /** URL to which we'll make the callback request */ - _FinalStage callback(Optional callback); - - _FinalStage callback(String callback); - - /** HTTP method by which the callback request will be made */ - _FinalStage callbackMethod(Optional callbackMethod); - - _FinalStage callbackMethod(AudioGenerateRequestCallbackMethod callbackMethod); - - /** - * Opts out requests from the Deepgram Model Improvement Program. Refer to our Docs for pricing - * impacts before setting this to true. https://dpgr.am/deepgram-mip - */ - _FinalStage mipOptOut(Optional mipOptOut); - - _FinalStage mipOptOut(Boolean mipOptOut); - - /** - * The bitrate of the audio in bits per second. Choose from predefined ranges or specific values - * based on the encoding type. - */ - _FinalStage bitRate(Optional bitRate); - - _FinalStage bitRate(Double bitRate); - - /** - * Container specifies the file format wrapper for the output audio. The available options - * depend on the encoding type. - */ - _FinalStage container(Optional container); - - _FinalStage container(AudioGenerateRequestContainer container); - - /** Encoding allows you to specify the expected encoding of your audio output */ - _FinalStage encoding(Optional encoding); - - _FinalStage encoding(AudioGenerateRequestEncoding encoding); - - /** AI model used to process submitted text */ - _FinalStage model(Optional model); - - _FinalStage model(AudioGenerateRequestModel model); - - /** - * Sample Rate specifies the sample rate for the output audio. Based on the encoding, different - * sample rates are supported. For some encodings, the sample rate is not configurable - */ - _FinalStage sampleRate(Optional sampleRate); - - _FinalStage sampleRate(Double sampleRate); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements TextStage, _FinalStage { - private String text; - - private Optional sampleRate = Optional.empty(); - - private Optional model = Optional.empty(); - - private Optional encoding = Optional.empty(); - - private Optional container = Optional.empty(); - - private Optional bitRate = Optional.empty(); - - private Optional mipOptOut = Optional.empty(); - - private Optional callbackMethod = Optional.empty(); - - private Optional callback = Optional.empty(); - - private Optional> tag = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(SpeakV1Request other) { - tag(other.getTag()); - callback(other.getCallback()); - callbackMethod(other.getCallbackMethod()); - mipOptOut(other.getMipOptOut()); - bitRate(other.getBitRate()); - container(other.getContainer()); - encoding(other.getEncoding()); - model(other.getModel()); - sampleRate(other.getSampleRate()); - text(other.getText()); - return this; - } - - /** - * The text content to be converted to speech - * - *

The text content to be converted to speech - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("text") - public _FinalStage text(@NotNull String text) { - this.text = Objects.requireNonNull(text, "text must not be null"); - return this; - } - - /** - * Sample Rate specifies the sample rate for the output audio. Based on the encoding, different - * sample rates are supported. For some encodings, the sample rate is not configurable - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage sampleRate(Double sampleRate) { - this.sampleRate = Optional.ofNullable(sampleRate); - return this; - } - - /** - * Sample Rate specifies the sample rate for the output audio. Based on the encoding, different - * sample rates are supported. For some encodings, the sample rate is not configurable - */ - @java.lang.Override - @JsonSetter(value = "sample_rate", nulls = Nulls.SKIP) - public _FinalStage sampleRate(Optional sampleRate) { - this.sampleRate = sampleRate; - return this; - } - - /** - * AI model used to process submitted text - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage model(AudioGenerateRequestModel model) { - this.model = Optional.ofNullable(model); - return this; - } - - /** AI model used to process submitted text */ - @java.lang.Override - @JsonSetter(value = "model", nulls = Nulls.SKIP) - public _FinalStage model(Optional model) { - this.model = model; - return this; - } - - /** - * Encoding allows you to specify the expected encoding of your audio output - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage encoding(AudioGenerateRequestEncoding encoding) { - this.encoding = Optional.ofNullable(encoding); - return this; - } - - /** Encoding allows you to specify the expected encoding of your audio output */ - @java.lang.Override - @JsonSetter(value = "encoding", nulls = Nulls.SKIP) - public _FinalStage encoding(Optional encoding) { - this.encoding = encoding; - return this; - } - - /** - * Container specifies the file format wrapper for the output audio. The available options - * depend on the encoding type. - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage container(AudioGenerateRequestContainer container) { - this.container = Optional.ofNullable(container); - return this; - } - - /** - * Container specifies the file format wrapper for the output audio. The available options - * depend on the encoding type. - */ - @java.lang.Override - @JsonSetter(value = "container", nulls = Nulls.SKIP) - public _FinalStage container(Optional container) { - this.container = container; - return this; - } - - /** - * The bitrate of the audio in bits per second. Choose from predefined ranges or specific values - * based on the encoding type. - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage bitRate(Double bitRate) { - this.bitRate = Optional.ofNullable(bitRate); - return this; - } - - /** - * The bitrate of the audio in bits per second. Choose from predefined ranges or specific values - * based on the encoding type. - */ - @java.lang.Override - @JsonSetter(value = "bit_rate", nulls = Nulls.SKIP) - public _FinalStage bitRate(Optional bitRate) { - this.bitRate = bitRate; - return this; - } - - /** - * Opts out requests from the Deepgram Model Improvement Program. Refer to our Docs for pricing - * impacts before setting this to true. https://dpgr.am/deepgram-mip - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage mipOptOut(Boolean mipOptOut) { - this.mipOptOut = Optional.ofNullable(mipOptOut); - return this; - } - - /** - * Opts out requests from the Deepgram Model Improvement Program. Refer to our Docs for pricing - * impacts before setting this to true. https://dpgr.am/deepgram-mip - */ - @java.lang.Override - @JsonSetter(value = "mip_opt_out", nulls = Nulls.SKIP) - public _FinalStage mipOptOut(Optional mipOptOut) { - this.mipOptOut = mipOptOut; - return this; - } - - /** - * HTTP method by which the callback request will be made - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage callbackMethod(AudioGenerateRequestCallbackMethod callbackMethod) { - this.callbackMethod = Optional.ofNullable(callbackMethod); - return this; - } - - /** HTTP method by which the callback request will be made */ - @java.lang.Override - @JsonSetter(value = "callback_method", nulls = Nulls.SKIP) - public _FinalStage callbackMethod(Optional callbackMethod) { - this.callbackMethod = callbackMethod; - return this; - } - - /** - * URL to which we'll make the callback request - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage callback(String callback) { - this.callback = Optional.ofNullable(callback); - return this; - } - - /** URL to which we'll make the callback request */ - @java.lang.Override - @JsonSetter(value = "callback", nulls = Nulls.SKIP) - public _FinalStage callback(Optional callback) { - this.callback = callback; - return this; - } - - @java.lang.Override - public _FinalStage tag(String tag) { - this.tag = Optional.of(Collections.singletonList(tag)); - return this; - } - - /** - * Label your requests for the purpose of identification during usage reporting - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage tag(List tag) { - this.tag = Optional.ofNullable(tag); - return this; - } - - /** Label your requests for the purpose of identification during usage reporting */ - @java.lang.Override - @JsonSetter(value = "tag", nulls = Nulls.SKIP) - public _FinalStage tag(Optional> tag) { - this.tag = tag; - return this; - } - - @java.lang.Override - public SpeakV1Request build() { - return new SpeakV1Request( - tag, - callback, - callbackMethod, - mipOptOut, - bitRate, - container, - encoding, - model, - sampleRate, - text, - additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/speak/v1/audio/types/AudioGenerateRequestCallbackMethod.java b/src/main/java/resources/speak/v1/audio/types/AudioGenerateRequestCallbackMethod.java deleted file mode 100644 index a874101..0000000 --- a/src/main/java/resources/speak/v1/audio/types/AudioGenerateRequestCallbackMethod.java +++ /dev/null @@ -1,84 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.speak.v1.audio.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class AudioGenerateRequestCallbackMethod { - public static final AudioGenerateRequestCallbackMethod PUT = - new AudioGenerateRequestCallbackMethod(Value.PUT, "PUT"); - - public static final AudioGenerateRequestCallbackMethod POST = - new AudioGenerateRequestCallbackMethod(Value.POST, "POST"); - - private final Value value; - - private final String string; - - AudioGenerateRequestCallbackMethod(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof AudioGenerateRequestCallbackMethod - && this.string.equals(((AudioGenerateRequestCallbackMethod) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case PUT: - return visitor.visitPut(); - case POST: - return visitor.visitPost(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static AudioGenerateRequestCallbackMethod valueOf(String value) { - switch (value) { - case "PUT": - return PUT; - case "POST": - return POST; - default: - return new AudioGenerateRequestCallbackMethod(Value.UNKNOWN, value); - } - } - - public enum Value { - POST, - - PUT, - - UNKNOWN - } - - public interface Visitor { - T visitPost(); - - T visitPut(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/resources/speak/v1/audio/types/AudioGenerateRequestContainer.java b/src/main/java/resources/speak/v1/audio/types/AudioGenerateRequestContainer.java deleted file mode 100644 index 9e97776..0000000 --- a/src/main/java/resources/speak/v1/audio/types/AudioGenerateRequestContainer.java +++ /dev/null @@ -1,95 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.speak.v1.audio.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class AudioGenerateRequestContainer { - public static final AudioGenerateRequestContainer OGG = - new AudioGenerateRequestContainer(Value.OGG, "ogg"); - - public static final AudioGenerateRequestContainer WAV = - new AudioGenerateRequestContainer(Value.WAV, "wav"); - - public static final AudioGenerateRequestContainer NONE = - new AudioGenerateRequestContainer(Value.NONE, "none"); - - private final Value value; - - private final String string; - - AudioGenerateRequestContainer(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof AudioGenerateRequestContainer - && this.string.equals(((AudioGenerateRequestContainer) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case OGG: - return visitor.visitOgg(); - case WAV: - return visitor.visitWav(); - case NONE: - return visitor.visitNone(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static AudioGenerateRequestContainer valueOf(String value) { - switch (value) { - case "ogg": - return OGG; - case "wav": - return WAV; - case "none": - return NONE; - default: - return new AudioGenerateRequestContainer(Value.UNKNOWN, value); - } - } - - public enum Value { - NONE, - - WAV, - - OGG, - - UNKNOWN - } - - public interface Visitor { - T visitNone(); - - T visitWav(); - - T visitOgg(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/resources/speak/v1/audio/types/AudioGenerateRequestEncoding.java b/src/main/java/resources/speak/v1/audio/types/AudioGenerateRequestEncoding.java deleted file mode 100644 index 27101a9..0000000 --- a/src/main/java/resources/speak/v1/audio/types/AudioGenerateRequestEncoding.java +++ /dev/null @@ -1,139 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.speak.v1.audio.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class AudioGenerateRequestEncoding { - public static final AudioGenerateRequestEncoding MULAW = - new AudioGenerateRequestEncoding(Value.MULAW, "mulaw"); - - public static final AudioGenerateRequestEncoding AAC = - new AudioGenerateRequestEncoding(Value.AAC, "aac"); - - public static final AudioGenerateRequestEncoding FLAC = - new AudioGenerateRequestEncoding(Value.FLAC, "flac"); - - public static final AudioGenerateRequestEncoding MP3 = - new AudioGenerateRequestEncoding(Value.MP3, "mp3"); - - public static final AudioGenerateRequestEncoding LINEAR16 = - new AudioGenerateRequestEncoding(Value.LINEAR16, "linear16"); - - public static final AudioGenerateRequestEncoding OPUS = - new AudioGenerateRequestEncoding(Value.OPUS, "opus"); - - public static final AudioGenerateRequestEncoding ALAW = - new AudioGenerateRequestEncoding(Value.ALAW, "alaw"); - - private final Value value; - - private final String string; - - AudioGenerateRequestEncoding(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof AudioGenerateRequestEncoding - && this.string.equals(((AudioGenerateRequestEncoding) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case MULAW: - return visitor.visitMulaw(); - case AAC: - return visitor.visitAac(); - case FLAC: - return visitor.visitFlac(); - case MP3: - return visitor.visitMp3(); - case LINEAR16: - return visitor.visitLinear16(); - case OPUS: - return visitor.visitOpus(); - case ALAW: - return visitor.visitAlaw(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static AudioGenerateRequestEncoding valueOf(String value) { - switch (value) { - case "mulaw": - return MULAW; - case "aac": - return AAC; - case "flac": - return FLAC; - case "mp3": - return MP3; - case "linear16": - return LINEAR16; - case "opus": - return OPUS; - case "alaw": - return ALAW; - default: - return new AudioGenerateRequestEncoding(Value.UNKNOWN, value); - } - } - - public enum Value { - LINEAR16, - - FLAC, - - MULAW, - - ALAW, - - MP3, - - OPUS, - - AAC, - - UNKNOWN - } - - public interface Visitor { - T visitLinear16(); - - T visitFlac(); - - T visitMulaw(); - - T visitAlaw(); - - T visitMp3(); - - T visitOpus(); - - T visitAac(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/resources/speak/v1/audio/types/AudioGenerateRequestModel.java b/src/main/java/resources/speak/v1/audio/types/AudioGenerateRequestModel.java deleted file mode 100644 index f29f3cc..0000000 --- a/src/main/java/resources/speak/v1/audio/types/AudioGenerateRequestModel.java +++ /dev/null @@ -1,755 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.speak.v1.audio.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class AudioGenerateRequestModel { - public static final AudioGenerateRequestModel AURA_ANGUS_EN = - new AudioGenerateRequestModel(Value.AURA_ANGUS_EN, "aura-angus-en"); - - public static final AudioGenerateRequestModel AURA2JUPITER_EN = - new AudioGenerateRequestModel(Value.AURA2JUPITER_EN, "aura-2-jupiter-en"); - - public static final AudioGenerateRequestModel AURA2CORA_EN = - new AudioGenerateRequestModel(Value.AURA2CORA_EN, "aura-2-cora-en"); - - public static final AudioGenerateRequestModel AURA_STELLA_EN = - new AudioGenerateRequestModel(Value.AURA_STELLA_EN, "aura-stella-en"); - - public static final AudioGenerateRequestModel AURA2HELENA_EN = - new AudioGenerateRequestModel(Value.AURA2HELENA_EN, "aura-2-helena-en"); - - public static final AudioGenerateRequestModel AURA2AQUILA_ES = - new AudioGenerateRequestModel(Value.AURA2AQUILA_ES, "aura-2-aquila-es"); - - public static final AudioGenerateRequestModel AURA2ATLAS_EN = - new AudioGenerateRequestModel(Value.AURA2ATLAS_EN, "aura-2-atlas-en"); - - public static final AudioGenerateRequestModel AURA2ORION_EN = - new AudioGenerateRequestModel(Value.AURA2ORION_EN, "aura-2-orion-en"); - - public static final AudioGenerateRequestModel AURA2DRACO_EN = - new AudioGenerateRequestModel(Value.AURA2DRACO_EN, "aura-2-draco-en"); - - public static final AudioGenerateRequestModel AURA2HYPERION_EN = - new AudioGenerateRequestModel(Value.AURA2HYPERION_EN, "aura-2-hyperion-en"); - - public static final AudioGenerateRequestModel AURA2JANUS_EN = - new AudioGenerateRequestModel(Value.AURA2JANUS_EN, "aura-2-janus-en"); - - public static final AudioGenerateRequestModel AURA_HELIOS_EN = - new AudioGenerateRequestModel(Value.AURA_HELIOS_EN, "aura-helios-en"); - - public static final AudioGenerateRequestModel AURA2PLUTO_EN = - new AudioGenerateRequestModel(Value.AURA2PLUTO_EN, "aura-2-pluto-en"); - - public static final AudioGenerateRequestModel AURA2ARCAS_EN = - new AudioGenerateRequestModel(Value.AURA2ARCAS_EN, "aura-2-arcas-en"); - - public static final AudioGenerateRequestModel AURA2NESTOR_ES = - new AudioGenerateRequestModel(Value.AURA2NESTOR_ES, "aura-2-nestor-es"); - - public static final AudioGenerateRequestModel AURA2NEPTUNE_EN = - new AudioGenerateRequestModel(Value.AURA2NEPTUNE_EN, "aura-2-neptune-en"); - - public static final AudioGenerateRequestModel AURA2MINERVA_EN = - new AudioGenerateRequestModel(Value.AURA2MINERVA_EN, "aura-2-minerva-en"); - - public static final AudioGenerateRequestModel AURA2ALVARO_ES = - new AudioGenerateRequestModel(Value.AURA2ALVARO_ES, "aura-2-alvaro-es"); - - public static final AudioGenerateRequestModel AURA_ATHENA_EN = - new AudioGenerateRequestModel(Value.AURA_ATHENA_EN, "aura-athena-en"); - - public static final AudioGenerateRequestModel AURA_PERSEUS_EN = - new AudioGenerateRequestModel(Value.AURA_PERSEUS_EN, "aura-perseus-en"); - - public static final AudioGenerateRequestModel AURA2ODYSSEUS_EN = - new AudioGenerateRequestModel(Value.AURA2ODYSSEUS_EN, "aura-2-odysseus-en"); - - public static final AudioGenerateRequestModel AURA2PANDORA_EN = - new AudioGenerateRequestModel(Value.AURA2PANDORA_EN, "aura-2-pandora-en"); - - public static final AudioGenerateRequestModel AURA2ZEUS_EN = - new AudioGenerateRequestModel(Value.AURA2ZEUS_EN, "aura-2-zeus-en"); - - public static final AudioGenerateRequestModel AURA2ELECTRA_EN = - new AudioGenerateRequestModel(Value.AURA2ELECTRA_EN, "aura-2-electra-en"); - - public static final AudioGenerateRequestModel AURA2ORPHEUS_EN = - new AudioGenerateRequestModel(Value.AURA2ORPHEUS_EN, "aura-2-orpheus-en"); - - public static final AudioGenerateRequestModel AURA2THALIA_EN = - new AudioGenerateRequestModel(Value.AURA2THALIA_EN, "aura-2-thalia-en"); - - public static final AudioGenerateRequestModel AURA2CELESTE_ES = - new AudioGenerateRequestModel(Value.AURA2CELESTE_ES, "aura-2-celeste-es"); - - public static final AudioGenerateRequestModel AURA_ASTERIA_EN = - new AudioGenerateRequestModel(Value.AURA_ASTERIA_EN, "aura-asteria-en"); - - public static final AudioGenerateRequestModel AURA2ESTRELLA_ES = - new AudioGenerateRequestModel(Value.AURA2ESTRELLA_ES, "aura-2-estrella-es"); - - public static final AudioGenerateRequestModel AURA2HERA_EN = - new AudioGenerateRequestModel(Value.AURA2HERA_EN, "aura-2-hera-en"); - - public static final AudioGenerateRequestModel AURA2MARS_EN = - new AudioGenerateRequestModel(Value.AURA2MARS_EN, "aura-2-mars-en"); - - public static final AudioGenerateRequestModel AURA2SIRIO_ES = - new AudioGenerateRequestModel(Value.AURA2SIRIO_ES, "aura-2-sirio-es"); - - public static final AudioGenerateRequestModel AURA2ASTERIA_EN = - new AudioGenerateRequestModel(Value.AURA2ASTERIA_EN, "aura-2-asteria-en"); - - public static final AudioGenerateRequestModel AURA2HERMES_EN = - new AudioGenerateRequestModel(Value.AURA2HERMES_EN, "aura-2-hermes-en"); - - public static final AudioGenerateRequestModel AURA2VESTA_EN = - new AudioGenerateRequestModel(Value.AURA2VESTA_EN, "aura-2-vesta-en"); - - public static final AudioGenerateRequestModel AURA2CARINA_ES = - new AudioGenerateRequestModel(Value.AURA2CARINA_ES, "aura-2-carina-es"); - - public static final AudioGenerateRequestModel AURA2CALLISTA_EN = - new AudioGenerateRequestModel(Value.AURA2CALLISTA_EN, "aura-2-callista-en"); - - public static final AudioGenerateRequestModel AURA2HARMONIA_EN = - new AudioGenerateRequestModel(Value.AURA2HARMONIA_EN, "aura-2-harmonia-en"); - - public static final AudioGenerateRequestModel AURA2SELENA_ES = - new AudioGenerateRequestModel(Value.AURA2SELENA_ES, "aura-2-selena-es"); - - public static final AudioGenerateRequestModel AURA2AURORA_EN = - new AudioGenerateRequestModel(Value.AURA2AURORA_EN, "aura-2-aurora-en"); - - public static final AudioGenerateRequestModel AURA_ZEUS_EN = - new AudioGenerateRequestModel(Value.AURA_ZEUS_EN, "aura-zeus-en"); - - public static final AudioGenerateRequestModel AURA2OPHELIA_EN = - new AudioGenerateRequestModel(Value.AURA2OPHELIA_EN, "aura-2-ophelia-en"); - - public static final AudioGenerateRequestModel AURA2AMALTHEA_EN = - new AudioGenerateRequestModel(Value.AURA2AMALTHEA_EN, "aura-2-amalthea-en"); - - public static final AudioGenerateRequestModel AURA_ORPHEUS_EN = - new AudioGenerateRequestModel(Value.AURA_ORPHEUS_EN, "aura-orpheus-en"); - - public static final AudioGenerateRequestModel AURA2DELIA_EN = - new AudioGenerateRequestModel(Value.AURA2DELIA_EN, "aura-2-delia-en"); - - public static final AudioGenerateRequestModel AURA_LUNA_EN = - new AudioGenerateRequestModel(Value.AURA_LUNA_EN, "aura-luna-en"); - - public static final AudioGenerateRequestModel AURA2APOLLO_EN = - new AudioGenerateRequestModel(Value.AURA2APOLLO_EN, "aura-2-apollo-en"); - - public static final AudioGenerateRequestModel AURA2SELENE_EN = - new AudioGenerateRequestModel(Value.AURA2SELENE_EN, "aura-2-selene-en"); - - public static final AudioGenerateRequestModel AURA2THEIA_EN = - new AudioGenerateRequestModel(Value.AURA2THEIA_EN, "aura-2-theia-en"); - - public static final AudioGenerateRequestModel AURA_HERA_EN = - new AudioGenerateRequestModel(Value.AURA_HERA_EN, "aura-hera-en"); - - public static final AudioGenerateRequestModel AURA2CORDELIA_EN = - new AudioGenerateRequestModel(Value.AURA2CORDELIA_EN, "aura-2-cordelia-en"); - - public static final AudioGenerateRequestModel AURA2ANDROMEDA_EN = - new AudioGenerateRequestModel(Value.AURA2ANDROMEDA_EN, "aura-2-andromeda-en"); - - public static final AudioGenerateRequestModel AURA2ARIES_EN = - new AudioGenerateRequestModel(Value.AURA2ARIES_EN, "aura-2-aries-en"); - - public static final AudioGenerateRequestModel AURA2JUNO_EN = - new AudioGenerateRequestModel(Value.AURA2JUNO_EN, "aura-2-juno-en"); - - public static final AudioGenerateRequestModel AURA2LUNA_EN = - new AudioGenerateRequestModel(Value.AURA2LUNA_EN, "aura-2-luna-en"); - - public static final AudioGenerateRequestModel AURA2DIANA_ES = - new AudioGenerateRequestModel(Value.AURA2DIANA_ES, "aura-2-diana-es"); - - public static final AudioGenerateRequestModel AURA2JAVIER_ES = - new AudioGenerateRequestModel(Value.AURA2JAVIER_ES, "aura-2-javier-es"); - - public static final AudioGenerateRequestModel AURA_ORION_EN = - new AudioGenerateRequestModel(Value.AURA_ORION_EN, "aura-orion-en"); - - public static final AudioGenerateRequestModel AURA_ARCAS_EN = - new AudioGenerateRequestModel(Value.AURA_ARCAS_EN, "aura-arcas-en"); - - public static final AudioGenerateRequestModel AURA2IRIS_EN = - new AudioGenerateRequestModel(Value.AURA2IRIS_EN, "aura-2-iris-en"); - - public static final AudioGenerateRequestModel AURA2ATHENA_EN = - new AudioGenerateRequestModel(Value.AURA2ATHENA_EN, "aura-2-athena-en"); - - public static final AudioGenerateRequestModel AURA2SATURN_EN = - new AudioGenerateRequestModel(Value.AURA2SATURN_EN, "aura-2-saturn-en"); - - public static final AudioGenerateRequestModel AURA2PHOEBE_EN = - new AudioGenerateRequestModel(Value.AURA2PHOEBE_EN, "aura-2-phoebe-en"); - - private final Value value; - - private final String string; - - AudioGenerateRequestModel(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof AudioGenerateRequestModel - && this.string.equals(((AudioGenerateRequestModel) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case AURA_ANGUS_EN: - return visitor.visitAuraAngusEn(); - case AURA2JUPITER_EN: - return visitor.visitAura2JupiterEn(); - case AURA2CORA_EN: - return visitor.visitAura2CoraEn(); - case AURA_STELLA_EN: - return visitor.visitAuraStellaEn(); - case AURA2HELENA_EN: - return visitor.visitAura2HelenaEn(); - case AURA2AQUILA_ES: - return visitor.visitAura2AquilaEs(); - case AURA2ATLAS_EN: - return visitor.visitAura2AtlasEn(); - case AURA2ORION_EN: - return visitor.visitAura2OrionEn(); - case AURA2DRACO_EN: - return visitor.visitAura2DracoEn(); - case AURA2HYPERION_EN: - return visitor.visitAura2HyperionEn(); - case AURA2JANUS_EN: - return visitor.visitAura2JanusEn(); - case AURA_HELIOS_EN: - return visitor.visitAuraHeliosEn(); - case AURA2PLUTO_EN: - return visitor.visitAura2PlutoEn(); - case AURA2ARCAS_EN: - return visitor.visitAura2ArcasEn(); - case AURA2NESTOR_ES: - return visitor.visitAura2NestorEs(); - case AURA2NEPTUNE_EN: - return visitor.visitAura2NeptuneEn(); - case AURA2MINERVA_EN: - return visitor.visitAura2MinervaEn(); - case AURA2ALVARO_ES: - return visitor.visitAura2AlvaroEs(); - case AURA_ATHENA_EN: - return visitor.visitAuraAthenaEn(); - case AURA_PERSEUS_EN: - return visitor.visitAuraPerseusEn(); - case AURA2ODYSSEUS_EN: - return visitor.visitAura2OdysseusEn(); - case AURA2PANDORA_EN: - return visitor.visitAura2PandoraEn(); - case AURA2ZEUS_EN: - return visitor.visitAura2ZeusEn(); - case AURA2ELECTRA_EN: - return visitor.visitAura2ElectraEn(); - case AURA2ORPHEUS_EN: - return visitor.visitAura2OrpheusEn(); - case AURA2THALIA_EN: - return visitor.visitAura2ThaliaEn(); - case AURA2CELESTE_ES: - return visitor.visitAura2CelesteEs(); - case AURA_ASTERIA_EN: - return visitor.visitAuraAsteriaEn(); - case AURA2ESTRELLA_ES: - return visitor.visitAura2EstrellaEs(); - case AURA2HERA_EN: - return visitor.visitAura2HeraEn(); - case AURA2MARS_EN: - return visitor.visitAura2MarsEn(); - case AURA2SIRIO_ES: - return visitor.visitAura2SirioEs(); - case AURA2ASTERIA_EN: - return visitor.visitAura2AsteriaEn(); - case AURA2HERMES_EN: - return visitor.visitAura2HermesEn(); - case AURA2VESTA_EN: - return visitor.visitAura2VestaEn(); - case AURA2CARINA_ES: - return visitor.visitAura2CarinaEs(); - case AURA2CALLISTA_EN: - return visitor.visitAura2CallistaEn(); - case AURA2HARMONIA_EN: - return visitor.visitAura2HarmoniaEn(); - case AURA2SELENA_ES: - return visitor.visitAura2SelenaEs(); - case AURA2AURORA_EN: - return visitor.visitAura2AuroraEn(); - case AURA_ZEUS_EN: - return visitor.visitAuraZeusEn(); - case AURA2OPHELIA_EN: - return visitor.visitAura2OpheliaEn(); - case AURA2AMALTHEA_EN: - return visitor.visitAura2AmaltheaEn(); - case AURA_ORPHEUS_EN: - return visitor.visitAuraOrpheusEn(); - case AURA2DELIA_EN: - return visitor.visitAura2DeliaEn(); - case AURA_LUNA_EN: - return visitor.visitAuraLunaEn(); - case AURA2APOLLO_EN: - return visitor.visitAura2ApolloEn(); - case AURA2SELENE_EN: - return visitor.visitAura2SeleneEn(); - case AURA2THEIA_EN: - return visitor.visitAura2TheiaEn(); - case AURA_HERA_EN: - return visitor.visitAuraHeraEn(); - case AURA2CORDELIA_EN: - return visitor.visitAura2CordeliaEn(); - case AURA2ANDROMEDA_EN: - return visitor.visitAura2AndromedaEn(); - case AURA2ARIES_EN: - return visitor.visitAura2AriesEn(); - case AURA2JUNO_EN: - return visitor.visitAura2JunoEn(); - case AURA2LUNA_EN: - return visitor.visitAura2LunaEn(); - case AURA2DIANA_ES: - return visitor.visitAura2DianaEs(); - case AURA2JAVIER_ES: - return visitor.visitAura2JavierEs(); - case AURA_ORION_EN: - return visitor.visitAuraOrionEn(); - case AURA_ARCAS_EN: - return visitor.visitAuraArcasEn(); - case AURA2IRIS_EN: - return visitor.visitAura2IrisEn(); - case AURA2ATHENA_EN: - return visitor.visitAura2AthenaEn(); - case AURA2SATURN_EN: - return visitor.visitAura2SaturnEn(); - case AURA2PHOEBE_EN: - return visitor.visitAura2PhoebeEn(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static AudioGenerateRequestModel valueOf(String value) { - switch (value) { - case "aura-angus-en": - return AURA_ANGUS_EN; - case "aura-2-jupiter-en": - return AURA2JUPITER_EN; - case "aura-2-cora-en": - return AURA2CORA_EN; - case "aura-stella-en": - return AURA_STELLA_EN; - case "aura-2-helena-en": - return AURA2HELENA_EN; - case "aura-2-aquila-es": - return AURA2AQUILA_ES; - case "aura-2-atlas-en": - return AURA2ATLAS_EN; - case "aura-2-orion-en": - return AURA2ORION_EN; - case "aura-2-draco-en": - return AURA2DRACO_EN; - case "aura-2-hyperion-en": - return AURA2HYPERION_EN; - case "aura-2-janus-en": - return AURA2JANUS_EN; - case "aura-helios-en": - return AURA_HELIOS_EN; - case "aura-2-pluto-en": - return AURA2PLUTO_EN; - case "aura-2-arcas-en": - return AURA2ARCAS_EN; - case "aura-2-nestor-es": - return AURA2NESTOR_ES; - case "aura-2-neptune-en": - return AURA2NEPTUNE_EN; - case "aura-2-minerva-en": - return AURA2MINERVA_EN; - case "aura-2-alvaro-es": - return AURA2ALVARO_ES; - case "aura-athena-en": - return AURA_ATHENA_EN; - case "aura-perseus-en": - return AURA_PERSEUS_EN; - case "aura-2-odysseus-en": - return AURA2ODYSSEUS_EN; - case "aura-2-pandora-en": - return AURA2PANDORA_EN; - case "aura-2-zeus-en": - return AURA2ZEUS_EN; - case "aura-2-electra-en": - return AURA2ELECTRA_EN; - case "aura-2-orpheus-en": - return AURA2ORPHEUS_EN; - case "aura-2-thalia-en": - return AURA2THALIA_EN; - case "aura-2-celeste-es": - return AURA2CELESTE_ES; - case "aura-asteria-en": - return AURA_ASTERIA_EN; - case "aura-2-estrella-es": - return AURA2ESTRELLA_ES; - case "aura-2-hera-en": - return AURA2HERA_EN; - case "aura-2-mars-en": - return AURA2MARS_EN; - case "aura-2-sirio-es": - return AURA2SIRIO_ES; - case "aura-2-asteria-en": - return AURA2ASTERIA_EN; - case "aura-2-hermes-en": - return AURA2HERMES_EN; - case "aura-2-vesta-en": - return AURA2VESTA_EN; - case "aura-2-carina-es": - return AURA2CARINA_ES; - case "aura-2-callista-en": - return AURA2CALLISTA_EN; - case "aura-2-harmonia-en": - return AURA2HARMONIA_EN; - case "aura-2-selena-es": - return AURA2SELENA_ES; - case "aura-2-aurora-en": - return AURA2AURORA_EN; - case "aura-zeus-en": - return AURA_ZEUS_EN; - case "aura-2-ophelia-en": - return AURA2OPHELIA_EN; - case "aura-2-amalthea-en": - return AURA2AMALTHEA_EN; - case "aura-orpheus-en": - return AURA_ORPHEUS_EN; - case "aura-2-delia-en": - return AURA2DELIA_EN; - case "aura-luna-en": - return AURA_LUNA_EN; - case "aura-2-apollo-en": - return AURA2APOLLO_EN; - case "aura-2-selene-en": - return AURA2SELENE_EN; - case "aura-2-theia-en": - return AURA2THEIA_EN; - case "aura-hera-en": - return AURA_HERA_EN; - case "aura-2-cordelia-en": - return AURA2CORDELIA_EN; - case "aura-2-andromeda-en": - return AURA2ANDROMEDA_EN; - case "aura-2-aries-en": - return AURA2ARIES_EN; - case "aura-2-juno-en": - return AURA2JUNO_EN; - case "aura-2-luna-en": - return AURA2LUNA_EN; - case "aura-2-diana-es": - return AURA2DIANA_ES; - case "aura-2-javier-es": - return AURA2JAVIER_ES; - case "aura-orion-en": - return AURA_ORION_EN; - case "aura-arcas-en": - return AURA_ARCAS_EN; - case "aura-2-iris-en": - return AURA2IRIS_EN; - case "aura-2-athena-en": - return AURA2ATHENA_EN; - case "aura-2-saturn-en": - return AURA2SATURN_EN; - case "aura-2-phoebe-en": - return AURA2PHOEBE_EN; - default: - return new AudioGenerateRequestModel(Value.UNKNOWN, value); - } - } - - public enum Value { - AURA_ASTERIA_EN, - - AURA_LUNA_EN, - - AURA_STELLA_EN, - - AURA_ATHENA_EN, - - AURA_HERA_EN, - - AURA_ORION_EN, - - AURA_ARCAS_EN, - - AURA_PERSEUS_EN, - - AURA_ANGUS_EN, - - AURA_ORPHEUS_EN, - - AURA_HELIOS_EN, - - AURA_ZEUS_EN, - - AURA2AMALTHEA_EN, - - AURA2ANDROMEDA_EN, - - AURA2APOLLO_EN, - - AURA2ARCAS_EN, - - AURA2ARIES_EN, - - AURA2ASTERIA_EN, - - AURA2ATHENA_EN, - - AURA2ATLAS_EN, - - AURA2AURORA_EN, - - AURA2CALLISTA_EN, - - AURA2CORDELIA_EN, - - AURA2CORA_EN, - - AURA2DELIA_EN, - - AURA2DRACO_EN, - - AURA2ELECTRA_EN, - - AURA2HARMONIA_EN, - - AURA2HELENA_EN, - - AURA2HERA_EN, - - AURA2HERMES_EN, - - AURA2HYPERION_EN, - - AURA2IRIS_EN, - - AURA2JANUS_EN, - - AURA2JUNO_EN, - - AURA2JUPITER_EN, - - AURA2LUNA_EN, - - AURA2MARS_EN, - - AURA2MINERVA_EN, - - AURA2NEPTUNE_EN, - - AURA2ODYSSEUS_EN, - - AURA2OPHELIA_EN, - - AURA2ORION_EN, - - AURA2ORPHEUS_EN, - - AURA2PANDORA_EN, - - AURA2PHOEBE_EN, - - AURA2PLUTO_EN, - - AURA2SATURN_EN, - - AURA2SELENE_EN, - - AURA2THALIA_EN, - - AURA2THEIA_EN, - - AURA2VESTA_EN, - - AURA2ZEUS_EN, - - AURA2SIRIO_ES, - - AURA2NESTOR_ES, - - AURA2CARINA_ES, - - AURA2CELESTE_ES, - - AURA2ALVARO_ES, - - AURA2DIANA_ES, - - AURA2AQUILA_ES, - - AURA2SELENA_ES, - - AURA2ESTRELLA_ES, - - AURA2JAVIER_ES, - - UNKNOWN - } - - public interface Visitor { - T visitAuraAsteriaEn(); - - T visitAuraLunaEn(); - - T visitAuraStellaEn(); - - T visitAuraAthenaEn(); - - T visitAuraHeraEn(); - - T visitAuraOrionEn(); - - T visitAuraArcasEn(); - - T visitAuraPerseusEn(); - - T visitAuraAngusEn(); - - T visitAuraOrpheusEn(); - - T visitAuraHeliosEn(); - - T visitAuraZeusEn(); - - T visitAura2AmaltheaEn(); - - T visitAura2AndromedaEn(); - - T visitAura2ApolloEn(); - - T visitAura2ArcasEn(); - - T visitAura2AriesEn(); - - T visitAura2AsteriaEn(); - - T visitAura2AthenaEn(); - - T visitAura2AtlasEn(); - - T visitAura2AuroraEn(); - - T visitAura2CallistaEn(); - - T visitAura2CordeliaEn(); - - T visitAura2CoraEn(); - - T visitAura2DeliaEn(); - - T visitAura2DracoEn(); - - T visitAura2ElectraEn(); - - T visitAura2HarmoniaEn(); - - T visitAura2HelenaEn(); - - T visitAura2HeraEn(); - - T visitAura2HermesEn(); - - T visitAura2HyperionEn(); - - T visitAura2IrisEn(); - - T visitAura2JanusEn(); - - T visitAura2JunoEn(); - - T visitAura2JupiterEn(); - - T visitAura2LunaEn(); - - T visitAura2MarsEn(); - - T visitAura2MinervaEn(); - - T visitAura2NeptuneEn(); - - T visitAura2OdysseusEn(); - - T visitAura2OpheliaEn(); - - T visitAura2OrionEn(); - - T visitAura2OrpheusEn(); - - T visitAura2PandoraEn(); - - T visitAura2PhoebeEn(); - - T visitAura2PlutoEn(); - - T visitAura2SaturnEn(); - - T visitAura2SeleneEn(); - - T visitAura2ThaliaEn(); - - T visitAura2TheiaEn(); - - T visitAura2VestaEn(); - - T visitAura2ZeusEn(); - - T visitAura2SirioEs(); - - T visitAura2NestorEs(); - - T visitAura2CarinaEs(); - - T visitAura2CelesteEs(); - - T visitAura2AlvaroEs(); - - T visitAura2DianaEs(); - - T visitAura2AquilaEs(); - - T visitAura2SelenaEs(); - - T visitAura2EstrellaEs(); - - T visitAura2JavierEs(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/resources/speak/v1/types/SpeakV1Clear.java b/src/main/java/resources/speak/v1/types/SpeakV1Clear.java deleted file mode 100644 index 070d272..0000000 --- a/src/main/java/resources/speak/v1/types/SpeakV1Clear.java +++ /dev/null @@ -1,126 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.speak.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = SpeakV1Clear.Builder.class) -public final class SpeakV1Clear { - private final SpeakV1ClearType type; - - private final Map additionalProperties; - - private SpeakV1Clear(SpeakV1ClearType type, Map additionalProperties) { - this.type = type; - this.additionalProperties = additionalProperties; - } - - /** - * @return Message type identifier - */ - @JsonProperty("type") - public SpeakV1ClearType getType() { - return type; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SpeakV1Clear && equalTo((SpeakV1Clear) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(SpeakV1Clear other) { - return type.equals(other.type); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.type); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static TypeStage builder() { - return new Builder(); - } - - public interface TypeStage { - /** Message type identifier */ - _FinalStage type(@NotNull SpeakV1ClearType type); - - Builder from(SpeakV1Clear other); - } - - public interface _FinalStage { - SpeakV1Clear build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements TypeStage, _FinalStage { - private SpeakV1ClearType type; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(SpeakV1Clear other) { - type(other.getType()); - return this; - } - - /** - * Message type identifier - * - *

Message type identifier - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("type") - public _FinalStage type(@NotNull SpeakV1ClearType type) { - this.type = Objects.requireNonNull(type, "type must not be null"); - return this; - } - - @java.lang.Override - public SpeakV1Clear build() { - return new SpeakV1Clear(type, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/speak/v1/types/SpeakV1ClearType.java b/src/main/java/resources/speak/v1/types/SpeakV1ClearType.java deleted file mode 100644 index 0ce150a..0000000 --- a/src/main/java/resources/speak/v1/types/SpeakV1ClearType.java +++ /dev/null @@ -1,92 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.speak.v1.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class SpeakV1ClearType { - public static final SpeakV1ClearType CLOSE = new SpeakV1ClearType(Value.CLOSE, "Close"); - - public static final SpeakV1ClearType FLUSH = new SpeakV1ClearType(Value.FLUSH, "Flush"); - - public static final SpeakV1ClearType CLEAR = new SpeakV1ClearType(Value.CLEAR, "Clear"); - - private final Value value; - - private final String string; - - SpeakV1ClearType(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof SpeakV1ClearType - && this.string.equals(((SpeakV1ClearType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case CLOSE: - return visitor.visitClose(); - case FLUSH: - return visitor.visitFlush(); - case CLEAR: - return visitor.visitClear(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static SpeakV1ClearType valueOf(String value) { - switch (value) { - case "Close": - return CLOSE; - case "Flush": - return FLUSH; - case "Clear": - return CLEAR; - default: - return new SpeakV1ClearType(Value.UNKNOWN, value); - } - } - - public enum Value { - FLUSH, - - CLEAR, - - CLOSE, - - UNKNOWN - } - - public interface Visitor { - T visitFlush(); - - T visitClear(); - - T visitClose(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/resources/speak/v1/types/SpeakV1Cleared.java b/src/main/java/resources/speak/v1/types/SpeakV1Cleared.java deleted file mode 100644 index 6433630..0000000 --- a/src/main/java/resources/speak/v1/types/SpeakV1Cleared.java +++ /dev/null @@ -1,160 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.speak.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = SpeakV1Cleared.Builder.class) -public final class SpeakV1Cleared { - private final SpeakV1ClearedType type; - - private final double sequenceId; - - private final Map additionalProperties; - - private SpeakV1Cleared( - SpeakV1ClearedType type, double sequenceId, Map additionalProperties) { - this.type = type; - this.sequenceId = sequenceId; - this.additionalProperties = additionalProperties; - } - - /** - * @return Message type identifier - */ - @JsonProperty("type") - public SpeakV1ClearedType getType() { - return type; - } - - /** - * @return The sequence ID of the response - */ - @JsonProperty("sequence_id") - public double getSequenceId() { - return sequenceId; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SpeakV1Cleared && equalTo((SpeakV1Cleared) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(SpeakV1Cleared other) { - return type.equals(other.type) && sequenceId == other.sequenceId; - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.type, this.sequenceId); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static TypeStage builder() { - return new Builder(); - } - - public interface TypeStage { - /** Message type identifier */ - SequenceIdStage type(@NotNull SpeakV1ClearedType type); - - Builder from(SpeakV1Cleared other); - } - - public interface SequenceIdStage { - /** The sequence ID of the response */ - _FinalStage sequenceId(double sequenceId); - } - - public interface _FinalStage { - SpeakV1Cleared build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements TypeStage, SequenceIdStage, _FinalStage { - private SpeakV1ClearedType type; - - private double sequenceId; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(SpeakV1Cleared other) { - type(other.getType()); - sequenceId(other.getSequenceId()); - return this; - } - - /** - * Message type identifier - * - *

Message type identifier - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("type") - public SequenceIdStage type(@NotNull SpeakV1ClearedType type) { - this.type = Objects.requireNonNull(type, "type must not be null"); - return this; - } - - /** - * The sequence ID of the response - * - *

The sequence ID of the response - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("sequence_id") - public _FinalStage sequenceId(double sequenceId) { - this.sequenceId = sequenceId; - return this; - } - - @java.lang.Override - public SpeakV1Cleared build() { - return new SpeakV1Cleared(type, sequenceId, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/speak/v1/types/SpeakV1ClearedType.java b/src/main/java/resources/speak/v1/types/SpeakV1ClearedType.java deleted file mode 100644 index f54ce39..0000000 --- a/src/main/java/resources/speak/v1/types/SpeakV1ClearedType.java +++ /dev/null @@ -1,82 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.speak.v1.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class SpeakV1ClearedType { - public static final SpeakV1ClearedType CLEARED = new SpeakV1ClearedType(Value.CLEARED, "Cleared"); - - public static final SpeakV1ClearedType FLUSHED = new SpeakV1ClearedType(Value.FLUSHED, "Flushed"); - - private final Value value; - - private final String string; - - SpeakV1ClearedType(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof SpeakV1ClearedType - && this.string.equals(((SpeakV1ClearedType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case CLEARED: - return visitor.visitCleared(); - case FLUSHED: - return visitor.visitFlushed(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static SpeakV1ClearedType valueOf(String value) { - switch (value) { - case "Cleared": - return CLEARED; - case "Flushed": - return FLUSHED; - default: - return new SpeakV1ClearedType(Value.UNKNOWN, value); - } - } - - public enum Value { - FLUSHED, - - CLEARED, - - UNKNOWN - } - - public interface Visitor { - T visitFlushed(); - - T visitCleared(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/resources/speak/v1/types/SpeakV1Close.java b/src/main/java/resources/speak/v1/types/SpeakV1Close.java deleted file mode 100644 index 46140e6..0000000 --- a/src/main/java/resources/speak/v1/types/SpeakV1Close.java +++ /dev/null @@ -1,126 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.speak.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = SpeakV1Close.Builder.class) -public final class SpeakV1Close { - private final SpeakV1CloseType type; - - private final Map additionalProperties; - - private SpeakV1Close(SpeakV1CloseType type, Map additionalProperties) { - this.type = type; - this.additionalProperties = additionalProperties; - } - - /** - * @return Message type identifier - */ - @JsonProperty("type") - public SpeakV1CloseType getType() { - return type; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SpeakV1Close && equalTo((SpeakV1Close) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(SpeakV1Close other) { - return type.equals(other.type); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.type); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static TypeStage builder() { - return new Builder(); - } - - public interface TypeStage { - /** Message type identifier */ - _FinalStage type(@NotNull SpeakV1CloseType type); - - Builder from(SpeakV1Close other); - } - - public interface _FinalStage { - SpeakV1Close build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements TypeStage, _FinalStage { - private SpeakV1CloseType type; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(SpeakV1Close other) { - type(other.getType()); - return this; - } - - /** - * Message type identifier - * - *

Message type identifier - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("type") - public _FinalStage type(@NotNull SpeakV1CloseType type) { - this.type = Objects.requireNonNull(type, "type must not be null"); - return this; - } - - @java.lang.Override - public SpeakV1Close build() { - return new SpeakV1Close(type, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/speak/v1/types/SpeakV1CloseType.java b/src/main/java/resources/speak/v1/types/SpeakV1CloseType.java deleted file mode 100644 index d2e4f26..0000000 --- a/src/main/java/resources/speak/v1/types/SpeakV1CloseType.java +++ /dev/null @@ -1,92 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.speak.v1.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class SpeakV1CloseType { - public static final SpeakV1CloseType CLOSE = new SpeakV1CloseType(Value.CLOSE, "Close"); - - public static final SpeakV1CloseType FLUSH = new SpeakV1CloseType(Value.FLUSH, "Flush"); - - public static final SpeakV1CloseType CLEAR = new SpeakV1CloseType(Value.CLEAR, "Clear"); - - private final Value value; - - private final String string; - - SpeakV1CloseType(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof SpeakV1CloseType - && this.string.equals(((SpeakV1CloseType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case CLOSE: - return visitor.visitClose(); - case FLUSH: - return visitor.visitFlush(); - case CLEAR: - return visitor.visitClear(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static SpeakV1CloseType valueOf(String value) { - switch (value) { - case "Close": - return CLOSE; - case "Flush": - return FLUSH; - case "Clear": - return CLEAR; - default: - return new SpeakV1CloseType(Value.UNKNOWN, value); - } - } - - public enum Value { - FLUSH, - - CLEAR, - - CLOSE, - - UNKNOWN - } - - public interface Visitor { - T visitFlush(); - - T visitClear(); - - T visitClose(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/resources/speak/v1/types/SpeakV1Flush.java b/src/main/java/resources/speak/v1/types/SpeakV1Flush.java deleted file mode 100644 index d175a66..0000000 --- a/src/main/java/resources/speak/v1/types/SpeakV1Flush.java +++ /dev/null @@ -1,126 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.speak.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = SpeakV1Flush.Builder.class) -public final class SpeakV1Flush { - private final SpeakV1FlushType type; - - private final Map additionalProperties; - - private SpeakV1Flush(SpeakV1FlushType type, Map additionalProperties) { - this.type = type; - this.additionalProperties = additionalProperties; - } - - /** - * @return Message type identifier - */ - @JsonProperty("type") - public SpeakV1FlushType getType() { - return type; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SpeakV1Flush && equalTo((SpeakV1Flush) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(SpeakV1Flush other) { - return type.equals(other.type); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.type); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static TypeStage builder() { - return new Builder(); - } - - public interface TypeStage { - /** Message type identifier */ - _FinalStage type(@NotNull SpeakV1FlushType type); - - Builder from(SpeakV1Flush other); - } - - public interface _FinalStage { - SpeakV1Flush build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements TypeStage, _FinalStage { - private SpeakV1FlushType type; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(SpeakV1Flush other) { - type(other.getType()); - return this; - } - - /** - * Message type identifier - * - *

Message type identifier - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("type") - public _FinalStage type(@NotNull SpeakV1FlushType type) { - this.type = Objects.requireNonNull(type, "type must not be null"); - return this; - } - - @java.lang.Override - public SpeakV1Flush build() { - return new SpeakV1Flush(type, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/speak/v1/types/SpeakV1FlushType.java b/src/main/java/resources/speak/v1/types/SpeakV1FlushType.java deleted file mode 100644 index 1959fbf..0000000 --- a/src/main/java/resources/speak/v1/types/SpeakV1FlushType.java +++ /dev/null @@ -1,92 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.speak.v1.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class SpeakV1FlushType { - public static final SpeakV1FlushType CLOSE = new SpeakV1FlushType(Value.CLOSE, "Close"); - - public static final SpeakV1FlushType FLUSH = new SpeakV1FlushType(Value.FLUSH, "Flush"); - - public static final SpeakV1FlushType CLEAR = new SpeakV1FlushType(Value.CLEAR, "Clear"); - - private final Value value; - - private final String string; - - SpeakV1FlushType(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof SpeakV1FlushType - && this.string.equals(((SpeakV1FlushType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case CLOSE: - return visitor.visitClose(); - case FLUSH: - return visitor.visitFlush(); - case CLEAR: - return visitor.visitClear(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static SpeakV1FlushType valueOf(String value) { - switch (value) { - case "Close": - return CLOSE; - case "Flush": - return FLUSH; - case "Clear": - return CLEAR; - default: - return new SpeakV1FlushType(Value.UNKNOWN, value); - } - } - - public enum Value { - FLUSH, - - CLEAR, - - CLOSE, - - UNKNOWN - } - - public interface Visitor { - T visitFlush(); - - T visitClear(); - - T visitClose(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/resources/speak/v1/types/SpeakV1Flushed.java b/src/main/java/resources/speak/v1/types/SpeakV1Flushed.java deleted file mode 100644 index 45e0700..0000000 --- a/src/main/java/resources/speak/v1/types/SpeakV1Flushed.java +++ /dev/null @@ -1,160 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.speak.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = SpeakV1Flushed.Builder.class) -public final class SpeakV1Flushed { - private final SpeakV1FlushedType type; - - private final double sequenceId; - - private final Map additionalProperties; - - private SpeakV1Flushed( - SpeakV1FlushedType type, double sequenceId, Map additionalProperties) { - this.type = type; - this.sequenceId = sequenceId; - this.additionalProperties = additionalProperties; - } - - /** - * @return Message type identifier - */ - @JsonProperty("type") - public SpeakV1FlushedType getType() { - return type; - } - - /** - * @return The sequence ID of the response - */ - @JsonProperty("sequence_id") - public double getSequenceId() { - return sequenceId; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SpeakV1Flushed && equalTo((SpeakV1Flushed) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(SpeakV1Flushed other) { - return type.equals(other.type) && sequenceId == other.sequenceId; - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.type, this.sequenceId); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static TypeStage builder() { - return new Builder(); - } - - public interface TypeStage { - /** Message type identifier */ - SequenceIdStage type(@NotNull SpeakV1FlushedType type); - - Builder from(SpeakV1Flushed other); - } - - public interface SequenceIdStage { - /** The sequence ID of the response */ - _FinalStage sequenceId(double sequenceId); - } - - public interface _FinalStage { - SpeakV1Flushed build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements TypeStage, SequenceIdStage, _FinalStage { - private SpeakV1FlushedType type; - - private double sequenceId; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(SpeakV1Flushed other) { - type(other.getType()); - sequenceId(other.getSequenceId()); - return this; - } - - /** - * Message type identifier - * - *

Message type identifier - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("type") - public SequenceIdStage type(@NotNull SpeakV1FlushedType type) { - this.type = Objects.requireNonNull(type, "type must not be null"); - return this; - } - - /** - * The sequence ID of the response - * - *

The sequence ID of the response - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("sequence_id") - public _FinalStage sequenceId(double sequenceId) { - this.sequenceId = sequenceId; - return this; - } - - @java.lang.Override - public SpeakV1Flushed build() { - return new SpeakV1Flushed(type, sequenceId, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/speak/v1/types/SpeakV1FlushedType.java b/src/main/java/resources/speak/v1/types/SpeakV1FlushedType.java deleted file mode 100644 index 8c6666f..0000000 --- a/src/main/java/resources/speak/v1/types/SpeakV1FlushedType.java +++ /dev/null @@ -1,82 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.speak.v1.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class SpeakV1FlushedType { - public static final SpeakV1FlushedType CLEARED = new SpeakV1FlushedType(Value.CLEARED, "Cleared"); - - public static final SpeakV1FlushedType FLUSHED = new SpeakV1FlushedType(Value.FLUSHED, "Flushed"); - - private final Value value; - - private final String string; - - SpeakV1FlushedType(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof SpeakV1FlushedType - && this.string.equals(((SpeakV1FlushedType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case CLEARED: - return visitor.visitCleared(); - case FLUSHED: - return visitor.visitFlushed(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static SpeakV1FlushedType valueOf(String value) { - switch (value) { - case "Cleared": - return CLEARED; - case "Flushed": - return FLUSHED; - default: - return new SpeakV1FlushedType(Value.UNKNOWN, value); - } - } - - public enum Value { - FLUSHED, - - CLEARED, - - UNKNOWN - } - - public interface Visitor { - T visitFlushed(); - - T visitCleared(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/resources/speak/v1/types/SpeakV1Metadata.java b/src/main/java/resources/speak/v1/types/SpeakV1Metadata.java deleted file mode 100644 index 2e4535f..0000000 --- a/src/main/java/resources/speak/v1/types/SpeakV1Metadata.java +++ /dev/null @@ -1,296 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.speak.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = SpeakV1Metadata.Builder.class) -public final class SpeakV1Metadata { - private final String requestId; - - private final String modelName; - - private final String modelVersion; - - private final String modelUuid; - - private final Optional> additionalModelUuids; - - private final Map additionalProperties; - - private SpeakV1Metadata( - String requestId, - String modelName, - String modelVersion, - String modelUuid, - Optional> additionalModelUuids, - Map additionalProperties) { - this.requestId = requestId; - this.modelName = modelName; - this.modelVersion = modelVersion; - this.modelUuid = modelUuid; - this.additionalModelUuids = additionalModelUuids; - this.additionalProperties = additionalProperties; - } - - /** - * @return Message type identifier - */ - @JsonProperty("type") - public String getType() { - return "Metadata"; - } - - /** - * @return Unique identifier for the request - */ - @JsonProperty("request_id") - public String getRequestId() { - return requestId; - } - - /** - * @return Name of the model being used - */ - @JsonProperty("model_name") - public String getModelName() { - return modelName; - } - - /** - * @return Version of the primary model being used - */ - @JsonProperty("model_version") - public String getModelVersion() { - return modelVersion; - } - - /** - * @return Unique identifier for the primary model used - */ - @JsonProperty("model_uuid") - public String getModelUuid() { - return modelUuid; - } - - /** - * @return List of unique identifiers for any additional models used to serve the request - */ - @JsonProperty("additional_model_uuids") - public Optional> getAdditionalModelUuids() { - return additionalModelUuids; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SpeakV1Metadata && equalTo((SpeakV1Metadata) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(SpeakV1Metadata other) { - return requestId.equals(other.requestId) - && modelName.equals(other.modelName) - && modelVersion.equals(other.modelVersion) - && modelUuid.equals(other.modelUuid) - && additionalModelUuids.equals(other.additionalModelUuids); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.requestId, - this.modelName, - this.modelVersion, - this.modelUuid, - this.additionalModelUuids); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static RequestIdStage builder() { - return new Builder(); - } - - public interface RequestIdStage { - /** Unique identifier for the request */ - ModelNameStage requestId(@NotNull String requestId); - - Builder from(SpeakV1Metadata other); - } - - public interface ModelNameStage { - /** Name of the model being used */ - ModelVersionStage modelName(@NotNull String modelName); - } - - public interface ModelVersionStage { - /** Version of the primary model being used */ - ModelUuidStage modelVersion(@NotNull String modelVersion); - } - - public interface ModelUuidStage { - /** Unique identifier for the primary model used */ - _FinalStage modelUuid(@NotNull String modelUuid); - } - - public interface _FinalStage { - SpeakV1Metadata build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** List of unique identifiers for any additional models used to serve the request */ - _FinalStage additionalModelUuids(Optional> additionalModelUuids); - - _FinalStage additionalModelUuids(List additionalModelUuids); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements RequestIdStage, ModelNameStage, ModelVersionStage, ModelUuidStage, _FinalStage { - private String requestId; - - private String modelName; - - private String modelVersion; - - private String modelUuid; - - private Optional> additionalModelUuids = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(SpeakV1Metadata other) { - requestId(other.getRequestId()); - modelName(other.getModelName()); - modelVersion(other.getModelVersion()); - modelUuid(other.getModelUuid()); - additionalModelUuids(other.getAdditionalModelUuids()); - return this; - } - - /** - * Unique identifier for the request - * - *

Unique identifier for the request - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("request_id") - public ModelNameStage requestId(@NotNull String requestId) { - this.requestId = Objects.requireNonNull(requestId, "requestId must not be null"); - return this; - } - - /** - * Name of the model being used - * - *

Name of the model being used - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("model_name") - public ModelVersionStage modelName(@NotNull String modelName) { - this.modelName = Objects.requireNonNull(modelName, "modelName must not be null"); - return this; - } - - /** - * Version of the primary model being used - * - *

Version of the primary model being used - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("model_version") - public ModelUuidStage modelVersion(@NotNull String modelVersion) { - this.modelVersion = Objects.requireNonNull(modelVersion, "modelVersion must not be null"); - return this; - } - - /** - * Unique identifier for the primary model used - * - *

Unique identifier for the primary model used - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("model_uuid") - public _FinalStage modelUuid(@NotNull String modelUuid) { - this.modelUuid = Objects.requireNonNull(modelUuid, "modelUuid must not be null"); - return this; - } - - /** - * List of unique identifiers for any additional models used to serve the request - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage additionalModelUuids(List additionalModelUuids) { - this.additionalModelUuids = Optional.ofNullable(additionalModelUuids); - return this; - } - - /** List of unique identifiers for any additional models used to serve the request */ - @java.lang.Override - @JsonSetter(value = "additional_model_uuids", nulls = Nulls.SKIP) - public _FinalStage additionalModelUuids(Optional> additionalModelUuids) { - this.additionalModelUuids = additionalModelUuids; - return this; - } - - @java.lang.Override - public SpeakV1Metadata build() { - return new SpeakV1Metadata( - requestId, - modelName, - modelVersion, - modelUuid, - additionalModelUuids, - additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/speak/v1/types/SpeakV1Text.java b/src/main/java/resources/speak/v1/types/SpeakV1Text.java deleted file mode 100644 index beee588..0000000 --- a/src/main/java/resources/speak/v1/types/SpeakV1Text.java +++ /dev/null @@ -1,134 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.speak.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = SpeakV1Text.Builder.class) -public final class SpeakV1Text { - private final String text; - - private final Map additionalProperties; - - private SpeakV1Text(String text, Map additionalProperties) { - this.text = text; - this.additionalProperties = additionalProperties; - } - - /** - * @return Message type identifier - */ - @JsonProperty("type") - public String getType() { - return "Speak"; - } - - /** - * @return The input text to be converted to speech - */ - @JsonProperty("text") - public String getText() { - return text; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SpeakV1Text && equalTo((SpeakV1Text) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(SpeakV1Text other) { - return text.equals(other.text); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.text); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static TextStage builder() { - return new Builder(); - } - - public interface TextStage { - /** The input text to be converted to speech */ - _FinalStage text(@NotNull String text); - - Builder from(SpeakV1Text other); - } - - public interface _FinalStage { - SpeakV1Text build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements TextStage, _FinalStage { - private String text; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(SpeakV1Text other) { - text(other.getText()); - return this; - } - - /** - * The input text to be converted to speech - * - *

The input text to be converted to speech - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("text") - public _FinalStage text(@NotNull String text) { - this.text = Objects.requireNonNull(text, "text must not be null"); - return this; - } - - @java.lang.Override - public SpeakV1Text build() { - return new SpeakV1Text(text, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/speak/v1/types/SpeakV1Warning.java b/src/main/java/resources/speak/v1/types/SpeakV1Warning.java deleted file mode 100644 index ed9aa46..0000000 --- a/src/main/java/resources/speak/v1/types/SpeakV1Warning.java +++ /dev/null @@ -1,168 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.speak.v1.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = SpeakV1Warning.Builder.class) -public final class SpeakV1Warning { - private final String description; - - private final String code; - - private final Map additionalProperties; - - private SpeakV1Warning( - String description, String code, Map additionalProperties) { - this.description = description; - this.code = code; - this.additionalProperties = additionalProperties; - } - - /** - * @return Message type identifier - */ - @JsonProperty("type") - public String getType() { - return "Warning"; - } - - /** - * @return A description of what went wrong - */ - @JsonProperty("description") - public String getDescription() { - return description; - } - - /** - * @return Error code identifying the type of error - */ - @JsonProperty("code") - public String getCode() { - return code; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SpeakV1Warning && equalTo((SpeakV1Warning) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(SpeakV1Warning other) { - return description.equals(other.description) && code.equals(other.code); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.description, this.code); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static DescriptionStage builder() { - return new Builder(); - } - - public interface DescriptionStage { - /** A description of what went wrong */ - CodeStage description(@NotNull String description); - - Builder from(SpeakV1Warning other); - } - - public interface CodeStage { - /** Error code identifying the type of error */ - _FinalStage code(@NotNull String code); - } - - public interface _FinalStage { - SpeakV1Warning build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements DescriptionStage, CodeStage, _FinalStage { - private String description; - - private String code; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(SpeakV1Warning other) { - description(other.getDescription()); - code(other.getCode()); - return this; - } - - /** - * A description of what went wrong - * - *

A description of what went wrong - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("description") - public CodeStage description(@NotNull String description) { - this.description = Objects.requireNonNull(description, "description must not be null"); - return this; - } - - /** - * Error code identifying the type of error - * - *

Error code identifying the type of error - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("code") - public _FinalStage code(@NotNull String code) { - this.code = Objects.requireNonNull(code, "code must not be null"); - return this; - } - - @java.lang.Override - public SpeakV1Warning build() { - return new SpeakV1Warning(description, code, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/speak/v1/websocket/V1ConnectOptions.java b/src/main/java/resources/speak/v1/websocket/V1ConnectOptions.java deleted file mode 100644 index fbcc14b..0000000 --- a/src/main/java/resources/speak/v1/websocket/V1ConnectOptions.java +++ /dev/null @@ -1,180 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.speak.v1.websocket; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 core.ObjectMappers; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import types.SpeakV1Encoding; -import types.SpeakV1MipOptOut; -import types.SpeakV1Model; -import types.SpeakV1SampleRate; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = V1ConnectOptions.Builder.class) -public final class V1ConnectOptions { - private final Optional encoding; - - private final Optional mipOptOut; - - private final Optional model; - - private final Optional sampleRate; - - private final Map additionalProperties; - - private V1ConnectOptions( - Optional encoding, - Optional mipOptOut, - Optional model, - Optional sampleRate, - Map additionalProperties) { - this.encoding = encoding; - this.mipOptOut = mipOptOut; - this.model = model; - this.sampleRate = sampleRate; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("encoding") - public Optional getEncoding() { - return encoding; - } - - @JsonProperty("mip_opt_out") - public Optional getMipOptOut() { - return mipOptOut; - } - - @JsonProperty("model") - public Optional getModel() { - return model; - } - - @JsonProperty("sample_rate") - public Optional getSampleRate() { - return sampleRate; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof V1ConnectOptions && equalTo((V1ConnectOptions) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(V1ConnectOptions other) { - return encoding.equals(other.encoding) - && mipOptOut.equals(other.mipOptOut) - && model.equals(other.model) - && sampleRate.equals(other.sampleRate); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.encoding, this.mipOptOut, this.model, this.sampleRate); - } - - @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 encoding = Optional.empty(); - - private Optional mipOptOut = Optional.empty(); - - private Optional model = Optional.empty(); - - private Optional sampleRate = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(V1ConnectOptions other) { - encoding(other.getEncoding()); - mipOptOut(other.getMipOptOut()); - model(other.getModel()); - sampleRate(other.getSampleRate()); - return this; - } - - @JsonSetter(value = "encoding", nulls = Nulls.SKIP) - public Builder encoding(Optional encoding) { - this.encoding = encoding; - return this; - } - - public Builder encoding(SpeakV1Encoding encoding) { - this.encoding = Optional.ofNullable(encoding); - return this; - } - - @JsonSetter(value = "mip_opt_out", nulls = Nulls.SKIP) - public Builder mipOptOut(Optional mipOptOut) { - this.mipOptOut = mipOptOut; - return this; - } - - public Builder mipOptOut(SpeakV1MipOptOut mipOptOut) { - this.mipOptOut = Optional.ofNullable(mipOptOut); - return this; - } - - @JsonSetter(value = "model", nulls = Nulls.SKIP) - public Builder model(Optional model) { - this.model = model; - return this; - } - - public Builder model(SpeakV1Model model) { - this.model = Optional.ofNullable(model); - return this; - } - - @JsonSetter(value = "sample_rate", nulls = Nulls.SKIP) - public Builder sampleRate(Optional sampleRate) { - this.sampleRate = sampleRate; - return this; - } - - public Builder sampleRate(SpeakV1SampleRate sampleRate) { - this.sampleRate = Optional.ofNullable(sampleRate); - return this; - } - - public V1ConnectOptions build() { - return new V1ConnectOptions(encoding, mipOptOut, model, sampleRate, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/resources/speak/v1/websocket/V1WebSocketClient.java b/src/main/java/resources/speak/v1/websocket/V1WebSocketClient.java deleted file mode 100644 index 805aff0..0000000 --- a/src/main/java/resources/speak/v1/websocket/V1WebSocketClient.java +++ /dev/null @@ -1,438 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package resources.speak.v1.websocket; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import core.ClientOptions; -import core.DisconnectReason; -import core.ObjectMappers; -import core.ReconnectingWebSocketListener; -import core.WebSocketReadyState; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ScheduledExecutorService; -import java.util.function.Consumer; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import okhttp3.WebSocket; -import okio.ByteString; -import resources.speak.v1.types.SpeakV1Clear; -import resources.speak.v1.types.SpeakV1Cleared; -import resources.speak.v1.types.SpeakV1Close; -import resources.speak.v1.types.SpeakV1Flush; -import resources.speak.v1.types.SpeakV1Flushed; -import resources.speak.v1.types.SpeakV1Metadata; -import resources.speak.v1.types.SpeakV1Text; -import resources.speak.v1.types.SpeakV1Warning; - -/** - * WebSocket client for the v1 channel. Provides real-time bidirectional communication with - * strongly-typed messages. - */ -public class V1WebSocketClient implements AutoCloseable { - protected final ClientOptions clientOptions; - - private final ObjectMapper objectMapper; - - private final OkHttpClient okHttpClient; - - private ScheduledExecutorService timeoutExecutor; - - private volatile WebSocketReadyState readyState = WebSocketReadyState.CLOSED; - - private volatile Runnable onConnectedHandler; - - private volatile Consumer onDisconnectedHandler; - - private volatile Consumer onErrorHandler; - - private volatile Consumer onMessageHandler; - - private volatile ReconnectingWebSocketListener.ReconnectOptions reconnectOptions; - - private CompletableFuture connectionFuture; - - private ReconnectingWebSocketListener reconnectingListener; - - private volatile Consumer speakV1AudioHandler; - - private volatile Consumer metadataHandler; - - private volatile Consumer flushedHandler; - - private volatile Consumer clearedHandler; - - private volatile Consumer warningHandler; - - /** Creates a new async WebSocket client for the v1 channel. */ - public V1WebSocketClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.objectMapper = ObjectMappers.JSON_MAPPER; - this.okHttpClient = clientOptions.httpClient(); - } - - /** - * Establishes the WebSocket connection asynchronously with automatic reconnection. - * - * @return a CompletableFuture that completes when the connection is established - * @param options connection options including query parameters - */ - public CompletableFuture connect(V1ConnectOptions options) { - connectionFuture = new CompletableFuture<>(); - String baseUrl = clientOptions.environment().getProductionURL(); - String fullPath = "/v1/speak"; - if (baseUrl.endsWith("/") && fullPath.startsWith("/")) { - fullPath = fullPath.substring(1); - } else if (!baseUrl.endsWith("/") && !fullPath.startsWith("/")) { - fullPath = "/" + fullPath; - } - // OkHttp's HttpUrl only supports http/https schemes; convert wss/ws for URL parsing - if (baseUrl.startsWith("wss://")) { - baseUrl = "https://" + baseUrl.substring(6); - } else if (baseUrl.startsWith("ws://")) { - baseUrl = "http://" + baseUrl.substring(5); - } - HttpUrl parsedUrl = HttpUrl.parse(baseUrl + fullPath); - if (parsedUrl == null) { - throw new IllegalArgumentException("Invalid WebSocket URL: " + baseUrl + fullPath); - } - HttpUrl.Builder urlBuilder = parsedUrl.newBuilder(); - if (options.getEncoding() != null && options.getEncoding().isPresent()) { - urlBuilder.addQueryParameter("encoding", String.valueOf(options.getEncoding().get())); - } - if (options.getMipOptOut() != null && options.getMipOptOut().isPresent()) { - urlBuilder.addQueryParameter("mip_opt_out", String.valueOf(options.getMipOptOut().get())); - } - if (options.getModel() != null && options.getModel().isPresent()) { - urlBuilder.addQueryParameter("model", String.valueOf(options.getModel().get())); - } - if (options.getSampleRate() != null && options.getSampleRate().isPresent()) { - urlBuilder.addQueryParameter("sample_rate", String.valueOf(options.getSampleRate().get())); - } - Request.Builder requestBuilder = new Request.Builder().url(urlBuilder.build()); - clientOptions.headers(null).forEach(requestBuilder::addHeader); - final Request request = requestBuilder.build(); - this.readyState = WebSocketReadyState.CONNECTING; - ReconnectingWebSocketListener.ReconnectOptions reconnectOpts = - this.reconnectOptions != null - ? this.reconnectOptions - : ReconnectingWebSocketListener.ReconnectOptions.builder().build(); - this.reconnectingListener = - new ReconnectingWebSocketListener( - reconnectOpts, - () -> { - if (clientOptions.webSocketFactory().isPresent()) { - return clientOptions - .webSocketFactory() - .get() - .create(request, this.reconnectingListener); - } else { - return okHttpClient.newWebSocket(request, this.reconnectingListener); - } - }) { - @Override - protected void onWebSocketOpen(WebSocket webSocket, Response response) { - readyState = WebSocketReadyState.OPEN; - if (onConnectedHandler != null) { - onConnectedHandler.run(); - } - connectionFuture.complete(null); - } - - @Override - protected void onWebSocketMessage(WebSocket webSocket, String text) { - handleIncomingMessage(text); - } - - @Override - protected void onWebSocketBinaryMessage(WebSocket webSocket, ByteString bytes) { - if (speakV1AudioHandler != null) { - speakV1AudioHandler.accept(bytes); - } - } - - @Override - protected void onWebSocketFailure(WebSocket webSocket, Throwable t, Response response) { - readyState = WebSocketReadyState.CLOSED; - if (onErrorHandler != null) { - onErrorHandler.accept(new RuntimeException(t)); - } - connectionFuture.completeExceptionally(t); - } - - @Override - protected void onWebSocketClosed(WebSocket webSocket, int code, String reason) { - readyState = WebSocketReadyState.CLOSED; - if (onDisconnectedHandler != null) { - onDisconnectedHandler.accept(new DisconnectReason(code, reason)); - } - } - }; - reconnectingListener.connect(); - return connectionFuture; - } - - /** - * Establishes the WebSocket connection asynchronously with default options. - * - * @return a CompletableFuture that completes when the connection is established - */ - public CompletableFuture connect() { - return connect(V1ConnectOptions.builder().build()); - } - - /** Disconnects the WebSocket connection and releases resources. */ - public void disconnect() { - reconnectingListener.disconnect(); - if (timeoutExecutor != null) { - timeoutExecutor.shutdownNow(); - timeoutExecutor = null; - } - } - - /** - * Gets the current state of the WebSocket connection. - * - *

This provides the actual connection state, similar to the W3C WebSocket API. - * - * @return the current WebSocket ready state - */ - public WebSocketReadyState getReadyState() { - return readyState; - } - - /** - * Sends a SpeakV1Text message to the server asynchronously. - * - * @param message the message to send - * @return a CompletableFuture that completes when the message is sent - */ - public CompletableFuture sendText(SpeakV1Text message) { - return sendMessage(message); - } - - /** - * Sends a SpeakV1Flush message to the server asynchronously. - * - * @param message the message to send - * @return a CompletableFuture that completes when the message is sent - */ - public CompletableFuture sendFlush(SpeakV1Flush message) { - return sendMessage(message); - } - - /** - * Sends a SpeakV1Clear message to the server asynchronously. - * - * @param message the message to send - * @return a CompletableFuture that completes when the message is sent - */ - public CompletableFuture sendClear(SpeakV1Clear message) { - return sendMessage(message); - } - - /** - * Sends a SpeakV1Close message to the server asynchronously. - * - * @param message the message to send - * @return a CompletableFuture that completes when the message is sent - */ - public CompletableFuture sendClose(SpeakV1Close message) { - return sendMessage(message); - } - - /** - * Registers a handler for SpeakV1Audio messages from the server. - * - * @param handler the handler to invoke when a message is received - */ - public void onSpeakV1Audio(Consumer handler) { - this.speakV1AudioHandler = handler; - } - - /** - * Registers a handler for SpeakV1Metadata messages from the server. - * - * @param handler the handler to invoke when a message is received - */ - public void onMetadata(Consumer handler) { - this.metadataHandler = handler; - } - - /** - * Registers a handler for SpeakV1Flushed messages from the server. - * - * @param handler the handler to invoke when a message is received - */ - public void onFlushed(Consumer handler) { - this.flushedHandler = handler; - } - - /** - * Registers a handler for SpeakV1Cleared messages from the server. - * - * @param handler the handler to invoke when a message is received - */ - public void onCleared(Consumer handler) { - this.clearedHandler = handler; - } - - /** - * Registers a handler for SpeakV1Warning messages from the server. - * - * @param handler the handler to invoke when a message is received - */ - public void onWarning(Consumer handler) { - this.warningHandler = handler; - } - - /** - * Registers a handler called when the connection is established. - * - * @param handler the handler to invoke when connected - */ - public void onConnected(Runnable handler) { - this.onConnectedHandler = handler; - } - - /** - * Registers a handler called when the connection is closed. - * - * @param handler the handler to invoke when disconnected - */ - public void onDisconnected(Consumer handler) { - this.onDisconnectedHandler = handler; - } - - /** - * Registers a handler called when an error occurs. - * - * @param handler the handler to invoke on error - */ - public void onError(Consumer handler) { - this.onErrorHandler = handler; - } - - /** - * Registers a handler called for every incoming text message. The handler receives the raw JSON - * string before type-specific dispatch. - * - * @param handler the handler to invoke with the raw message JSON - */ - public void onMessage(Consumer handler) { - this.onMessageHandler = handler; - } - - /** - * Configures reconnection behavior. Must be called before {@link #connect}. - * - * @param options the reconnection options (backoff, retries, queue size) - */ - public void reconnectOptions(ReconnectingWebSocketListener.ReconnectOptions options) { - this.reconnectOptions = options; - } - - /** - * Closes this WebSocket client, releasing all resources. Equivalent to calling {@link - * #disconnect()}. - */ - @Override - public void close() { - disconnect(); - } - - /** - * Ensures the WebSocket is connected and ready to send messages. - * - * @throws IllegalStateException if the socket is not connected or not open - */ - private void assertSocketIsOpen() { - if (reconnectingListener.getWebSocket() == null) { - throw new IllegalStateException("WebSocket is not connected. Call connect() first."); - } - if (readyState != WebSocketReadyState.OPEN) { - throw new IllegalStateException("WebSocket is not open. Current state: " + readyState); - } - } - - private CompletableFuture sendMessage(Object body) { - CompletableFuture future = new CompletableFuture<>(); - try { - assertSocketIsOpen(); - String json = objectMapper.writeValueAsString(body); - // Use reconnecting listener's send method which handles queuing - reconnectingListener.send(json); - future.complete(null); - } catch (IllegalStateException e) { - future.completeExceptionally(e); - } catch (Exception e) { - future.completeExceptionally(new RuntimeException("Failed to send message", e)); - } - return future; - } - - private void handleIncomingMessage(String json) { - try { - if (onMessageHandler != null) { - onMessageHandler.accept(json); - } - JsonNode node = objectMapper.readTree(json); - if (node == null || node.isNull()) { - throw new IllegalArgumentException("Received null or invalid JSON message"); - } - JsonNode typeNode = node.get("type"); - if (typeNode == null || typeNode.isNull()) { - throw new IllegalArgumentException("Message missing 'type' field"); - } - String type = typeNode.asText(); - switch (type) { - case "Metadata": - if (metadataHandler != null) { - SpeakV1Metadata event = objectMapper.treeToValue(node, SpeakV1Metadata.class); - if (event != null) { - metadataHandler.accept(event); - } - } - break; - case "Flushed": - if (flushedHandler != null) { - SpeakV1Flushed event = objectMapper.treeToValue(node, SpeakV1Flushed.class); - if (event != null) { - flushedHandler.accept(event); - } - } - break; - case "Cleared": - if (clearedHandler != null) { - SpeakV1Cleared event = objectMapper.treeToValue(node, SpeakV1Cleared.class); - if (event != null) { - clearedHandler.accept(event); - } - } - break; - case "Warning": - if (warningHandler != null) { - SpeakV1Warning event = objectMapper.treeToValue(node, SpeakV1Warning.class); - if (event != null) { - warningHandler.accept(event); - } - } - break; - default: - if (onErrorHandler != null) { - onErrorHandler.accept( - new RuntimeException( - "Unknown WebSocket message type: '" - + type - + "'. Update your SDK version to support new message types.")); - } - break; - } - } catch (Exception e) { - if (onErrorHandler != null) { - onErrorHandler.accept(e); - } - } - } -} diff --git a/src/main/java/types/AgentThinkModelsV1Response.java b/src/main/java/types/AgentThinkModelsV1Response.java deleted file mode 100644 index 1c05584..0000000 --- a/src/main/java/types/AgentThinkModelsV1Response.java +++ /dev/null @@ -1,115 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = AgentThinkModelsV1Response.Builder.class) -public final class AgentThinkModelsV1Response { - private final List models; - - private final Map additionalProperties; - - private AgentThinkModelsV1Response( - List models, Map additionalProperties) { - this.models = models; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("models") - public List getModels() { - return models; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AgentThinkModelsV1Response - && equalTo((AgentThinkModelsV1Response) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(AgentThinkModelsV1Response other) { - return models.equals(other.models); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.models); - } - - @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 models = new ArrayList<>(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(AgentThinkModelsV1Response other) { - models(other.getModels()); - return this; - } - - @JsonSetter(value = "models", nulls = Nulls.SKIP) - public Builder models(List models) { - this.models.clear(); - if (models != null) { - this.models.addAll(models); - } - return this; - } - - public Builder addModels(AgentThinkModelsV1ResponseModelsItem models) { - this.models.add(models); - return this; - } - - public Builder addAllModels(List models) { - if (models != null) { - this.models.addAll(models); - } - return this; - } - - public AgentThinkModelsV1Response build() { - return new AgentThinkModelsV1Response(models, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/AgentThinkModelsV1ResponseModelsItem.java b/src/main/java/types/AgentThinkModelsV1ResponseModelsItem.java deleted file mode 100644 index ac889be..0000000 --- a/src/main/java/types/AgentThinkModelsV1ResponseModelsItem.java +++ /dev/null @@ -1,146 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package 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 core.ObjectMappers; -import java.io.IOException; -import java.util.Objects; - -@JsonDeserialize(using = AgentThinkModelsV1ResponseModelsItem.Deserializer.class) -public final class AgentThinkModelsV1ResponseModelsItem { - private final Object value; - - private final int type; - - private AgentThinkModelsV1ResponseModelsItem(Object value, int type) { - this.value = value; - this.type = type; - } - - @JsonValue - public Object get() { - return this.value; - } - - @SuppressWarnings("unchecked") - public T visit(Visitor visitor) { - if (this.type == 0) { - return visitor.visit((AgentThinkModelsV1ResponseModelsItemZero) this.value); - } else if (this.type == 1) { - return visitor.visit((AgentThinkModelsV1ResponseModelsItemOne) this.value); - } else if (this.type == 2) { - return visitor.visit((AgentThinkModelsV1ResponseModelsItemTwo) this.value); - } else if (this.type == 3) { - return visitor.visit((AgentThinkModelsV1ResponseModelsItemThree) this.value); - } else if (this.type == 4) { - return visitor.visit((AgentThinkModelsV1ResponseModelsItemId) 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 AgentThinkModelsV1ResponseModelsItem - && equalTo((AgentThinkModelsV1ResponseModelsItem) other); - } - - private boolean equalTo(AgentThinkModelsV1ResponseModelsItem 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 AgentThinkModelsV1ResponseModelsItem of( - AgentThinkModelsV1ResponseModelsItemZero value) { - return new AgentThinkModelsV1ResponseModelsItem(value, 0); - } - - public static AgentThinkModelsV1ResponseModelsItem of( - AgentThinkModelsV1ResponseModelsItemOne value) { - return new AgentThinkModelsV1ResponseModelsItem(value, 1); - } - - public static AgentThinkModelsV1ResponseModelsItem of( - AgentThinkModelsV1ResponseModelsItemTwo value) { - return new AgentThinkModelsV1ResponseModelsItem(value, 2); - } - - public static AgentThinkModelsV1ResponseModelsItem of( - AgentThinkModelsV1ResponseModelsItemThree value) { - return new AgentThinkModelsV1ResponseModelsItem(value, 3); - } - - public static AgentThinkModelsV1ResponseModelsItem of( - AgentThinkModelsV1ResponseModelsItemId value) { - return new AgentThinkModelsV1ResponseModelsItem(value, 4); - } - - public interface Visitor { - T visit(AgentThinkModelsV1ResponseModelsItemZero value); - - T visit(AgentThinkModelsV1ResponseModelsItemOne value); - - T visit(AgentThinkModelsV1ResponseModelsItemTwo value); - - T visit(AgentThinkModelsV1ResponseModelsItemThree value); - - T visit(AgentThinkModelsV1ResponseModelsItemId value); - } - - static final class Deserializer extends StdDeserializer { - Deserializer() { - super(AgentThinkModelsV1ResponseModelsItem.class); - } - - @java.lang.Override - public AgentThinkModelsV1ResponseModelsItem deserialize( - JsonParser p, DeserializationContext context) throws IOException { - Object value = p.readValueAs(Object.class); - try { - return of( - ObjectMappers.JSON_MAPPER.convertValue( - value, AgentThinkModelsV1ResponseModelsItemZero.class)); - } catch (RuntimeException e) { - } - try { - return of( - ObjectMappers.JSON_MAPPER.convertValue( - value, AgentThinkModelsV1ResponseModelsItemOne.class)); - } catch (RuntimeException e) { - } - try { - return of( - ObjectMappers.JSON_MAPPER.convertValue( - value, AgentThinkModelsV1ResponseModelsItemTwo.class)); - } catch (RuntimeException e) { - } - try { - return of( - ObjectMappers.JSON_MAPPER.convertValue( - value, AgentThinkModelsV1ResponseModelsItemThree.class)); - } catch (RuntimeException e) { - } - try { - return of( - ObjectMappers.JSON_MAPPER.convertValue( - value, AgentThinkModelsV1ResponseModelsItemId.class)); - } catch (RuntimeException e) { - } - throw new JsonParseException(p, "Failed to deserialize"); - } - } -} diff --git a/src/main/java/types/AgentThinkModelsV1ResponseModelsItemId.java b/src/main/java/types/AgentThinkModelsV1ResponseModelsItemId.java deleted file mode 100644 index 1a44082..0000000 --- a/src/main/java/types/AgentThinkModelsV1ResponseModelsItemId.java +++ /dev/null @@ -1,169 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = AgentThinkModelsV1ResponseModelsItemId.Builder.class) -public final class AgentThinkModelsV1ResponseModelsItemId { - private final String id; - - private final String name; - - private final Map additionalProperties; - - private AgentThinkModelsV1ResponseModelsItemId( - String id, String name, Map additionalProperties) { - this.id = id; - this.name = name; - this.additionalProperties = additionalProperties; - } - - /** - * @return The unique identifier of the AWS Bedrock model (any model string accepted for BYO LLMs) - */ - @JsonProperty("id") - public String getId() { - return id; - } - - /** - * @return The display name of the model - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * @return The provider of the model - */ - @JsonProperty("provider") - public String getProvider() { - return "aws_bedrock"; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AgentThinkModelsV1ResponseModelsItemId - && equalTo((AgentThinkModelsV1ResponseModelsItemId) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(AgentThinkModelsV1ResponseModelsItemId other) { - return id.equals(other.id) && name.equals(other.name); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.id, this.name); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - /** The unique identifier of the AWS Bedrock model (any model string accepted for BYO LLMs) */ - NameStage id(@NotNull String id); - - Builder from(AgentThinkModelsV1ResponseModelsItemId other); - } - - public interface NameStage { - /** The display name of the model */ - _FinalStage name(@NotNull String name); - } - - public interface _FinalStage { - AgentThinkModelsV1ResponseModelsItemId build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements IdStage, NameStage, _FinalStage { - private String id; - - private String name; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(AgentThinkModelsV1ResponseModelsItemId other) { - id(other.getId()); - name(other.getName()); - return this; - } - - /** - * The unique identifier of the AWS Bedrock model (any model string accepted for BYO LLMs) - * - *

The unique identifier of the AWS Bedrock model (any model string accepted for BYO LLMs) - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("id") - public NameStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - /** - * The display name of the model - * - *

The display name of the model - * - * @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 AgentThinkModelsV1ResponseModelsItemId build() { - return new AgentThinkModelsV1ResponseModelsItemId(id, name, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/AgentThinkModelsV1ResponseModelsItemOne.java b/src/main/java/types/AgentThinkModelsV1ResponseModelsItemOne.java deleted file mode 100644 index 8c46f41..0000000 --- a/src/main/java/types/AgentThinkModelsV1ResponseModelsItemOne.java +++ /dev/null @@ -1,171 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = AgentThinkModelsV1ResponseModelsItemOne.Builder.class) -public final class AgentThinkModelsV1ResponseModelsItemOne { - private final AgentThinkModelsV1ResponseModelsItemOneId id; - - private final String name; - - private final Map additionalProperties; - - private AgentThinkModelsV1ResponseModelsItemOne( - AgentThinkModelsV1ResponseModelsItemOneId id, - String name, - Map additionalProperties) { - this.id = id; - this.name = name; - this.additionalProperties = additionalProperties; - } - - /** - * @return The unique identifier of the Anthropic model - */ - @JsonProperty("id") - public AgentThinkModelsV1ResponseModelsItemOneId getId() { - return id; - } - - /** - * @return The display name of the model - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * @return The provider of the model - */ - @JsonProperty("provider") - public String getProvider() { - return "anthropic"; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AgentThinkModelsV1ResponseModelsItemOne - && equalTo((AgentThinkModelsV1ResponseModelsItemOne) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(AgentThinkModelsV1ResponseModelsItemOne other) { - return id.equals(other.id) && name.equals(other.name); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.id, this.name); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - /** The unique identifier of the Anthropic model */ - NameStage id(@NotNull AgentThinkModelsV1ResponseModelsItemOneId id); - - Builder from(AgentThinkModelsV1ResponseModelsItemOne other); - } - - public interface NameStage { - /** The display name of the model */ - _FinalStage name(@NotNull String name); - } - - public interface _FinalStage { - AgentThinkModelsV1ResponseModelsItemOne build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements IdStage, NameStage, _FinalStage { - private AgentThinkModelsV1ResponseModelsItemOneId id; - - private String name; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(AgentThinkModelsV1ResponseModelsItemOne other) { - id(other.getId()); - name(other.getName()); - return this; - } - - /** - * The unique identifier of the Anthropic model - * - *

The unique identifier of the Anthropic model - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("id") - public NameStage id(@NotNull AgentThinkModelsV1ResponseModelsItemOneId id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - /** - * The display name of the model - * - *

The display name of the model - * - * @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 AgentThinkModelsV1ResponseModelsItemOne build() { - return new AgentThinkModelsV1ResponseModelsItemOne(id, name, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/AgentThinkModelsV1ResponseModelsItemOneId.java b/src/main/java/types/AgentThinkModelsV1ResponseModelsItemOneId.java deleted file mode 100644 index 18bc094..0000000 --- a/src/main/java/types/AgentThinkModelsV1ResponseModelsItemOneId.java +++ /dev/null @@ -1,86 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class AgentThinkModelsV1ResponseModelsItemOneId { - public static final AgentThinkModelsV1ResponseModelsItemOneId CLAUDE_SONNET420250514 = - new AgentThinkModelsV1ResponseModelsItemOneId( - Value.CLAUDE_SONNET420250514, "claude-sonnet-4-20250514"); - - public static final AgentThinkModelsV1ResponseModelsItemOneId CLAUDE35HAIKU_LATEST = - new AgentThinkModelsV1ResponseModelsItemOneId( - Value.CLAUDE35HAIKU_LATEST, "claude-3-5-haiku-latest"); - - private final Value value; - - private final String string; - - AgentThinkModelsV1ResponseModelsItemOneId(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof AgentThinkModelsV1ResponseModelsItemOneId - && this.string.equals(((AgentThinkModelsV1ResponseModelsItemOneId) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case CLAUDE_SONNET420250514: - return visitor.visitClaudeSonnet420250514(); - case CLAUDE35HAIKU_LATEST: - return visitor.visitClaude35HaikuLatest(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static AgentThinkModelsV1ResponseModelsItemOneId valueOf(String value) { - switch (value) { - case "claude-sonnet-4-20250514": - return CLAUDE_SONNET420250514; - case "claude-3-5-haiku-latest": - return CLAUDE35HAIKU_LATEST; - default: - return new AgentThinkModelsV1ResponseModelsItemOneId(Value.UNKNOWN, value); - } - } - - public enum Value { - CLAUDE35HAIKU_LATEST, - - CLAUDE_SONNET420250514, - - UNKNOWN - } - - public interface Visitor { - T visitClaude35HaikuLatest(); - - T visitClaudeSonnet420250514(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/types/AgentThinkModelsV1ResponseModelsItemThree.java b/src/main/java/types/AgentThinkModelsV1ResponseModelsItemThree.java deleted file mode 100644 index 45f5385..0000000 --- a/src/main/java/types/AgentThinkModelsV1ResponseModelsItemThree.java +++ /dev/null @@ -1,144 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = AgentThinkModelsV1ResponseModelsItemThree.Builder.class) -public final class AgentThinkModelsV1ResponseModelsItemThree { - private final String name; - - private final Map additionalProperties; - - private AgentThinkModelsV1ResponseModelsItemThree( - String name, Map additionalProperties) { - this.name = name; - this.additionalProperties = additionalProperties; - } - - /** - * @return The unique identifier of the Groq model - */ - @JsonProperty("id") - public String getId() { - return "openai/gpt-oss-20b"; - } - - /** - * @return The display name of the model - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * @return The provider of the model - */ - @JsonProperty("provider") - public String getProvider() { - return "groq"; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AgentThinkModelsV1ResponseModelsItemThree - && equalTo((AgentThinkModelsV1ResponseModelsItemThree) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(AgentThinkModelsV1ResponseModelsItemThree 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 NameStage builder() { - return new Builder(); - } - - public interface NameStage { - /** The display name of the model */ - _FinalStage name(@NotNull String name); - - Builder from(AgentThinkModelsV1ResponseModelsItemThree other); - } - - public interface _FinalStage { - AgentThinkModelsV1ResponseModelsItemThree build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements NameStage, _FinalStage { - private String name; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(AgentThinkModelsV1ResponseModelsItemThree other) { - name(other.getName()); - return this; - } - - /** - * The display name of the model - * - *

The display name of the model - * - * @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 AgentThinkModelsV1ResponseModelsItemThree build() { - return new AgentThinkModelsV1ResponseModelsItemThree(name, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/AgentThinkModelsV1ResponseModelsItemTwo.java b/src/main/java/types/AgentThinkModelsV1ResponseModelsItemTwo.java deleted file mode 100644 index 5d129c1..0000000 --- a/src/main/java/types/AgentThinkModelsV1ResponseModelsItemTwo.java +++ /dev/null @@ -1,171 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = AgentThinkModelsV1ResponseModelsItemTwo.Builder.class) -public final class AgentThinkModelsV1ResponseModelsItemTwo { - private final AgentThinkModelsV1ResponseModelsItemTwoId id; - - private final String name; - - private final Map additionalProperties; - - private AgentThinkModelsV1ResponseModelsItemTwo( - AgentThinkModelsV1ResponseModelsItemTwoId id, - String name, - Map additionalProperties) { - this.id = id; - this.name = name; - this.additionalProperties = additionalProperties; - } - - /** - * @return The unique identifier of the Google model - */ - @JsonProperty("id") - public AgentThinkModelsV1ResponseModelsItemTwoId getId() { - return id; - } - - /** - * @return The display name of the model - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * @return The provider of the model - */ - @JsonProperty("provider") - public String getProvider() { - return "google"; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AgentThinkModelsV1ResponseModelsItemTwo - && equalTo((AgentThinkModelsV1ResponseModelsItemTwo) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(AgentThinkModelsV1ResponseModelsItemTwo other) { - return id.equals(other.id) && name.equals(other.name); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.id, this.name); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - /** The unique identifier of the Google model */ - NameStage id(@NotNull AgentThinkModelsV1ResponseModelsItemTwoId id); - - Builder from(AgentThinkModelsV1ResponseModelsItemTwo other); - } - - public interface NameStage { - /** The display name of the model */ - _FinalStage name(@NotNull String name); - } - - public interface _FinalStage { - AgentThinkModelsV1ResponseModelsItemTwo build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements IdStage, NameStage, _FinalStage { - private AgentThinkModelsV1ResponseModelsItemTwoId id; - - private String name; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(AgentThinkModelsV1ResponseModelsItemTwo other) { - id(other.getId()); - name(other.getName()); - return this; - } - - /** - * The unique identifier of the Google model - * - *

The unique identifier of the Google model - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("id") - public NameStage id(@NotNull AgentThinkModelsV1ResponseModelsItemTwoId id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - /** - * The display name of the model - * - *

The display name of the model - * - * @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 AgentThinkModelsV1ResponseModelsItemTwo build() { - return new AgentThinkModelsV1ResponseModelsItemTwo(id, name, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/AgentThinkModelsV1ResponseModelsItemTwoId.java b/src/main/java/types/AgentThinkModelsV1ResponseModelsItemTwoId.java deleted file mode 100644 index db967ef..0000000 --- a/src/main/java/types/AgentThinkModelsV1ResponseModelsItemTwoId.java +++ /dev/null @@ -1,96 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class AgentThinkModelsV1ResponseModelsItemTwoId { - public static final AgentThinkModelsV1ResponseModelsItemTwoId GEMINI20FLASH_LITE = - new AgentThinkModelsV1ResponseModelsItemTwoId( - Value.GEMINI20FLASH_LITE, "gemini-2.0-flash-lite"); - - public static final AgentThinkModelsV1ResponseModelsItemTwoId GEMINI25FLASH = - new AgentThinkModelsV1ResponseModelsItemTwoId(Value.GEMINI25FLASH, "gemini-2.5-flash"); - - public static final AgentThinkModelsV1ResponseModelsItemTwoId GEMINI20FLASH = - new AgentThinkModelsV1ResponseModelsItemTwoId(Value.GEMINI20FLASH, "gemini-2.0-flash"); - - private final Value value; - - private final String string; - - AgentThinkModelsV1ResponseModelsItemTwoId(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof AgentThinkModelsV1ResponseModelsItemTwoId - && this.string.equals(((AgentThinkModelsV1ResponseModelsItemTwoId) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case GEMINI20FLASH_LITE: - return visitor.visitGemini20FlashLite(); - case GEMINI25FLASH: - return visitor.visitGemini25Flash(); - case GEMINI20FLASH: - return visitor.visitGemini20Flash(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static AgentThinkModelsV1ResponseModelsItemTwoId valueOf(String value) { - switch (value) { - case "gemini-2.0-flash-lite": - return GEMINI20FLASH_LITE; - case "gemini-2.5-flash": - return GEMINI25FLASH; - case "gemini-2.0-flash": - return GEMINI20FLASH; - default: - return new AgentThinkModelsV1ResponseModelsItemTwoId(Value.UNKNOWN, value); - } - } - - public enum Value { - GEMINI25FLASH, - - GEMINI20FLASH, - - GEMINI20FLASH_LITE, - - UNKNOWN - } - - public interface Visitor { - T visitGemini25Flash(); - - T visitGemini20Flash(); - - T visitGemini20FlashLite(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/types/AgentThinkModelsV1ResponseModelsItemZero.java b/src/main/java/types/AgentThinkModelsV1ResponseModelsItemZero.java deleted file mode 100644 index d7dce67..0000000 --- a/src/main/java/types/AgentThinkModelsV1ResponseModelsItemZero.java +++ /dev/null @@ -1,171 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = AgentThinkModelsV1ResponseModelsItemZero.Builder.class) -public final class AgentThinkModelsV1ResponseModelsItemZero { - private final AgentThinkModelsV1ResponseModelsItemZeroId id; - - private final String name; - - private final Map additionalProperties; - - private AgentThinkModelsV1ResponseModelsItemZero( - AgentThinkModelsV1ResponseModelsItemZeroId id, - String name, - Map additionalProperties) { - this.id = id; - this.name = name; - this.additionalProperties = additionalProperties; - } - - /** - * @return The unique identifier of the OpenAI model - */ - @JsonProperty("id") - public AgentThinkModelsV1ResponseModelsItemZeroId getId() { - return id; - } - - /** - * @return The display name of the model - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * @return The provider of the model - */ - @JsonProperty("provider") - public String getProvider() { - return "open_ai"; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AgentThinkModelsV1ResponseModelsItemZero - && equalTo((AgentThinkModelsV1ResponseModelsItemZero) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(AgentThinkModelsV1ResponseModelsItemZero other) { - return id.equals(other.id) && name.equals(other.name); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.id, this.name); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - /** The unique identifier of the OpenAI model */ - NameStage id(@NotNull AgentThinkModelsV1ResponseModelsItemZeroId id); - - Builder from(AgentThinkModelsV1ResponseModelsItemZero other); - } - - public interface NameStage { - /** The display name of the model */ - _FinalStage name(@NotNull String name); - } - - public interface _FinalStage { - AgentThinkModelsV1ResponseModelsItemZero build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements IdStage, NameStage, _FinalStage { - private AgentThinkModelsV1ResponseModelsItemZeroId id; - - private String name; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(AgentThinkModelsV1ResponseModelsItemZero other) { - id(other.getId()); - name(other.getName()); - return this; - } - - /** - * The unique identifier of the OpenAI model - * - *

The unique identifier of the OpenAI model - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("id") - public NameStage id(@NotNull AgentThinkModelsV1ResponseModelsItemZeroId id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - /** - * The display name of the model - * - *

The display name of the model - * - * @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 AgentThinkModelsV1ResponseModelsItemZero build() { - return new AgentThinkModelsV1ResponseModelsItemZero(id, name, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/AgentThinkModelsV1ResponseModelsItemZeroId.java b/src/main/java/types/AgentThinkModelsV1ResponseModelsItemZeroId.java deleted file mode 100644 index 25d0977..0000000 --- a/src/main/java/types/AgentThinkModelsV1ResponseModelsItemZeroId.java +++ /dev/null @@ -1,150 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class AgentThinkModelsV1ResponseModelsItemZeroId { - public static final AgentThinkModelsV1ResponseModelsItemZeroId GPT5MINI = - new AgentThinkModelsV1ResponseModelsItemZeroId(Value.GPT5MINI, "gpt-5-mini"); - - public static final AgentThinkModelsV1ResponseModelsItemZeroId GPT4O_MINI = - new AgentThinkModelsV1ResponseModelsItemZeroId(Value.GPT4O_MINI, "gpt-4o-mini"); - - public static final AgentThinkModelsV1ResponseModelsItemZeroId GPT4O = - new AgentThinkModelsV1ResponseModelsItemZeroId(Value.GPT4O, "gpt-4o"); - - public static final AgentThinkModelsV1ResponseModelsItemZeroId GPT41NANO = - new AgentThinkModelsV1ResponseModelsItemZeroId(Value.GPT41NANO, "gpt-4.1-nano"); - - public static final AgentThinkModelsV1ResponseModelsItemZeroId GPT5 = - new AgentThinkModelsV1ResponseModelsItemZeroId(Value.GPT5, "gpt-5"); - - public static final AgentThinkModelsV1ResponseModelsItemZeroId GPT41MINI = - new AgentThinkModelsV1ResponseModelsItemZeroId(Value.GPT41MINI, "gpt-4.1-mini"); - - public static final AgentThinkModelsV1ResponseModelsItemZeroId GPT5NANO = - new AgentThinkModelsV1ResponseModelsItemZeroId(Value.GPT5NANO, "gpt-5-nano"); - - public static final AgentThinkModelsV1ResponseModelsItemZeroId GPT41 = - new AgentThinkModelsV1ResponseModelsItemZeroId(Value.GPT41, "gpt-4.1"); - - private final Value value; - - private final String string; - - AgentThinkModelsV1ResponseModelsItemZeroId(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof AgentThinkModelsV1ResponseModelsItemZeroId - && this.string.equals(((AgentThinkModelsV1ResponseModelsItemZeroId) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case GPT5MINI: - return visitor.visitGpt5Mini(); - case GPT4O_MINI: - return visitor.visitGpt4OMini(); - case GPT4O: - return visitor.visitGpt4O(); - case GPT41NANO: - return visitor.visitGpt41Nano(); - case GPT5: - return visitor.visitGpt5(); - case GPT41MINI: - return visitor.visitGpt41Mini(); - case GPT5NANO: - return visitor.visitGpt5Nano(); - case GPT41: - return visitor.visitGpt41(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static AgentThinkModelsV1ResponseModelsItemZeroId valueOf(String value) { - switch (value) { - case "gpt-5-mini": - return GPT5MINI; - case "gpt-4o-mini": - return GPT4O_MINI; - case "gpt-4o": - return GPT4O; - case "gpt-4.1-nano": - return GPT41NANO; - case "gpt-5": - return GPT5; - case "gpt-4.1-mini": - return GPT41MINI; - case "gpt-5-nano": - return GPT5NANO; - case "gpt-4.1": - return GPT41; - default: - return new AgentThinkModelsV1ResponseModelsItemZeroId(Value.UNKNOWN, value); - } - } - - public enum Value { - GPT5, - - GPT5MINI, - - GPT5NANO, - - GPT41, - - GPT41MINI, - - GPT41NANO, - - GPT4O, - - GPT4O_MINI, - - UNKNOWN - } - - public interface Visitor { - T visitGpt5(); - - T visitGpt5Mini(); - - T visitGpt5Nano(); - - T visitGpt41(); - - T visitGpt41Mini(); - - T visitGpt41Nano(); - - T visitGpt4O(); - - T visitGpt4OMini(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/types/Anthropic.java b/src/main/java/types/Anthropic.java deleted file mode 100644 index 2745a3c..0000000 --- a/src/main/java/types/Anthropic.java +++ /dev/null @@ -1,215 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = Anthropic.Builder.class) -public final class Anthropic { - private final Optional version; - - private final AnthropicThinkProviderModel model; - - private final Optional temperature; - - private final Map additionalProperties; - - private Anthropic( - Optional version, - AnthropicThinkProviderModel model, - Optional temperature, - Map additionalProperties) { - this.version = version; - this.model = model; - this.temperature = temperature; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("type") - public String getType() { - return "anthropic"; - } - - /** - * @return The REST API version for the Anthropic Messages API - */ - @JsonProperty("version") - public Optional getVersion() { - return version; - } - - /** - * @return Anthropic model to use - */ - @JsonProperty("model") - public AnthropicThinkProviderModel getModel() { - return model; - } - - /** - * @return Anthropic temperature (0-1) - */ - @JsonProperty("temperature") - public Optional getTemperature() { - return temperature; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof Anthropic && equalTo((Anthropic) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(Anthropic other) { - return version.equals(other.version) - && model.equals(other.model) - && temperature.equals(other.temperature); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.version, this.model, this.temperature); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static ModelStage builder() { - return new Builder(); - } - - public interface ModelStage { - /** Anthropic model to use */ - _FinalStage model(@NotNull AnthropicThinkProviderModel model); - - Builder from(Anthropic other); - } - - public interface _FinalStage { - Anthropic build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** The REST API version for the Anthropic Messages API */ - _FinalStage version(Optional version); - - _FinalStage version(String version); - - /** Anthropic temperature (0-1) */ - _FinalStage temperature(Optional temperature); - - _FinalStage temperature(Double temperature); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements ModelStage, _FinalStage { - private AnthropicThinkProviderModel model; - - private Optional temperature = Optional.empty(); - - private Optional version = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(Anthropic other) { - version(other.getVersion()); - model(other.getModel()); - temperature(other.getTemperature()); - return this; - } - - /** - * Anthropic model to use - * - *

Anthropic model to use - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("model") - public _FinalStage model(@NotNull AnthropicThinkProviderModel model) { - this.model = Objects.requireNonNull(model, "model must not be null"); - return this; - } - - /** - * Anthropic temperature (0-1) - * - * @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; - } - - /** Anthropic temperature (0-1) */ - @java.lang.Override - @JsonSetter(value = "temperature", nulls = Nulls.SKIP) - public _FinalStage temperature(Optional temperature) { - this.temperature = temperature; - return this; - } - - /** - * The REST API version for the Anthropic Messages API - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage version(String version) { - this.version = Optional.ofNullable(version); - return this; - } - - /** The REST API version for the Anthropic Messages API */ - @java.lang.Override - @JsonSetter(value = "version", nulls = Nulls.SKIP) - public _FinalStage version(Optional version) { - this.version = version; - return this; - } - - @java.lang.Override - public Anthropic build() { - return new Anthropic(version, model, temperature, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/AnthropicThinkProviderModel.java b/src/main/java/types/AnthropicThinkProviderModel.java deleted file mode 100644 index 3438fb2..0000000 --- a/src/main/java/types/AnthropicThinkProviderModel.java +++ /dev/null @@ -1,84 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class AnthropicThinkProviderModel { - public static final AnthropicThinkProviderModel CLAUDE_SONNET420250514 = - new AnthropicThinkProviderModel(Value.CLAUDE_SONNET420250514, "claude-sonnet-4-20250514"); - - public static final AnthropicThinkProviderModel CLAUDE35HAIKU_LATEST = - new AnthropicThinkProviderModel(Value.CLAUDE35HAIKU_LATEST, "claude-3-5-haiku-latest"); - - private final Value value; - - private final String string; - - AnthropicThinkProviderModel(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof AnthropicThinkProviderModel - && this.string.equals(((AnthropicThinkProviderModel) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case CLAUDE_SONNET420250514: - return visitor.visitClaudeSonnet420250514(); - case CLAUDE35HAIKU_LATEST: - return visitor.visitClaude35HaikuLatest(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static AnthropicThinkProviderModel valueOf(String value) { - switch (value) { - case "claude-sonnet-4-20250514": - return CLAUDE_SONNET420250514; - case "claude-3-5-haiku-latest": - return CLAUDE35HAIKU_LATEST; - default: - return new AnthropicThinkProviderModel(Value.UNKNOWN, value); - } - } - - public enum Value { - CLAUDE35HAIKU_LATEST, - - CLAUDE_SONNET420250514, - - UNKNOWN - } - - public interface Visitor { - T visitClaude35HaikuLatest(); - - T visitClaudeSonnet420250514(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/types/AwsBedrockThinkProvider.java b/src/main/java/types/AwsBedrockThinkProvider.java deleted file mode 100644 index e113b87..0000000 --- a/src/main/java/types/AwsBedrockThinkProvider.java +++ /dev/null @@ -1,215 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = AwsBedrockThinkProvider.Builder.class) -public final class AwsBedrockThinkProvider { - private final AwsBedrockThinkProviderModel model; - - private final Optional temperature; - - private final Optional credentials; - - private final Map additionalProperties; - - private AwsBedrockThinkProvider( - AwsBedrockThinkProviderModel model, - Optional temperature, - Optional credentials, - Map additionalProperties) { - this.model = model; - this.temperature = temperature; - this.credentials = credentials; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("type") - public String getType() { - return "aws_bedrock"; - } - - /** - * @return AWS Bedrock model to use - */ - @JsonProperty("model") - public AwsBedrockThinkProviderModel getModel() { - return model; - } - - /** - * @return AWS Bedrock temperature (0-2) - */ - @JsonProperty("temperature") - public Optional getTemperature() { - return temperature; - } - - /** - * @return AWS credentials type (STS short-lived or IAM long-lived) - */ - @JsonProperty("credentials") - public Optional getCredentials() { - return credentials; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AwsBedrockThinkProvider && equalTo((AwsBedrockThinkProvider) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(AwsBedrockThinkProvider other) { - return model.equals(other.model) - && temperature.equals(other.temperature) - && credentials.equals(other.credentials); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.model, this.temperature, this.credentials); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static ModelStage builder() { - return new Builder(); - } - - public interface ModelStage { - /** AWS Bedrock model to use */ - _FinalStage model(@NotNull AwsBedrockThinkProviderModel model); - - Builder from(AwsBedrockThinkProvider other); - } - - public interface _FinalStage { - AwsBedrockThinkProvider build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** AWS Bedrock temperature (0-2) */ - _FinalStage temperature(Optional temperature); - - _FinalStage temperature(Double temperature); - - /** AWS credentials type (STS short-lived or IAM long-lived) */ - _FinalStage credentials(Optional credentials); - - _FinalStage credentials(AwsBedrockThinkProviderCredentials credentials); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements ModelStage, _FinalStage { - private AwsBedrockThinkProviderModel model; - - private Optional credentials = Optional.empty(); - - private Optional temperature = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(AwsBedrockThinkProvider other) { - model(other.getModel()); - temperature(other.getTemperature()); - credentials(other.getCredentials()); - return this; - } - - /** - * AWS Bedrock model to use - * - *

AWS Bedrock model to use - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("model") - public _FinalStage model(@NotNull AwsBedrockThinkProviderModel model) { - this.model = Objects.requireNonNull(model, "model must not be null"); - return this; - } - - /** - * AWS credentials type (STS short-lived or IAM long-lived) - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage credentials(AwsBedrockThinkProviderCredentials credentials) { - this.credentials = Optional.ofNullable(credentials); - return this; - } - - /** AWS credentials type (STS short-lived or IAM long-lived) */ - @java.lang.Override - @JsonSetter(value = "credentials", nulls = Nulls.SKIP) - public _FinalStage credentials(Optional credentials) { - this.credentials = credentials; - return this; - } - - /** - * AWS Bedrock temperature (0-2) - * - * @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; - } - - /** AWS Bedrock temperature (0-2) */ - @java.lang.Override - @JsonSetter(value = "temperature", nulls = Nulls.SKIP) - public _FinalStage temperature(Optional temperature) { - this.temperature = temperature; - return this; - } - - @java.lang.Override - public AwsBedrockThinkProvider build() { - return new AwsBedrockThinkProvider(model, temperature, credentials, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/AwsBedrockThinkProviderCredentials.java b/src/main/java/types/AwsBedrockThinkProviderCredentials.java deleted file mode 100644 index 6d473c1..0000000 --- a/src/main/java/types/AwsBedrockThinkProviderCredentials.java +++ /dev/null @@ -1,223 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = AwsBedrockThinkProviderCredentials.Builder.class) -public final class AwsBedrockThinkProviderCredentials { - private final Optional type; - - private final Optional region; - - private final Optional accessKeyId; - - private final Optional secretAccessKey; - - private final Optional sessionToken; - - private final Map additionalProperties; - - private AwsBedrockThinkProviderCredentials( - Optional type, - Optional region, - Optional accessKeyId, - Optional secretAccessKey, - Optional sessionToken, - Map additionalProperties) { - this.type = type; - this.region = region; - this.accessKeyId = accessKeyId; - this.secretAccessKey = secretAccessKey; - this.sessionToken = sessionToken; - this.additionalProperties = additionalProperties; - } - - /** - * @return AWS credentials type (STS short-lived or IAM long-lived) - */ - @JsonProperty("type") - public Optional getType() { - return type; - } - - /** - * @return AWS region - */ - @JsonProperty("region") - public Optional getRegion() { - return region; - } - - /** - * @return AWS access key - */ - @JsonProperty("access_key_id") - public Optional getAccessKeyId() { - return accessKeyId; - } - - /** - * @return AWS secret access key - */ - @JsonProperty("secret_access_key") - public Optional getSecretAccessKey() { - return secretAccessKey; - } - - /** - * @return AWS session token (required for STS only) - */ - @JsonProperty("session_token") - public Optional getSessionToken() { - return sessionToken; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AwsBedrockThinkProviderCredentials - && equalTo((AwsBedrockThinkProviderCredentials) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(AwsBedrockThinkProviderCredentials other) { - return type.equals(other.type) - && region.equals(other.region) - && accessKeyId.equals(other.accessKeyId) - && secretAccessKey.equals(other.secretAccessKey) - && sessionToken.equals(other.sessionToken); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.type, this.region, this.accessKeyId, this.secretAccessKey, this.sessionToken); - } - - @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 type = Optional.empty(); - - private Optional region = Optional.empty(); - - private Optional accessKeyId = Optional.empty(); - - private Optional secretAccessKey = Optional.empty(); - - private Optional sessionToken = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(AwsBedrockThinkProviderCredentials other) { - type(other.getType()); - region(other.getRegion()); - accessKeyId(other.getAccessKeyId()); - secretAccessKey(other.getSecretAccessKey()); - sessionToken(other.getSessionToken()); - return this; - } - - /** AWS credentials type (STS short-lived or IAM long-lived) */ - @JsonSetter(value = "type", nulls = Nulls.SKIP) - public Builder type(Optional type) { - this.type = type; - return this; - } - - public Builder type(AwsBedrockThinkProviderCredentialsType type) { - this.type = Optional.ofNullable(type); - return this; - } - - /** AWS region */ - @JsonSetter(value = "region", nulls = Nulls.SKIP) - public Builder region(Optional region) { - this.region = region; - return this; - } - - public Builder region(String region) { - this.region = Optional.ofNullable(region); - return this; - } - - /** AWS access key */ - @JsonSetter(value = "access_key_id", nulls = Nulls.SKIP) - public Builder accessKeyId(Optional accessKeyId) { - this.accessKeyId = accessKeyId; - return this; - } - - public Builder accessKeyId(String accessKeyId) { - this.accessKeyId = Optional.ofNullable(accessKeyId); - return this; - } - - /** AWS secret access key */ - @JsonSetter(value = "secret_access_key", nulls = Nulls.SKIP) - public Builder secretAccessKey(Optional secretAccessKey) { - this.secretAccessKey = secretAccessKey; - return this; - } - - public Builder secretAccessKey(String secretAccessKey) { - this.secretAccessKey = Optional.ofNullable(secretAccessKey); - return this; - } - - /** AWS session token (required for STS only) */ - @JsonSetter(value = "session_token", nulls = Nulls.SKIP) - public Builder sessionToken(Optional sessionToken) { - this.sessionToken = sessionToken; - return this; - } - - public Builder sessionToken(String sessionToken) { - this.sessionToken = Optional.ofNullable(sessionToken); - return this; - } - - public AwsBedrockThinkProviderCredentials build() { - return new AwsBedrockThinkProviderCredentials( - type, region, accessKeyId, secretAccessKey, sessionToken, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/AwsBedrockThinkProviderCredentialsType.java b/src/main/java/types/AwsBedrockThinkProviderCredentialsType.java deleted file mode 100644 index d55e007..0000000 --- a/src/main/java/types/AwsBedrockThinkProviderCredentialsType.java +++ /dev/null @@ -1,84 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class AwsBedrockThinkProviderCredentialsType { - public static final AwsBedrockThinkProviderCredentialsType IAM = - new AwsBedrockThinkProviderCredentialsType(Value.IAM, "iam"); - - public static final AwsBedrockThinkProviderCredentialsType STS = - new AwsBedrockThinkProviderCredentialsType(Value.STS, "sts"); - - private final Value value; - - private final String string; - - AwsBedrockThinkProviderCredentialsType(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof AwsBedrockThinkProviderCredentialsType - && this.string.equals(((AwsBedrockThinkProviderCredentialsType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case IAM: - return visitor.visitIam(); - case STS: - return visitor.visitSts(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static AwsBedrockThinkProviderCredentialsType valueOf(String value) { - switch (value) { - case "iam": - return IAM; - case "sts": - return STS; - default: - return new AwsBedrockThinkProviderCredentialsType(Value.UNKNOWN, value); - } - } - - public enum Value { - STS, - - IAM, - - UNKNOWN - } - - public interface Visitor { - T visitSts(); - - T visitIam(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/types/AwsBedrockThinkProviderModel.java b/src/main/java/types/AwsBedrockThinkProviderModel.java deleted file mode 100644 index 73f0676..0000000 --- a/src/main/java/types/AwsBedrockThinkProviderModel.java +++ /dev/null @@ -1,86 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class AwsBedrockThinkProviderModel { - public static final AwsBedrockThinkProviderModel ANTHROPIC_CLAUDE35HAIKU20240307V10 = - new AwsBedrockThinkProviderModel( - Value.ANTHROPIC_CLAUDE35HAIKU20240307V10, "anthropic/claude-3-5-haiku-20240307-v1:0"); - - public static final AwsBedrockThinkProviderModel ANTHROPIC_CLAUDE35SONNET20240620V10 = - new AwsBedrockThinkProviderModel( - Value.ANTHROPIC_CLAUDE35SONNET20240620V10, "anthropic/claude-3-5-sonnet-20240620-v1:0"); - - private final Value value; - - private final String string; - - AwsBedrockThinkProviderModel(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof AwsBedrockThinkProviderModel - && this.string.equals(((AwsBedrockThinkProviderModel) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case ANTHROPIC_CLAUDE35HAIKU20240307V10: - return visitor.visitAnthropicClaude35Haiku20240307V10(); - case ANTHROPIC_CLAUDE35SONNET20240620V10: - return visitor.visitAnthropicClaude35Sonnet20240620V10(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static AwsBedrockThinkProviderModel valueOf(String value) { - switch (value) { - case "anthropic/claude-3-5-haiku-20240307-v1:0": - return ANTHROPIC_CLAUDE35HAIKU20240307V10; - case "anthropic/claude-3-5-sonnet-20240620-v1:0": - return ANTHROPIC_CLAUDE35SONNET20240620V10; - default: - return new AwsBedrockThinkProviderModel(Value.UNKNOWN, value); - } - } - - public enum Value { - ANTHROPIC_CLAUDE35SONNET20240620V10, - - ANTHROPIC_CLAUDE35HAIKU20240307V10, - - UNKNOWN - } - - public interface Visitor { - T visitAnthropicClaude35Sonnet20240620V10(); - - T visitAnthropicClaude35Haiku20240307V10(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/types/AwsPollySpeakProvider.java b/src/main/java/types/AwsPollySpeakProvider.java deleted file mode 100644 index a6b0a44..0000000 --- a/src/main/java/types/AwsPollySpeakProvider.java +++ /dev/null @@ -1,267 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = AwsPollySpeakProvider.Builder.class) -public final class AwsPollySpeakProvider { - private final AwsPollySpeakProviderVoice voice; - - private final String language; - - private final Optional languageCode; - - private final AwsPollySpeakProviderEngine engine; - - private final AwsPollySpeakProviderCredentials credentials; - - private final Map additionalProperties; - - private AwsPollySpeakProvider( - AwsPollySpeakProviderVoice voice, - String language, - Optional languageCode, - AwsPollySpeakProviderEngine engine, - AwsPollySpeakProviderCredentials credentials, - Map additionalProperties) { - this.voice = voice; - this.language = language; - this.languageCode = languageCode; - this.engine = engine; - this.credentials = credentials; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("type") - public String getType() { - return "aws_polly"; - } - - /** - * @return AWS Polly voice name - */ - @JsonProperty("voice") - public AwsPollySpeakProviderVoice getVoice() { - return voice; - } - - /** - * @return Language code to use, e.g. 'en-US'. Corresponds to the language_code - * parameter in the AWS Polly API - */ - @JsonProperty("language") - public String getLanguage() { - return language; - } - - /** - * @return Use the language field instead. - */ - @JsonProperty("language_code") - public Optional getLanguageCode() { - return languageCode; - } - - @JsonProperty("engine") - public AwsPollySpeakProviderEngine getEngine() { - return engine; - } - - @JsonProperty("credentials") - public AwsPollySpeakProviderCredentials getCredentials() { - return credentials; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AwsPollySpeakProvider && equalTo((AwsPollySpeakProvider) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(AwsPollySpeakProvider other) { - return voice.equals(other.voice) - && language.equals(other.language) - && languageCode.equals(other.languageCode) - && engine.equals(other.engine) - && credentials.equals(other.credentials); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.voice, this.language, this.languageCode, this.engine, this.credentials); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static VoiceStage builder() { - return new Builder(); - } - - public interface VoiceStage { - /** AWS Polly voice name */ - LanguageStage voice(@NotNull AwsPollySpeakProviderVoice voice); - - Builder from(AwsPollySpeakProvider other); - } - - public interface LanguageStage { - /** - * Language code to use, e.g. 'en-US'. Corresponds to the language_code parameter - * in the AWS Polly API - */ - EngineStage language(@NotNull String language); - } - - public interface EngineStage { - CredentialsStage engine(@NotNull AwsPollySpeakProviderEngine engine); - } - - public interface CredentialsStage { - _FinalStage credentials(@NotNull AwsPollySpeakProviderCredentials credentials); - } - - public interface _FinalStage { - AwsPollySpeakProvider build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** Use the language field instead. */ - _FinalStage languageCode(Optional languageCode); - - _FinalStage languageCode(String languageCode); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements VoiceStage, LanguageStage, EngineStage, CredentialsStage, _FinalStage { - private AwsPollySpeakProviderVoice voice; - - private String language; - - private AwsPollySpeakProviderEngine engine; - - private AwsPollySpeakProviderCredentials credentials; - - private Optional languageCode = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(AwsPollySpeakProvider other) { - voice(other.getVoice()); - language(other.getLanguage()); - languageCode(other.getLanguageCode()); - engine(other.getEngine()); - credentials(other.getCredentials()); - return this; - } - - /** - * AWS Polly voice name - * - *

AWS Polly voice name - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("voice") - public LanguageStage voice(@NotNull AwsPollySpeakProviderVoice voice) { - this.voice = Objects.requireNonNull(voice, "voice must not be null"); - return this; - } - - /** - * Language code to use, e.g. 'en-US'. Corresponds to the language_code parameter - * in the AWS Polly API - * - *

Language code to use, e.g. 'en-US'. Corresponds to the language_code - * parameter in the AWS Polly API - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("language") - public EngineStage language(@NotNull String language) { - this.language = Objects.requireNonNull(language, "language must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("engine") - public CredentialsStage engine(@NotNull AwsPollySpeakProviderEngine engine) { - this.engine = Objects.requireNonNull(engine, "engine must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("credentials") - public _FinalStage credentials(@NotNull AwsPollySpeakProviderCredentials credentials) { - this.credentials = Objects.requireNonNull(credentials, "credentials must not be null"); - return this; - } - - /** - * Use the language field instead. - * - * @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; - } - - /** Use the language field instead. */ - @java.lang.Override - @JsonSetter(value = "language_code", nulls = Nulls.SKIP) - public _FinalStage languageCode(Optional languageCode) { - this.languageCode = languageCode; - return this; - } - - @java.lang.Override - public AwsPollySpeakProvider build() { - return new AwsPollySpeakProvider( - voice, language, languageCode, engine, credentials, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/AwsPollySpeakProviderCredentials.java b/src/main/java/types/AwsPollySpeakProviderCredentials.java deleted file mode 100644 index 499b414..0000000 --- a/src/main/java/types/AwsPollySpeakProviderCredentials.java +++ /dev/null @@ -1,236 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = AwsPollySpeakProviderCredentials.Builder.class) -public final class AwsPollySpeakProviderCredentials { - private final AwsPollySpeakProviderCredentialsType type; - - private final String region; - - private final String accessKeyId; - - private final String secretAccessKey; - - private final Optional sessionToken; - - private final Map additionalProperties; - - private AwsPollySpeakProviderCredentials( - AwsPollySpeakProviderCredentialsType type, - String region, - String accessKeyId, - String secretAccessKey, - Optional sessionToken, - Map additionalProperties) { - this.type = type; - this.region = region; - this.accessKeyId = accessKeyId; - this.secretAccessKey = secretAccessKey; - this.sessionToken = sessionToken; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("type") - public AwsPollySpeakProviderCredentialsType getType() { - return type; - } - - @JsonProperty("region") - public String getRegion() { - return region; - } - - @JsonProperty("access_key_id") - public String getAccessKeyId() { - return accessKeyId; - } - - @JsonProperty("secret_access_key") - public String getSecretAccessKey() { - return secretAccessKey; - } - - /** - * @return Required for STS only - */ - @JsonProperty("session_token") - public Optional getSessionToken() { - return sessionToken; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AwsPollySpeakProviderCredentials - && equalTo((AwsPollySpeakProviderCredentials) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(AwsPollySpeakProviderCredentials other) { - return type.equals(other.type) - && region.equals(other.region) - && accessKeyId.equals(other.accessKeyId) - && secretAccessKey.equals(other.secretAccessKey) - && sessionToken.equals(other.sessionToken); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.type, this.region, this.accessKeyId, this.secretAccessKey, this.sessionToken); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static TypeStage builder() { - return new Builder(); - } - - public interface TypeStage { - RegionStage type(@NotNull AwsPollySpeakProviderCredentialsType type); - - Builder from(AwsPollySpeakProviderCredentials other); - } - - public interface RegionStage { - AccessKeyIdStage region(@NotNull String region); - } - - public interface AccessKeyIdStage { - SecretAccessKeyStage accessKeyId(@NotNull String accessKeyId); - } - - public interface SecretAccessKeyStage { - _FinalStage secretAccessKey(@NotNull String secretAccessKey); - } - - public interface _FinalStage { - AwsPollySpeakProviderCredentials build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** Required for STS only */ - _FinalStage sessionToken(Optional sessionToken); - - _FinalStage sessionToken(String sessionToken); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements TypeStage, RegionStage, AccessKeyIdStage, SecretAccessKeyStage, _FinalStage { - private AwsPollySpeakProviderCredentialsType type; - - private String region; - - private String accessKeyId; - - private String secretAccessKey; - - private Optional sessionToken = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(AwsPollySpeakProviderCredentials other) { - type(other.getType()); - region(other.getRegion()); - accessKeyId(other.getAccessKeyId()); - secretAccessKey(other.getSecretAccessKey()); - sessionToken(other.getSessionToken()); - return this; - } - - @java.lang.Override - @JsonSetter("type") - public RegionStage type(@NotNull AwsPollySpeakProviderCredentialsType type) { - this.type = Objects.requireNonNull(type, "type must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("region") - public AccessKeyIdStage region(@NotNull String region) { - this.region = Objects.requireNonNull(region, "region must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("access_key_id") - public SecretAccessKeyStage accessKeyId(@NotNull String accessKeyId) { - this.accessKeyId = Objects.requireNonNull(accessKeyId, "accessKeyId must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("secret_access_key") - public _FinalStage secretAccessKey(@NotNull String secretAccessKey) { - this.secretAccessKey = - Objects.requireNonNull(secretAccessKey, "secretAccessKey must not be null"); - return this; - } - - /** - * Required for STS only - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage sessionToken(String sessionToken) { - this.sessionToken = Optional.ofNullable(sessionToken); - return this; - } - - /** Required for STS only */ - @java.lang.Override - @JsonSetter(value = "session_token", nulls = Nulls.SKIP) - public _FinalStage sessionToken(Optional sessionToken) { - this.sessionToken = sessionToken; - return this; - } - - @java.lang.Override - public AwsPollySpeakProviderCredentials build() { - return new AwsPollySpeakProviderCredentials( - type, region, accessKeyId, secretAccessKey, sessionToken, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/AwsPollySpeakProviderCredentialsType.java b/src/main/java/types/AwsPollySpeakProviderCredentialsType.java deleted file mode 100644 index aa36cb7..0000000 --- a/src/main/java/types/AwsPollySpeakProviderCredentialsType.java +++ /dev/null @@ -1,84 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class AwsPollySpeakProviderCredentialsType { - public static final AwsPollySpeakProviderCredentialsType IAM = - new AwsPollySpeakProviderCredentialsType(Value.IAM, "iam"); - - public static final AwsPollySpeakProviderCredentialsType STS = - new AwsPollySpeakProviderCredentialsType(Value.STS, "sts"); - - private final Value value; - - private final String string; - - AwsPollySpeakProviderCredentialsType(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof AwsPollySpeakProviderCredentialsType - && this.string.equals(((AwsPollySpeakProviderCredentialsType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case IAM: - return visitor.visitIam(); - case STS: - return visitor.visitSts(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static AwsPollySpeakProviderCredentialsType valueOf(String value) { - switch (value) { - case "iam": - return IAM; - case "sts": - return STS; - default: - return new AwsPollySpeakProviderCredentialsType(Value.UNKNOWN, value); - } - } - - public enum Value { - STS, - - IAM, - - UNKNOWN - } - - public interface Visitor { - T visitSts(); - - T visitIam(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/types/AwsPollySpeakProviderEngine.java b/src/main/java/types/AwsPollySpeakProviderEngine.java deleted file mode 100644 index a76ca5f..0000000 --- a/src/main/java/types/AwsPollySpeakProviderEngine.java +++ /dev/null @@ -1,106 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class AwsPollySpeakProviderEngine { - public static final AwsPollySpeakProviderEngine LONG_FORM = - new AwsPollySpeakProviderEngine(Value.LONG_FORM, "long-form"); - - public static final AwsPollySpeakProviderEngine STANDARD = - new AwsPollySpeakProviderEngine(Value.STANDARD, "standard"); - - public static final AwsPollySpeakProviderEngine GENERATIVE = - new AwsPollySpeakProviderEngine(Value.GENERATIVE, "generative"); - - public static final AwsPollySpeakProviderEngine NEURAL = - new AwsPollySpeakProviderEngine(Value.NEURAL, "neural"); - - private final Value value; - - private final String string; - - AwsPollySpeakProviderEngine(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof AwsPollySpeakProviderEngine - && this.string.equals(((AwsPollySpeakProviderEngine) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case LONG_FORM: - return visitor.visitLongForm(); - case STANDARD: - return visitor.visitStandard(); - case GENERATIVE: - return visitor.visitGenerative(); - case NEURAL: - return visitor.visitNeural(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static AwsPollySpeakProviderEngine valueOf(String value) { - switch (value) { - case "long-form": - return LONG_FORM; - case "standard": - return STANDARD; - case "generative": - return GENERATIVE; - case "neural": - return NEURAL; - default: - return new AwsPollySpeakProviderEngine(Value.UNKNOWN, value); - } - } - - public enum Value { - GENERATIVE, - - LONG_FORM, - - STANDARD, - - NEURAL, - - UNKNOWN - } - - public interface Visitor { - T visitGenerative(); - - T visitLongForm(); - - T visitStandard(); - - T visitNeural(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/types/AwsPollySpeakProviderVoice.java b/src/main/java/types/AwsPollySpeakProviderVoice.java deleted file mode 100644 index cfbbae9..0000000 --- a/src/main/java/types/AwsPollySpeakProviderVoice.java +++ /dev/null @@ -1,150 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class AwsPollySpeakProviderVoice { - public static final AwsPollySpeakProviderVoice ARTHUR = - new AwsPollySpeakProviderVoice(Value.ARTHUR, "Arthur"); - - public static final AwsPollySpeakProviderVoice JOANNA = - new AwsPollySpeakProviderVoice(Value.JOANNA, "Joanna"); - - public static final AwsPollySpeakProviderVoice BRIAN = - new AwsPollySpeakProviderVoice(Value.BRIAN, "Brian"); - - public static final AwsPollySpeakProviderVoice AMY = - new AwsPollySpeakProviderVoice(Value.AMY, "Amy"); - - public static final AwsPollySpeakProviderVoice EMMA = - new AwsPollySpeakProviderVoice(Value.EMMA, "Emma"); - - public static final AwsPollySpeakProviderVoice MATTHEW = - new AwsPollySpeakProviderVoice(Value.MATTHEW, "Matthew"); - - public static final AwsPollySpeakProviderVoice ARIA = - new AwsPollySpeakProviderVoice(Value.ARIA, "Aria"); - - public static final AwsPollySpeakProviderVoice AYANDA = - new AwsPollySpeakProviderVoice(Value.AYANDA, "Ayanda"); - - private final Value value; - - private final String string; - - AwsPollySpeakProviderVoice(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof AwsPollySpeakProviderVoice - && this.string.equals(((AwsPollySpeakProviderVoice) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case ARTHUR: - return visitor.visitArthur(); - case JOANNA: - return visitor.visitJoanna(); - case BRIAN: - return visitor.visitBrian(); - case AMY: - return visitor.visitAmy(); - case EMMA: - return visitor.visitEmma(); - case MATTHEW: - return visitor.visitMatthew(); - case ARIA: - return visitor.visitAria(); - case AYANDA: - return visitor.visitAyanda(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static AwsPollySpeakProviderVoice valueOf(String value) { - switch (value) { - case "Arthur": - return ARTHUR; - case "Joanna": - return JOANNA; - case "Brian": - return BRIAN; - case "Amy": - return AMY; - case "Emma": - return EMMA; - case "Matthew": - return MATTHEW; - case "Aria": - return ARIA; - case "Ayanda": - return AYANDA; - default: - return new AwsPollySpeakProviderVoice(Value.UNKNOWN, value); - } - } - - public enum Value { - MATTHEW, - - JOANNA, - - AMY, - - EMMA, - - BRIAN, - - ARTHUR, - - ARIA, - - AYANDA, - - UNKNOWN - } - - public interface Visitor { - T visitMatthew(); - - T visitJoanna(); - - T visitAmy(); - - T visitEmma(); - - T visitBrian(); - - T visitArthur(); - - T visitAria(); - - T visitAyanda(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/types/BillingBreakdownV1Response.java b/src/main/java/types/BillingBreakdownV1Response.java deleted file mode 100644 index b161fcc..0000000 --- a/src/main/java/types/BillingBreakdownV1Response.java +++ /dev/null @@ -1,234 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = BillingBreakdownV1Response.Builder.class) -public final class BillingBreakdownV1Response { - private final String start; - - private final String end; - - private final BillingBreakdownV1ResponseResolution resolution; - - private final List results; - - private final Map additionalProperties; - - private BillingBreakdownV1Response( - String start, - String end, - BillingBreakdownV1ResponseResolution resolution, - List results, - Map additionalProperties) { - this.start = start; - this.end = end; - this.resolution = resolution; - this.results = results; - this.additionalProperties = additionalProperties; - } - - /** - * @return Start date of the billing summmary period - */ - @JsonProperty("start") - public String getStart() { - return start; - } - - /** - * @return End date of the billing summary period - */ - @JsonProperty("end") - public String getEnd() { - return end; - } - - @JsonProperty("resolution") - public BillingBreakdownV1ResponseResolution getResolution() { - return resolution; - } - - @JsonProperty("results") - public List getResults() { - return results; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof BillingBreakdownV1Response - && equalTo((BillingBreakdownV1Response) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(BillingBreakdownV1Response other) { - return start.equals(other.start) - && end.equals(other.end) - && resolution.equals(other.resolution) - && results.equals(other.results); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.start, this.end, this.resolution, this.results); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static StartStage builder() { - return new Builder(); - } - - public interface StartStage { - /** Start date of the billing summmary period */ - EndStage start(@NotNull String start); - - Builder from(BillingBreakdownV1Response other); - } - - public interface EndStage { - /** End date of the billing summary period */ - ResolutionStage end(@NotNull String end); - } - - public interface ResolutionStage { - _FinalStage resolution(@NotNull BillingBreakdownV1ResponseResolution resolution); - } - - public interface _FinalStage { - BillingBreakdownV1Response build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - _FinalStage results(List results); - - _FinalStage addResults(BillingBreakdownV1ResponseResultsItem results); - - _FinalStage addAllResults(List results); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements StartStage, EndStage, ResolutionStage, _FinalStage { - private String start; - - private String end; - - private BillingBreakdownV1ResponseResolution resolution; - - private List results = new ArrayList<>(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(BillingBreakdownV1Response other) { - start(other.getStart()); - end(other.getEnd()); - resolution(other.getResolution()); - results(other.getResults()); - return this; - } - - /** - * Start date of the billing summmary period - * - *

Start date of the billing summmary period - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("start") - public EndStage start(@NotNull String start) { - this.start = Objects.requireNonNull(start, "start must not be null"); - return this; - } - - /** - * End date of the billing summary period - * - *

End date of the billing summary period - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("end") - public ResolutionStage end(@NotNull String end) { - this.end = Objects.requireNonNull(end, "end must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("resolution") - public _FinalStage resolution(@NotNull BillingBreakdownV1ResponseResolution resolution) { - this.resolution = Objects.requireNonNull(resolution, "resolution must not be null"); - return this; - } - - @java.lang.Override - public _FinalStage addAllResults(List results) { - if (results != null) { - this.results.addAll(results); - } - return this; - } - - @java.lang.Override - public _FinalStage addResults(BillingBreakdownV1ResponseResultsItem results) { - this.results.add(results); - return this; - } - - @java.lang.Override - @JsonSetter(value = "results", nulls = Nulls.SKIP) - public _FinalStage results(List results) { - this.results.clear(); - if (results != null) { - this.results.addAll(results); - } - return this; - } - - @java.lang.Override - public BillingBreakdownV1Response build() { - return new BillingBreakdownV1Response(start, end, resolution, results, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/BillingBreakdownV1ResponseResolution.java b/src/main/java/types/BillingBreakdownV1ResponseResolution.java deleted file mode 100644 index f0a7853..0000000 --- a/src/main/java/types/BillingBreakdownV1ResponseResolution.java +++ /dev/null @@ -1,161 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = BillingBreakdownV1ResponseResolution.Builder.class) -public final class BillingBreakdownV1ResponseResolution { - private final String units; - - private final double amount; - - private final Map additionalProperties; - - private BillingBreakdownV1ResponseResolution( - String units, double amount, Map additionalProperties) { - this.units = units; - this.amount = amount; - this.additionalProperties = additionalProperties; - } - - /** - * @return Time unit for the resolution - */ - @JsonProperty("units") - public String getUnits() { - return units; - } - - /** - * @return Amount of units - */ - @JsonProperty("amount") - public double getAmount() { - return amount; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof BillingBreakdownV1ResponseResolution - && equalTo((BillingBreakdownV1ResponseResolution) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(BillingBreakdownV1ResponseResolution other) { - return units.equals(other.units) && amount == other.amount; - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.units, this.amount); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static UnitsStage builder() { - return new Builder(); - } - - public interface UnitsStage { - /** Time unit for the resolution */ - AmountStage units(@NotNull String units); - - Builder from(BillingBreakdownV1ResponseResolution other); - } - - public interface AmountStage { - /** Amount of units */ - _FinalStage amount(double amount); - } - - public interface _FinalStage { - BillingBreakdownV1ResponseResolution build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements UnitsStage, AmountStage, _FinalStage { - private String units; - - private double amount; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(BillingBreakdownV1ResponseResolution other) { - units(other.getUnits()); - amount(other.getAmount()); - return this; - } - - /** - * Time unit for the resolution - * - *

Time unit for the resolution - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("units") - public AmountStage units(@NotNull String units) { - this.units = Objects.requireNonNull(units, "units must not be null"); - return this; - } - - /** - * Amount of units - * - *

Amount of units - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("amount") - public _FinalStage amount(double amount) { - this.amount = amount; - return this; - } - - @java.lang.Override - public BillingBreakdownV1ResponseResolution build() { - return new BillingBreakdownV1ResponseResolution(units, amount, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/BillingBreakdownV1ResponseResultsItem.java b/src/main/java/types/BillingBreakdownV1ResponseResultsItem.java deleted file mode 100644 index 92e1f4f..0000000 --- a/src/main/java/types/BillingBreakdownV1ResponseResultsItem.java +++ /dev/null @@ -1,152 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = BillingBreakdownV1ResponseResultsItem.Builder.class) -public final class BillingBreakdownV1ResponseResultsItem { - private final float dollars; - - private final BillingBreakdownV1ResponseResultsItemGrouping grouping; - - private final Map additionalProperties; - - private BillingBreakdownV1ResponseResultsItem( - float dollars, - BillingBreakdownV1ResponseResultsItemGrouping grouping, - Map additionalProperties) { - this.dollars = dollars; - this.grouping = grouping; - this.additionalProperties = additionalProperties; - } - - /** - * @return USD cost of the billing for this grouping - */ - @JsonProperty("dollars") - public float getDollars() { - return dollars; - } - - @JsonProperty("grouping") - public BillingBreakdownV1ResponseResultsItemGrouping getGrouping() { - return grouping; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof BillingBreakdownV1ResponseResultsItem - && equalTo((BillingBreakdownV1ResponseResultsItem) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(BillingBreakdownV1ResponseResultsItem other) { - return dollars == other.dollars && grouping.equals(other.grouping); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.dollars, this.grouping); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static DollarsStage builder() { - return new Builder(); - } - - public interface DollarsStage { - /** USD cost of the billing for this grouping */ - GroupingStage dollars(float dollars); - - Builder from(BillingBreakdownV1ResponseResultsItem other); - } - - public interface GroupingStage { - _FinalStage grouping(@NotNull BillingBreakdownV1ResponseResultsItemGrouping grouping); - } - - public interface _FinalStage { - BillingBreakdownV1ResponseResultsItem build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements DollarsStage, GroupingStage, _FinalStage { - private float dollars; - - private BillingBreakdownV1ResponseResultsItemGrouping grouping; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(BillingBreakdownV1ResponseResultsItem other) { - dollars(other.getDollars()); - grouping(other.getGrouping()); - return this; - } - - /** - * USD cost of the billing for this grouping - * - *

USD cost of the billing for this grouping - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("dollars") - public GroupingStage dollars(float dollars) { - this.dollars = dollars; - return this; - } - - @java.lang.Override - @JsonSetter("grouping") - public _FinalStage grouping(@NotNull BillingBreakdownV1ResponseResultsItemGrouping grouping) { - this.grouping = Objects.requireNonNull(grouping, "grouping must not be null"); - return this; - } - - @java.lang.Override - public BillingBreakdownV1ResponseResultsItem build() { - return new BillingBreakdownV1ResponseResultsItem(dollars, grouping, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/BillingBreakdownV1ResponseResultsItemGrouping.java b/src/main/java/types/BillingBreakdownV1ResponseResultsItemGrouping.java deleted file mode 100644 index 12bf2f7..0000000 --- a/src/main/java/types/BillingBreakdownV1ResponseResultsItemGrouping.java +++ /dev/null @@ -1,252 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = BillingBreakdownV1ResponseResultsItemGrouping.Builder.class) -public final class BillingBreakdownV1ResponseResultsItemGrouping { - private final Optional start; - - private final Optional end; - - private final Optional accessor; - - private final Optional deployment; - - private final Optional lineItem; - - private final Optional> tags; - - private final Map additionalProperties; - - private BillingBreakdownV1ResponseResultsItemGrouping( - Optional start, - Optional end, - Optional accessor, - Optional deployment, - Optional lineItem, - Optional> tags, - Map additionalProperties) { - this.start = start; - this.end = end; - this.accessor = accessor; - this.deployment = deployment; - this.lineItem = lineItem; - this.tags = tags; - this.additionalProperties = additionalProperties; - } - - /** - * @return Start date for this group - */ - @JsonProperty("start") - public Optional getStart() { - return start; - } - - /** - * @return End date for this group - */ - @JsonProperty("end") - public Optional getEnd() { - return end; - } - - /** - * @return Optional accessor identifier, null unless grouped by accessor. - */ - @JsonProperty("accessor") - public Optional getAccessor() { - return accessor; - } - - /** - * @return Optional deployment identifier, null unless grouped by deployment. - */ - @JsonProperty("deployment") - public Optional getDeployment() { - return deployment; - } - - /** - * @return Optional line item identifier, null unless grouped by line item. - */ - @JsonProperty("line_item") - public Optional getLineItem() { - return lineItem; - } - - /** - * @return Optional list of tags, null unless grouped by tags. - */ - @JsonProperty("tags") - public Optional> getTags() { - return tags; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof BillingBreakdownV1ResponseResultsItemGrouping - && equalTo((BillingBreakdownV1ResponseResultsItemGrouping) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(BillingBreakdownV1ResponseResultsItemGrouping other) { - return start.equals(other.start) - && end.equals(other.end) - && accessor.equals(other.accessor) - && deployment.equals(other.deployment) - && lineItem.equals(other.lineItem) - && tags.equals(other.tags); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.start, this.end, this.accessor, this.deployment, this.lineItem, this.tags); - } - - @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 start = Optional.empty(); - - private Optional end = Optional.empty(); - - private Optional accessor = Optional.empty(); - - private Optional deployment = Optional.empty(); - - private Optional lineItem = Optional.empty(); - - private Optional> tags = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(BillingBreakdownV1ResponseResultsItemGrouping other) { - start(other.getStart()); - end(other.getEnd()); - accessor(other.getAccessor()); - deployment(other.getDeployment()); - lineItem(other.getLineItem()); - tags(other.getTags()); - return this; - } - - /** Start date for this group */ - @JsonSetter(value = "start", nulls = Nulls.SKIP) - public Builder start(Optional start) { - this.start = start; - return this; - } - - public Builder start(String start) { - this.start = Optional.ofNullable(start); - return this; - } - - /** End date for this group */ - @JsonSetter(value = "end", nulls = Nulls.SKIP) - public Builder end(Optional end) { - this.end = end; - return this; - } - - public Builder end(String end) { - this.end = Optional.ofNullable(end); - return this; - } - - /** Optional accessor identifier, null unless grouped by accessor. */ - @JsonSetter(value = "accessor", nulls = Nulls.SKIP) - public Builder accessor(Optional accessor) { - this.accessor = accessor; - return this; - } - - public Builder accessor(String accessor) { - this.accessor = Optional.ofNullable(accessor); - return this; - } - - /** Optional deployment identifier, null unless grouped by deployment. */ - @JsonSetter(value = "deployment", nulls = Nulls.SKIP) - public Builder deployment(Optional deployment) { - this.deployment = deployment; - return this; - } - - public Builder deployment(String deployment) { - this.deployment = Optional.ofNullable(deployment); - return this; - } - - /** Optional line item identifier, null unless grouped by line item. */ - @JsonSetter(value = "line_item", nulls = Nulls.SKIP) - public Builder lineItem(Optional lineItem) { - this.lineItem = lineItem; - return this; - } - - public Builder lineItem(String lineItem) { - this.lineItem = Optional.ofNullable(lineItem); - return this; - } - - /** Optional list of tags, null unless grouped by tags. */ - @JsonSetter(value = "tags", nulls = Nulls.SKIP) - public Builder tags(Optional> tags) { - this.tags = tags; - return this; - } - - public Builder tags(List tags) { - this.tags = Optional.ofNullable(tags); - return this; - } - - public BillingBreakdownV1ResponseResultsItemGrouping build() { - return new BillingBreakdownV1ResponseResultsItemGrouping( - start, end, accessor, deployment, lineItem, tags, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/Cartesia.java b/src/main/java/types/Cartesia.java deleted file mode 100644 index 60affca..0000000 --- a/src/main/java/types/Cartesia.java +++ /dev/null @@ -1,239 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = Cartesia.Builder.class) -public final class Cartesia { - private final Optional version; - - private final CartesiaSpeakProviderModelId modelId; - - private final CartesiaSpeakProviderVoice voice; - - private final Optional language; - - private final Map additionalProperties; - - private Cartesia( - Optional version, - CartesiaSpeakProviderModelId modelId, - CartesiaSpeakProviderVoice voice, - Optional language, - Map additionalProperties) { - this.version = version; - this.modelId = modelId; - this.voice = voice; - this.language = language; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("type") - public String getType() { - return "cartesia"; - } - - /** - * @return The API version header for the Cartesia text-to-speech API - */ - @JsonProperty("version") - public Optional getVersion() { - return version; - } - - /** - * @return Cartesia model ID - */ - @JsonProperty("model_id") - public CartesiaSpeakProviderModelId getModelId() { - return modelId; - } - - @JsonProperty("voice") - public CartesiaSpeakProviderVoice getVoice() { - return voice; - } - - /** - * @return Cartesia language code - */ - @JsonProperty("language") - public Optional getLanguage() { - return language; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof Cartesia && equalTo((Cartesia) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(Cartesia other) { - return version.equals(other.version) - && modelId.equals(other.modelId) - && voice.equals(other.voice) - && language.equals(other.language); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.version, this.modelId, this.voice, this.language); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static ModelIdStage builder() { - return new Builder(); - } - - public interface ModelIdStage { - /** Cartesia model ID */ - VoiceStage modelId(@NotNull CartesiaSpeakProviderModelId modelId); - - Builder from(Cartesia other); - } - - public interface VoiceStage { - _FinalStage voice(@NotNull CartesiaSpeakProviderVoice voice); - } - - public interface _FinalStage { - Cartesia build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** The API version header for the Cartesia text-to-speech API */ - _FinalStage version(Optional version); - - _FinalStage version(String version); - - /** Cartesia language code */ - _FinalStage language(Optional language); - - _FinalStage language(String language); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements ModelIdStage, VoiceStage, _FinalStage { - private CartesiaSpeakProviderModelId modelId; - - private CartesiaSpeakProviderVoice voice; - - private Optional language = Optional.empty(); - - private Optional version = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(Cartesia other) { - version(other.getVersion()); - modelId(other.getModelId()); - voice(other.getVoice()); - language(other.getLanguage()); - return this; - } - - /** - * Cartesia model ID - * - *

Cartesia model ID - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("model_id") - public VoiceStage modelId(@NotNull CartesiaSpeakProviderModelId modelId) { - this.modelId = Objects.requireNonNull(modelId, "modelId must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("voice") - public _FinalStage voice(@NotNull CartesiaSpeakProviderVoice voice) { - this.voice = Objects.requireNonNull(voice, "voice must not be null"); - return this; - } - - /** - * Cartesia language code - * - * @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; - } - - /** Cartesia language code */ - @java.lang.Override - @JsonSetter(value = "language", nulls = Nulls.SKIP) - public _FinalStage language(Optional language) { - this.language = language; - return this; - } - - /** - * The API version header for the Cartesia text-to-speech API - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage version(String version) { - this.version = Optional.ofNullable(version); - return this; - } - - /** The API version header for the Cartesia text-to-speech API */ - @java.lang.Override - @JsonSetter(value = "version", nulls = Nulls.SKIP) - public _FinalStage version(Optional version) { - this.version = version; - return this; - } - - @java.lang.Override - public Cartesia build() { - return new Cartesia(version, modelId, voice, language, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/CartesiaSpeakProviderModelId.java b/src/main/java/types/CartesiaSpeakProviderModelId.java deleted file mode 100644 index 6424700..0000000 --- a/src/main/java/types/CartesiaSpeakProviderModelId.java +++ /dev/null @@ -1,84 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class CartesiaSpeakProviderModelId { - public static final CartesiaSpeakProviderModelId SONIC_MULTILINGUAL = - new CartesiaSpeakProviderModelId(Value.SONIC_MULTILINGUAL, "sonic-multilingual"); - - public static final CartesiaSpeakProviderModelId SONIC2 = - new CartesiaSpeakProviderModelId(Value.SONIC2, "sonic-2"); - - private final Value value; - - private final String string; - - CartesiaSpeakProviderModelId(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof CartesiaSpeakProviderModelId - && this.string.equals(((CartesiaSpeakProviderModelId) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case SONIC_MULTILINGUAL: - return visitor.visitSonicMultilingual(); - case SONIC2: - return visitor.visitSonic2(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CartesiaSpeakProviderModelId valueOf(String value) { - switch (value) { - case "sonic-multilingual": - return SONIC_MULTILINGUAL; - case "sonic-2": - return SONIC2; - default: - return new CartesiaSpeakProviderModelId(Value.UNKNOWN, value); - } - } - - public enum Value { - SONIC2, - - SONIC_MULTILINGUAL, - - UNKNOWN - } - - public interface Visitor { - T visitSonic2(); - - T visitSonicMultilingual(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/types/CartesiaSpeakProviderVoice.java b/src/main/java/types/CartesiaSpeakProviderVoice.java deleted file mode 100644 index 6e79ebc..0000000 --- a/src/main/java/types/CartesiaSpeakProviderVoice.java +++ /dev/null @@ -1,161 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = CartesiaSpeakProviderVoice.Builder.class) -public final class CartesiaSpeakProviderVoice { - private final String mode; - - private final String id; - - private final Map additionalProperties; - - private CartesiaSpeakProviderVoice( - String mode, String id, Map additionalProperties) { - this.mode = mode; - this.id = id; - this.additionalProperties = additionalProperties; - } - - /** - * @return Cartesia voice mode - */ - @JsonProperty("mode") - public String getMode() { - return mode; - } - - /** - * @return Cartesia voice ID - */ - @JsonProperty("id") - public String getId() { - return id; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CartesiaSpeakProviderVoice - && equalTo((CartesiaSpeakProviderVoice) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(CartesiaSpeakProviderVoice other) { - return mode.equals(other.mode) && id.equals(other.id); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.mode, this.id); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static ModeStage builder() { - return new Builder(); - } - - public interface ModeStage { - /** Cartesia voice mode */ - IdStage mode(@NotNull String mode); - - Builder from(CartesiaSpeakProviderVoice other); - } - - public interface IdStage { - /** Cartesia voice ID */ - _FinalStage id(@NotNull String id); - } - - public interface _FinalStage { - CartesiaSpeakProviderVoice build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements ModeStage, IdStage, _FinalStage { - private String mode; - - private String id; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(CartesiaSpeakProviderVoice other) { - mode(other.getMode()); - id(other.getId()); - return this; - } - - /** - * Cartesia voice mode - * - *

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

Cartesia voice ID - * - * @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 CartesiaSpeakProviderVoice build() { - return new CartesiaSpeakProviderVoice(mode, id, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/CreateKeyV1RequestOne.java b/src/main/java/types/CreateKeyV1RequestOne.java deleted file mode 100644 index 3a257dc..0000000 --- a/src/main/java/types/CreateKeyV1RequestOne.java +++ /dev/null @@ -1,41 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import core.WrappedAlias; - -public final class CreateKeyV1RequestOne implements WrappedAlias { - private final Object value; - - private CreateKeyV1RequestOne(Object value) { - this.value = value; - } - - @JsonValue - public Object get() { - return this.value; - } - - @java.lang.Override - public boolean equals(Object other) { - return this == other - || (other instanceof CreateKeyV1RequestOne - && this.value.equals(((CreateKeyV1RequestOne) other).value)); - } - - @java.lang.Override - public int hashCode() { - return value.hashCode(); - } - - @java.lang.Override - public String toString() { - return value.toString(); - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static CreateKeyV1RequestOne of(Object value) { - return new CreateKeyV1RequestOne(value); - } -} diff --git a/src/main/java/types/CreateKeyV1Response.java b/src/main/java/types/CreateKeyV1Response.java deleted file mode 100644 index ff081e1..0000000 --- a/src/main/java/types/CreateKeyV1Response.java +++ /dev/null @@ -1,252 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = CreateKeyV1Response.Builder.class) -public final class CreateKeyV1Response { - private final Optional apiKeyId; - - private final Optional key; - - private final Optional comment; - - private final Optional> scopes; - - private final Optional> tags; - - private final Optional expirationDate; - - private final Map additionalProperties; - - private CreateKeyV1Response( - Optional apiKeyId, - Optional key, - Optional comment, - Optional> scopes, - Optional> tags, - Optional expirationDate, - Map additionalProperties) { - this.apiKeyId = apiKeyId; - this.key = key; - this.comment = comment; - this.scopes = scopes; - this.tags = tags; - this.expirationDate = expirationDate; - this.additionalProperties = additionalProperties; - } - - /** - * @return The unique identifier of the API key - */ - @JsonProperty("api_key_id") - public Optional getApiKeyId() { - return apiKeyId; - } - - /** - * @return The API key - */ - @JsonProperty("key") - public Optional getKey() { - return key; - } - - /** - * @return A comment for the API key - */ - @JsonProperty("comment") - public Optional getComment() { - return comment; - } - - /** - * @return The scopes for the API key - */ - @JsonProperty("scopes") - public Optional> getScopes() { - return scopes; - } - - /** - * @return The tags for the API key - */ - @JsonProperty("tags") - public Optional> getTags() { - return tags; - } - - /** - * @return The expiration date of the API key - */ - @JsonProperty("expiration_date") - public Optional getExpirationDate() { - return expirationDate; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CreateKeyV1Response && equalTo((CreateKeyV1Response) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(CreateKeyV1Response other) { - return apiKeyId.equals(other.apiKeyId) - && key.equals(other.key) - && comment.equals(other.comment) - && scopes.equals(other.scopes) - && tags.equals(other.tags) - && expirationDate.equals(other.expirationDate); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.apiKeyId, this.key, this.comment, this.scopes, this.tags, this.expirationDate); - } - - @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 apiKeyId = Optional.empty(); - - private Optional key = Optional.empty(); - - private Optional comment = Optional.empty(); - - private Optional> scopes = Optional.empty(); - - private Optional> tags = Optional.empty(); - - private Optional expirationDate = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(CreateKeyV1Response other) { - apiKeyId(other.getApiKeyId()); - key(other.getKey()); - comment(other.getComment()); - scopes(other.getScopes()); - tags(other.getTags()); - expirationDate(other.getExpirationDate()); - return this; - } - - /** The unique identifier of the API key */ - @JsonSetter(value = "api_key_id", nulls = Nulls.SKIP) - public Builder apiKeyId(Optional apiKeyId) { - this.apiKeyId = apiKeyId; - return this; - } - - public Builder apiKeyId(String apiKeyId) { - this.apiKeyId = Optional.ofNullable(apiKeyId); - return this; - } - - /** The API key */ - @JsonSetter(value = "key", nulls = Nulls.SKIP) - public Builder key(Optional key) { - this.key = key; - return this; - } - - public Builder key(String key) { - this.key = Optional.ofNullable(key); - return this; - } - - /** A comment for the API key */ - @JsonSetter(value = "comment", nulls = Nulls.SKIP) - public Builder comment(Optional comment) { - this.comment = comment; - return this; - } - - public Builder comment(String comment) { - this.comment = Optional.ofNullable(comment); - return this; - } - - /** The scopes for the API key */ - @JsonSetter(value = "scopes", nulls = Nulls.SKIP) - public Builder scopes(Optional> scopes) { - this.scopes = scopes; - return this; - } - - public Builder scopes(List scopes) { - this.scopes = Optional.ofNullable(scopes); - return this; - } - - /** The tags for the API key */ - @JsonSetter(value = "tags", nulls = Nulls.SKIP) - public Builder tags(Optional> tags) { - this.tags = tags; - return this; - } - - public Builder tags(List tags) { - this.tags = Optional.ofNullable(tags); - return this; - } - - /** The expiration date of the API key */ - @JsonSetter(value = "expiration_date", nulls = Nulls.SKIP) - public Builder expirationDate(Optional expirationDate) { - this.expirationDate = expirationDate; - return this; - } - - public Builder expirationDate(OffsetDateTime expirationDate) { - this.expirationDate = Optional.ofNullable(expirationDate); - return this; - } - - public CreateKeyV1Response build() { - return new CreateKeyV1Response( - apiKeyId, key, comment, scopes, tags, expirationDate, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/CreateProjectDistributionCredentialsV1Response.java b/src/main/java/types/CreateProjectDistributionCredentialsV1Response.java deleted file mode 100644 index b2c9321..0000000 --- a/src/main/java/types/CreateProjectDistributionCredentialsV1Response.java +++ /dev/null @@ -1,157 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = CreateProjectDistributionCredentialsV1Response.Builder.class) -public final class CreateProjectDistributionCredentialsV1Response { - private final CreateProjectDistributionCredentialsV1ResponseMember member; - - private final CreateProjectDistributionCredentialsV1ResponseDistributionCredentials - distributionCredentials; - - private final Map additionalProperties; - - private CreateProjectDistributionCredentialsV1Response( - CreateProjectDistributionCredentialsV1ResponseMember member, - CreateProjectDistributionCredentialsV1ResponseDistributionCredentials distributionCredentials, - Map additionalProperties) { - this.member = member; - this.distributionCredentials = distributionCredentials; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("member") - public CreateProjectDistributionCredentialsV1ResponseMember getMember() { - return member; - } - - @JsonProperty("distribution_credentials") - public CreateProjectDistributionCredentialsV1ResponseDistributionCredentials - getDistributionCredentials() { - return distributionCredentials; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CreateProjectDistributionCredentialsV1Response - && equalTo((CreateProjectDistributionCredentialsV1Response) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(CreateProjectDistributionCredentialsV1Response other) { - return member.equals(other.member) - && distributionCredentials.equals(other.distributionCredentials); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.member, this.distributionCredentials); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static MemberStage builder() { - return new Builder(); - } - - public interface MemberStage { - DistributionCredentialsStage member( - @NotNull CreateProjectDistributionCredentialsV1ResponseMember member); - - Builder from(CreateProjectDistributionCredentialsV1Response other); - } - - public interface DistributionCredentialsStage { - _FinalStage distributionCredentials( - @NotNull - CreateProjectDistributionCredentialsV1ResponseDistributionCredentials - distributionCredentials); - } - - public interface _FinalStage { - CreateProjectDistributionCredentialsV1Response build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements MemberStage, DistributionCredentialsStage, _FinalStage { - private CreateProjectDistributionCredentialsV1ResponseMember member; - - private CreateProjectDistributionCredentialsV1ResponseDistributionCredentials - distributionCredentials; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(CreateProjectDistributionCredentialsV1Response other) { - member(other.getMember()); - distributionCredentials(other.getDistributionCredentials()); - return this; - } - - @java.lang.Override - @JsonSetter("member") - public DistributionCredentialsStage member( - @NotNull CreateProjectDistributionCredentialsV1ResponseMember member) { - this.member = Objects.requireNonNull(member, "member must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("distribution_credentials") - public _FinalStage distributionCredentials( - @NotNull - CreateProjectDistributionCredentialsV1ResponseDistributionCredentials - distributionCredentials) { - this.distributionCredentials = - Objects.requireNonNull( - distributionCredentials, "distributionCredentials must not be null"); - return this; - } - - @java.lang.Override - public CreateProjectDistributionCredentialsV1Response build() { - return new CreateProjectDistributionCredentialsV1Response( - member, distributionCredentials, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/CreateProjectDistributionCredentialsV1ResponseDistributionCredentials.java b/src/main/java/types/CreateProjectDistributionCredentialsV1ResponseDistributionCredentials.java deleted file mode 100644 index 2d34955..0000000 --- a/src/main/java/types/CreateProjectDistributionCredentialsV1ResponseDistributionCredentials.java +++ /dev/null @@ -1,310 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = CreateProjectDistributionCredentialsV1ResponseDistributionCredentials.Builder.class) -public final class CreateProjectDistributionCredentialsV1ResponseDistributionCredentials { - private final String distributionCredentialsId; - - private final String provider; - - private final Optional comment; - - private final List scopes; - - private final OffsetDateTime created; - - private final Map additionalProperties; - - private CreateProjectDistributionCredentialsV1ResponseDistributionCredentials( - String distributionCredentialsId, - String provider, - Optional comment, - List scopes, - OffsetDateTime created, - Map additionalProperties) { - this.distributionCredentialsId = distributionCredentialsId; - this.provider = provider; - this.comment = comment; - this.scopes = scopes; - this.created = created; - this.additionalProperties = additionalProperties; - } - - /** - * @return Unique identifier for the distribution credentials - */ - @JsonProperty("distribution_credentials_id") - public String getDistributionCredentialsId() { - return distributionCredentialsId; - } - - /** - * @return The provider of the distribution service - */ - @JsonProperty("provider") - public String getProvider() { - return provider; - } - - /** - * @return Optional comment about the credentials - */ - @JsonProperty("comment") - public Optional getComment() { - return comment; - } - - /** - * @return List of permission scopes for the credentials - */ - @JsonProperty("scopes") - public List getScopes() { - return scopes; - } - - /** - * @return Timestamp when the credentials were created - */ - @JsonProperty("created") - public OffsetDateTime getCreated() { - return created; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CreateProjectDistributionCredentialsV1ResponseDistributionCredentials - && equalTo((CreateProjectDistributionCredentialsV1ResponseDistributionCredentials) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo( - CreateProjectDistributionCredentialsV1ResponseDistributionCredentials other) { - return distributionCredentialsId.equals(other.distributionCredentialsId) - && provider.equals(other.provider) - && comment.equals(other.comment) - && scopes.equals(other.scopes) - && created.equals(other.created); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.distributionCredentialsId, this.provider, this.comment, this.scopes, this.created); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static DistributionCredentialsIdStage builder() { - return new Builder(); - } - - public interface DistributionCredentialsIdStage { - /** Unique identifier for the distribution credentials */ - ProviderStage distributionCredentialsId(@NotNull String distributionCredentialsId); - - Builder from(CreateProjectDistributionCredentialsV1ResponseDistributionCredentials other); - } - - public interface ProviderStage { - /** The provider of the distribution service */ - CreatedStage provider(@NotNull String provider); - } - - public interface CreatedStage { - /** Timestamp when the credentials were created */ - _FinalStage created(@NotNull OffsetDateTime created); - } - - public interface _FinalStage { - CreateProjectDistributionCredentialsV1ResponseDistributionCredentials build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** Optional comment about the credentials */ - _FinalStage comment(Optional comment); - - _FinalStage comment(String comment); - - /** List of permission scopes for the credentials */ - _FinalStage scopes(List scopes); - - _FinalStage addScopes(String scopes); - - _FinalStage addAllScopes(List scopes); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements DistributionCredentialsIdStage, ProviderStage, CreatedStage, _FinalStage { - private String distributionCredentialsId; - - private String provider; - - private OffsetDateTime created; - - private List scopes = new ArrayList<>(); - - private Optional comment = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from( - CreateProjectDistributionCredentialsV1ResponseDistributionCredentials other) { - distributionCredentialsId(other.getDistributionCredentialsId()); - provider(other.getProvider()); - comment(other.getComment()); - scopes(other.getScopes()); - created(other.getCreated()); - return this; - } - - /** - * Unique identifier for the distribution credentials - * - *

Unique identifier for the distribution credentials - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("distribution_credentials_id") - public ProviderStage distributionCredentialsId(@NotNull String distributionCredentialsId) { - this.distributionCredentialsId = - Objects.requireNonNull( - distributionCredentialsId, "distributionCredentialsId must not be null"); - return this; - } - - /** - * The provider of the distribution service - * - *

The provider of the distribution service - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("provider") - public CreatedStage provider(@NotNull String provider) { - this.provider = Objects.requireNonNull(provider, "provider must not be null"); - return this; - } - - /** - * Timestamp when the credentials were created - * - *

Timestamp when the credentials were created - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("created") - public _FinalStage created(@NotNull OffsetDateTime created) { - this.created = Objects.requireNonNull(created, "created must not be null"); - return this; - } - - /** - * List of permission scopes for the credentials - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage addAllScopes(List scopes) { - if (scopes != null) { - this.scopes.addAll(scopes); - } - return this; - } - - /** - * List of permission scopes for the credentials - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage addScopes(String scopes) { - this.scopes.add(scopes); - return this; - } - - /** List of permission scopes for the credentials */ - @java.lang.Override - @JsonSetter(value = "scopes", nulls = Nulls.SKIP) - public _FinalStage scopes(List scopes) { - this.scopes.clear(); - if (scopes != null) { - this.scopes.addAll(scopes); - } - return this; - } - - /** - * Optional comment about the credentials - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage comment(String comment) { - this.comment = Optional.ofNullable(comment); - return this; - } - - /** Optional comment about the credentials */ - @java.lang.Override - @JsonSetter(value = "comment", nulls = Nulls.SKIP) - public _FinalStage comment(Optional comment) { - this.comment = comment; - return this; - } - - @java.lang.Override - public CreateProjectDistributionCredentialsV1ResponseDistributionCredentials build() { - return new CreateProjectDistributionCredentialsV1ResponseDistributionCredentials( - distributionCredentialsId, provider, comment, scopes, created, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/CreateProjectDistributionCredentialsV1ResponseMember.java b/src/main/java/types/CreateProjectDistributionCredentialsV1ResponseMember.java deleted file mode 100644 index 3ed8247..0000000 --- a/src/main/java/types/CreateProjectDistributionCredentialsV1ResponseMember.java +++ /dev/null @@ -1,162 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = CreateProjectDistributionCredentialsV1ResponseMember.Builder.class) -public final class CreateProjectDistributionCredentialsV1ResponseMember { - private final String memberId; - - private final String email; - - private final Map additionalProperties; - - private CreateProjectDistributionCredentialsV1ResponseMember( - String memberId, String email, Map additionalProperties) { - this.memberId = memberId; - this.email = email; - this.additionalProperties = additionalProperties; - } - - /** - * @return Unique identifier for the member - */ - @JsonProperty("member_id") - public String getMemberId() { - return memberId; - } - - /** - * @return Email address of the member - */ - @JsonProperty("email") - public String getEmail() { - return email; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CreateProjectDistributionCredentialsV1ResponseMember - && equalTo((CreateProjectDistributionCredentialsV1ResponseMember) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(CreateProjectDistributionCredentialsV1ResponseMember other) { - return memberId.equals(other.memberId) && email.equals(other.email); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.memberId, this.email); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static MemberIdStage builder() { - return new Builder(); - } - - public interface MemberIdStage { - /** Unique identifier for the member */ - EmailStage memberId(@NotNull String memberId); - - Builder from(CreateProjectDistributionCredentialsV1ResponseMember other); - } - - public interface EmailStage { - /** Email address of the member */ - _FinalStage email(@NotNull String email); - } - - public interface _FinalStage { - CreateProjectDistributionCredentialsV1ResponseMember build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements MemberIdStage, EmailStage, _FinalStage { - private String memberId; - - private String email; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(CreateProjectDistributionCredentialsV1ResponseMember other) { - memberId(other.getMemberId()); - email(other.getEmail()); - return this; - } - - /** - * Unique identifier for the member - * - *

Unique identifier for the member - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("member_id") - public EmailStage memberId(@NotNull String memberId) { - this.memberId = Objects.requireNonNull(memberId, "memberId must not be null"); - return this; - } - - /** - * Email address of the member - * - *

Email address of the member - * - * @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; - } - - @java.lang.Override - public CreateProjectDistributionCredentialsV1ResponseMember build() { - return new CreateProjectDistributionCredentialsV1ResponseMember( - memberId, email, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/CreateProjectInviteV1Response.java b/src/main/java/types/CreateProjectInviteV1Response.java deleted file mode 100644 index 2a241f6..0000000 --- a/src/main/java/types/CreateProjectInviteV1Response.java +++ /dev/null @@ -1,108 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = CreateProjectInviteV1Response.Builder.class) -public final class CreateProjectInviteV1Response { - private final Optional message; - - private final Map additionalProperties; - - private CreateProjectInviteV1Response( - Optional message, Map additionalProperties) { - this.message = message; - this.additionalProperties = additionalProperties; - } - - /** - * @return confirmation message - */ - @JsonProperty("message") - public Optional getMessage() { - return message; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CreateProjectInviteV1Response - && equalTo((CreateProjectInviteV1Response) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(CreateProjectInviteV1Response 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 Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional message = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(CreateProjectInviteV1Response other) { - message(other.getMessage()); - return this; - } - - /** confirmation message */ - @JsonSetter(value = "message", nulls = Nulls.SKIP) - public Builder message(Optional message) { - this.message = message; - return this; - } - - public Builder message(String message) { - this.message = Optional.ofNullable(message); - return this; - } - - public CreateProjectInviteV1Response build() { - return new CreateProjectInviteV1Response(message, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/Deepgram.java b/src/main/java/types/Deepgram.java deleted file mode 100644 index 28dd6da..0000000 --- a/src/main/java/types/Deepgram.java +++ /dev/null @@ -1,174 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = Deepgram.Builder.class) -public final class Deepgram { - private final Optional version; - - private final DeepgramSpeakProviderModel model; - - private final Map additionalProperties; - - private Deepgram( - Optional version, - DeepgramSpeakProviderModel model, - Map additionalProperties) { - this.version = version; - this.model = model; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("type") - public String getType() { - return "deepgram"; - } - - /** - * @return The REST API version for the Deepgram text-to-speech API - */ - @JsonProperty("version") - public Optional getVersion() { - return version; - } - - /** - * @return Deepgram TTS model - */ - @JsonProperty("model") - public DeepgramSpeakProviderModel getModel() { - return model; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof Deepgram && equalTo((Deepgram) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(Deepgram other) { - return version.equals(other.version) && model.equals(other.model); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.version, this.model); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static ModelStage builder() { - return new Builder(); - } - - public interface ModelStage { - /** Deepgram TTS model */ - _FinalStage model(@NotNull DeepgramSpeakProviderModel model); - - Builder from(Deepgram other); - } - - public interface _FinalStage { - Deepgram build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** The REST API version for the Deepgram text-to-speech API */ - _FinalStage version(Optional version); - - _FinalStage version(String version); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements ModelStage, _FinalStage { - private DeepgramSpeakProviderModel model; - - private Optional version = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(Deepgram other) { - version(other.getVersion()); - model(other.getModel()); - return this; - } - - /** - * Deepgram TTS model - * - *

Deepgram TTS model - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("model") - public _FinalStage model(@NotNull DeepgramSpeakProviderModel model) { - this.model = Objects.requireNonNull(model, "model must not be null"); - return this; - } - - /** - * The REST API version for the Deepgram text-to-speech API - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage version(String version) { - this.version = Optional.ofNullable(version); - return this; - } - - /** The REST API version for the Deepgram text-to-speech API */ - @java.lang.Override - @JsonSetter(value = "version", nulls = Nulls.SKIP) - public _FinalStage version(Optional version) { - this.version = version; - return this; - } - - @java.lang.Override - public Deepgram build() { - return new Deepgram(version, model, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/DeepgramSpeakProviderModel.java b/src/main/java/types/DeepgramSpeakProviderModel.java deleted file mode 100644 index 98e5049..0000000 --- a/src/main/java/types/DeepgramSpeakProviderModel.java +++ /dev/null @@ -1,755 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class DeepgramSpeakProviderModel { - public static final DeepgramSpeakProviderModel AURA_ANGUS_EN = - new DeepgramSpeakProviderModel(Value.AURA_ANGUS_EN, "aura-angus-en"); - - public static final DeepgramSpeakProviderModel AURA2JUPITER_EN = - new DeepgramSpeakProviderModel(Value.AURA2JUPITER_EN, "aura-2-jupiter-en"); - - public static final DeepgramSpeakProviderModel AURA2CORA_EN = - new DeepgramSpeakProviderModel(Value.AURA2CORA_EN, "aura-2-cora-en"); - - public static final DeepgramSpeakProviderModel AURA_STELLA_EN = - new DeepgramSpeakProviderModel(Value.AURA_STELLA_EN, "aura-stella-en"); - - public static final DeepgramSpeakProviderModel AURA2HELENA_EN = - new DeepgramSpeakProviderModel(Value.AURA2HELENA_EN, "aura-2-helena-en"); - - public static final DeepgramSpeakProviderModel AURA2AQUILA_ES = - new DeepgramSpeakProviderModel(Value.AURA2AQUILA_ES, "aura-2-aquila-es"); - - public static final DeepgramSpeakProviderModel AURA2ATLAS_EN = - new DeepgramSpeakProviderModel(Value.AURA2ATLAS_EN, "aura-2-atlas-en"); - - public static final DeepgramSpeakProviderModel AURA2ORION_EN = - new DeepgramSpeakProviderModel(Value.AURA2ORION_EN, "aura-2-orion-en"); - - public static final DeepgramSpeakProviderModel AURA2DRACO_EN = - new DeepgramSpeakProviderModel(Value.AURA2DRACO_EN, "aura-2-draco-en"); - - public static final DeepgramSpeakProviderModel AURA2HYPERION_EN = - new DeepgramSpeakProviderModel(Value.AURA2HYPERION_EN, "aura-2-hyperion-en"); - - public static final DeepgramSpeakProviderModel AURA2JANUS_EN = - new DeepgramSpeakProviderModel(Value.AURA2JANUS_EN, "aura-2-janus-en"); - - public static final DeepgramSpeakProviderModel AURA_HELIOS_EN = - new DeepgramSpeakProviderModel(Value.AURA_HELIOS_EN, "aura-helios-en"); - - public static final DeepgramSpeakProviderModel AURA2PLUTO_EN = - new DeepgramSpeakProviderModel(Value.AURA2PLUTO_EN, "aura-2-pluto-en"); - - public static final DeepgramSpeakProviderModel AURA2ARCAS_EN = - new DeepgramSpeakProviderModel(Value.AURA2ARCAS_EN, "aura-2-arcas-en"); - - public static final DeepgramSpeakProviderModel AURA2NESTOR_ES = - new DeepgramSpeakProviderModel(Value.AURA2NESTOR_ES, "aura-2-nestor-es"); - - public static final DeepgramSpeakProviderModel AURA2NEPTUNE_EN = - new DeepgramSpeakProviderModel(Value.AURA2NEPTUNE_EN, "aura-2-neptune-en"); - - public static final DeepgramSpeakProviderModel AURA2MINERVA_EN = - new DeepgramSpeakProviderModel(Value.AURA2MINERVA_EN, "aura-2-minerva-en"); - - public static final DeepgramSpeakProviderModel AURA2ALVARO_ES = - new DeepgramSpeakProviderModel(Value.AURA2ALVARO_ES, "aura-2-alvaro-es"); - - public static final DeepgramSpeakProviderModel AURA_ATHENA_EN = - new DeepgramSpeakProviderModel(Value.AURA_ATHENA_EN, "aura-athena-en"); - - public static final DeepgramSpeakProviderModel AURA_PERSEUS_EN = - new DeepgramSpeakProviderModel(Value.AURA_PERSEUS_EN, "aura-perseus-en"); - - public static final DeepgramSpeakProviderModel AURA2ODYSSEUS_EN = - new DeepgramSpeakProviderModel(Value.AURA2ODYSSEUS_EN, "aura-2-odysseus-en"); - - public static final DeepgramSpeakProviderModel AURA2PANDORA_EN = - new DeepgramSpeakProviderModel(Value.AURA2PANDORA_EN, "aura-2-pandora-en"); - - public static final DeepgramSpeakProviderModel AURA2ZEUS_EN = - new DeepgramSpeakProviderModel(Value.AURA2ZEUS_EN, "aura-2-zeus-en"); - - public static final DeepgramSpeakProviderModel AURA2ELECTRA_EN = - new DeepgramSpeakProviderModel(Value.AURA2ELECTRA_EN, "aura-2-electra-en"); - - public static final DeepgramSpeakProviderModel AURA2ORPHEUS_EN = - new DeepgramSpeakProviderModel(Value.AURA2ORPHEUS_EN, "aura-2-orpheus-en"); - - public static final DeepgramSpeakProviderModel AURA2THALIA_EN = - new DeepgramSpeakProviderModel(Value.AURA2THALIA_EN, "aura-2-thalia-en"); - - public static final DeepgramSpeakProviderModel AURA2CELESTE_ES = - new DeepgramSpeakProviderModel(Value.AURA2CELESTE_ES, "aura-2-celeste-es"); - - public static final DeepgramSpeakProviderModel AURA_ASTERIA_EN = - new DeepgramSpeakProviderModel(Value.AURA_ASTERIA_EN, "aura-asteria-en"); - - public static final DeepgramSpeakProviderModel AURA2ESTRELLA_ES = - new DeepgramSpeakProviderModel(Value.AURA2ESTRELLA_ES, "aura-2-estrella-es"); - - public static final DeepgramSpeakProviderModel AURA2HERA_EN = - new DeepgramSpeakProviderModel(Value.AURA2HERA_EN, "aura-2-hera-en"); - - public static final DeepgramSpeakProviderModel AURA2MARS_EN = - new DeepgramSpeakProviderModel(Value.AURA2MARS_EN, "aura-2-mars-en"); - - public static final DeepgramSpeakProviderModel AURA2SIRIO_ES = - new DeepgramSpeakProviderModel(Value.AURA2SIRIO_ES, "aura-2-sirio-es"); - - public static final DeepgramSpeakProviderModel AURA2ASTERIA_EN = - new DeepgramSpeakProviderModel(Value.AURA2ASTERIA_EN, "aura-2-asteria-en"); - - public static final DeepgramSpeakProviderModel AURA2HERMES_EN = - new DeepgramSpeakProviderModel(Value.AURA2HERMES_EN, "aura-2-hermes-en"); - - public static final DeepgramSpeakProviderModel AURA2VESTA_EN = - new DeepgramSpeakProviderModel(Value.AURA2VESTA_EN, "aura-2-vesta-en"); - - public static final DeepgramSpeakProviderModel AURA2CARINA_ES = - new DeepgramSpeakProviderModel(Value.AURA2CARINA_ES, "aura-2-carina-es"); - - public static final DeepgramSpeakProviderModel AURA2CALLISTA_EN = - new DeepgramSpeakProviderModel(Value.AURA2CALLISTA_EN, "aura-2-callista-en"); - - public static final DeepgramSpeakProviderModel AURA2HARMONIA_EN = - new DeepgramSpeakProviderModel(Value.AURA2HARMONIA_EN, "aura-2-harmonia-en"); - - public static final DeepgramSpeakProviderModel AURA2SELENA_ES = - new DeepgramSpeakProviderModel(Value.AURA2SELENA_ES, "aura-2-selena-es"); - - public static final DeepgramSpeakProviderModel AURA2AURORA_EN = - new DeepgramSpeakProviderModel(Value.AURA2AURORA_EN, "aura-2-aurora-en"); - - public static final DeepgramSpeakProviderModel AURA_ZEUS_EN = - new DeepgramSpeakProviderModel(Value.AURA_ZEUS_EN, "aura-zeus-en"); - - public static final DeepgramSpeakProviderModel AURA2OPHELIA_EN = - new DeepgramSpeakProviderModel(Value.AURA2OPHELIA_EN, "aura-2-ophelia-en"); - - public static final DeepgramSpeakProviderModel AURA2AMALTHEA_EN = - new DeepgramSpeakProviderModel(Value.AURA2AMALTHEA_EN, "aura-2-amalthea-en"); - - public static final DeepgramSpeakProviderModel AURA_ORPHEUS_EN = - new DeepgramSpeakProviderModel(Value.AURA_ORPHEUS_EN, "aura-orpheus-en"); - - public static final DeepgramSpeakProviderModel AURA2DELIA_EN = - new DeepgramSpeakProviderModel(Value.AURA2DELIA_EN, "aura-2-delia-en"); - - public static final DeepgramSpeakProviderModel AURA_LUNA_EN = - new DeepgramSpeakProviderModel(Value.AURA_LUNA_EN, "aura-luna-en"); - - public static final DeepgramSpeakProviderModel AURA2APOLLO_EN = - new DeepgramSpeakProviderModel(Value.AURA2APOLLO_EN, "aura-2-apollo-en"); - - public static final DeepgramSpeakProviderModel AURA2SELENE_EN = - new DeepgramSpeakProviderModel(Value.AURA2SELENE_EN, "aura-2-selene-en"); - - public static final DeepgramSpeakProviderModel AURA2THEIA_EN = - new DeepgramSpeakProviderModel(Value.AURA2THEIA_EN, "aura-2-theia-en"); - - public static final DeepgramSpeakProviderModel AURA_HERA_EN = - new DeepgramSpeakProviderModel(Value.AURA_HERA_EN, "aura-hera-en"); - - public static final DeepgramSpeakProviderModel AURA2CORDELIA_EN = - new DeepgramSpeakProviderModel(Value.AURA2CORDELIA_EN, "aura-2-cordelia-en"); - - public static final DeepgramSpeakProviderModel AURA2ANDROMEDA_EN = - new DeepgramSpeakProviderModel(Value.AURA2ANDROMEDA_EN, "aura-2-andromeda-en"); - - public static final DeepgramSpeakProviderModel AURA2ARIES_EN = - new DeepgramSpeakProviderModel(Value.AURA2ARIES_EN, "aura-2-aries-en"); - - public static final DeepgramSpeakProviderModel AURA2JUNO_EN = - new DeepgramSpeakProviderModel(Value.AURA2JUNO_EN, "aura-2-juno-en"); - - public static final DeepgramSpeakProviderModel AURA2LUNA_EN = - new DeepgramSpeakProviderModel(Value.AURA2LUNA_EN, "aura-2-luna-en"); - - public static final DeepgramSpeakProviderModel AURA2DIANA_ES = - new DeepgramSpeakProviderModel(Value.AURA2DIANA_ES, "aura-2-diana-es"); - - public static final DeepgramSpeakProviderModel AURA2JAVIER_ES = - new DeepgramSpeakProviderModel(Value.AURA2JAVIER_ES, "aura-2-javier-es"); - - public static final DeepgramSpeakProviderModel AURA_ORION_EN = - new DeepgramSpeakProviderModel(Value.AURA_ORION_EN, "aura-orion-en"); - - public static final DeepgramSpeakProviderModel AURA_ARCAS_EN = - new DeepgramSpeakProviderModel(Value.AURA_ARCAS_EN, "aura-arcas-en"); - - public static final DeepgramSpeakProviderModel AURA2IRIS_EN = - new DeepgramSpeakProviderModel(Value.AURA2IRIS_EN, "aura-2-iris-en"); - - public static final DeepgramSpeakProviderModel AURA2ATHENA_EN = - new DeepgramSpeakProviderModel(Value.AURA2ATHENA_EN, "aura-2-athena-en"); - - public static final DeepgramSpeakProviderModel AURA2SATURN_EN = - new DeepgramSpeakProviderModel(Value.AURA2SATURN_EN, "aura-2-saturn-en"); - - public static final DeepgramSpeakProviderModel AURA2PHOEBE_EN = - new DeepgramSpeakProviderModel(Value.AURA2PHOEBE_EN, "aura-2-phoebe-en"); - - private final Value value; - - private final String string; - - DeepgramSpeakProviderModel(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof DeepgramSpeakProviderModel - && this.string.equals(((DeepgramSpeakProviderModel) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case AURA_ANGUS_EN: - return visitor.visitAuraAngusEn(); - case AURA2JUPITER_EN: - return visitor.visitAura2JupiterEn(); - case AURA2CORA_EN: - return visitor.visitAura2CoraEn(); - case AURA_STELLA_EN: - return visitor.visitAuraStellaEn(); - case AURA2HELENA_EN: - return visitor.visitAura2HelenaEn(); - case AURA2AQUILA_ES: - return visitor.visitAura2AquilaEs(); - case AURA2ATLAS_EN: - return visitor.visitAura2AtlasEn(); - case AURA2ORION_EN: - return visitor.visitAura2OrionEn(); - case AURA2DRACO_EN: - return visitor.visitAura2DracoEn(); - case AURA2HYPERION_EN: - return visitor.visitAura2HyperionEn(); - case AURA2JANUS_EN: - return visitor.visitAura2JanusEn(); - case AURA_HELIOS_EN: - return visitor.visitAuraHeliosEn(); - case AURA2PLUTO_EN: - return visitor.visitAura2PlutoEn(); - case AURA2ARCAS_EN: - return visitor.visitAura2ArcasEn(); - case AURA2NESTOR_ES: - return visitor.visitAura2NestorEs(); - case AURA2NEPTUNE_EN: - return visitor.visitAura2NeptuneEn(); - case AURA2MINERVA_EN: - return visitor.visitAura2MinervaEn(); - case AURA2ALVARO_ES: - return visitor.visitAura2AlvaroEs(); - case AURA_ATHENA_EN: - return visitor.visitAuraAthenaEn(); - case AURA_PERSEUS_EN: - return visitor.visitAuraPerseusEn(); - case AURA2ODYSSEUS_EN: - return visitor.visitAura2OdysseusEn(); - case AURA2PANDORA_EN: - return visitor.visitAura2PandoraEn(); - case AURA2ZEUS_EN: - return visitor.visitAura2ZeusEn(); - case AURA2ELECTRA_EN: - return visitor.visitAura2ElectraEn(); - case AURA2ORPHEUS_EN: - return visitor.visitAura2OrpheusEn(); - case AURA2THALIA_EN: - return visitor.visitAura2ThaliaEn(); - case AURA2CELESTE_ES: - return visitor.visitAura2CelesteEs(); - case AURA_ASTERIA_EN: - return visitor.visitAuraAsteriaEn(); - case AURA2ESTRELLA_ES: - return visitor.visitAura2EstrellaEs(); - case AURA2HERA_EN: - return visitor.visitAura2HeraEn(); - case AURA2MARS_EN: - return visitor.visitAura2MarsEn(); - case AURA2SIRIO_ES: - return visitor.visitAura2SirioEs(); - case AURA2ASTERIA_EN: - return visitor.visitAura2AsteriaEn(); - case AURA2HERMES_EN: - return visitor.visitAura2HermesEn(); - case AURA2VESTA_EN: - return visitor.visitAura2VestaEn(); - case AURA2CARINA_ES: - return visitor.visitAura2CarinaEs(); - case AURA2CALLISTA_EN: - return visitor.visitAura2CallistaEn(); - case AURA2HARMONIA_EN: - return visitor.visitAura2HarmoniaEn(); - case AURA2SELENA_ES: - return visitor.visitAura2SelenaEs(); - case AURA2AURORA_EN: - return visitor.visitAura2AuroraEn(); - case AURA_ZEUS_EN: - return visitor.visitAuraZeusEn(); - case AURA2OPHELIA_EN: - return visitor.visitAura2OpheliaEn(); - case AURA2AMALTHEA_EN: - return visitor.visitAura2AmaltheaEn(); - case AURA_ORPHEUS_EN: - return visitor.visitAuraOrpheusEn(); - case AURA2DELIA_EN: - return visitor.visitAura2DeliaEn(); - case AURA_LUNA_EN: - return visitor.visitAuraLunaEn(); - case AURA2APOLLO_EN: - return visitor.visitAura2ApolloEn(); - case AURA2SELENE_EN: - return visitor.visitAura2SeleneEn(); - case AURA2THEIA_EN: - return visitor.visitAura2TheiaEn(); - case AURA_HERA_EN: - return visitor.visitAuraHeraEn(); - case AURA2CORDELIA_EN: - return visitor.visitAura2CordeliaEn(); - case AURA2ANDROMEDA_EN: - return visitor.visitAura2AndromedaEn(); - case AURA2ARIES_EN: - return visitor.visitAura2AriesEn(); - case AURA2JUNO_EN: - return visitor.visitAura2JunoEn(); - case AURA2LUNA_EN: - return visitor.visitAura2LunaEn(); - case AURA2DIANA_ES: - return visitor.visitAura2DianaEs(); - case AURA2JAVIER_ES: - return visitor.visitAura2JavierEs(); - case AURA_ORION_EN: - return visitor.visitAuraOrionEn(); - case AURA_ARCAS_EN: - return visitor.visitAuraArcasEn(); - case AURA2IRIS_EN: - return visitor.visitAura2IrisEn(); - case AURA2ATHENA_EN: - return visitor.visitAura2AthenaEn(); - case AURA2SATURN_EN: - return visitor.visitAura2SaturnEn(); - case AURA2PHOEBE_EN: - return visitor.visitAura2PhoebeEn(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static DeepgramSpeakProviderModel valueOf(String value) { - switch (value) { - case "aura-angus-en": - return AURA_ANGUS_EN; - case "aura-2-jupiter-en": - return AURA2JUPITER_EN; - case "aura-2-cora-en": - return AURA2CORA_EN; - case "aura-stella-en": - return AURA_STELLA_EN; - case "aura-2-helena-en": - return AURA2HELENA_EN; - case "aura-2-aquila-es": - return AURA2AQUILA_ES; - case "aura-2-atlas-en": - return AURA2ATLAS_EN; - case "aura-2-orion-en": - return AURA2ORION_EN; - case "aura-2-draco-en": - return AURA2DRACO_EN; - case "aura-2-hyperion-en": - return AURA2HYPERION_EN; - case "aura-2-janus-en": - return AURA2JANUS_EN; - case "aura-helios-en": - return AURA_HELIOS_EN; - case "aura-2-pluto-en": - return AURA2PLUTO_EN; - case "aura-2-arcas-en": - return AURA2ARCAS_EN; - case "aura-2-nestor-es": - return AURA2NESTOR_ES; - case "aura-2-neptune-en": - return AURA2NEPTUNE_EN; - case "aura-2-minerva-en": - return AURA2MINERVA_EN; - case "aura-2-alvaro-es": - return AURA2ALVARO_ES; - case "aura-athena-en": - return AURA_ATHENA_EN; - case "aura-perseus-en": - return AURA_PERSEUS_EN; - case "aura-2-odysseus-en": - return AURA2ODYSSEUS_EN; - case "aura-2-pandora-en": - return AURA2PANDORA_EN; - case "aura-2-zeus-en": - return AURA2ZEUS_EN; - case "aura-2-electra-en": - return AURA2ELECTRA_EN; - case "aura-2-orpheus-en": - return AURA2ORPHEUS_EN; - case "aura-2-thalia-en": - return AURA2THALIA_EN; - case "aura-2-celeste-es": - return AURA2CELESTE_ES; - case "aura-asteria-en": - return AURA_ASTERIA_EN; - case "aura-2-estrella-es": - return AURA2ESTRELLA_ES; - case "aura-2-hera-en": - return AURA2HERA_EN; - case "aura-2-mars-en": - return AURA2MARS_EN; - case "aura-2-sirio-es": - return AURA2SIRIO_ES; - case "aura-2-asteria-en": - return AURA2ASTERIA_EN; - case "aura-2-hermes-en": - return AURA2HERMES_EN; - case "aura-2-vesta-en": - return AURA2VESTA_EN; - case "aura-2-carina-es": - return AURA2CARINA_ES; - case "aura-2-callista-en": - return AURA2CALLISTA_EN; - case "aura-2-harmonia-en": - return AURA2HARMONIA_EN; - case "aura-2-selena-es": - return AURA2SELENA_ES; - case "aura-2-aurora-en": - return AURA2AURORA_EN; - case "aura-zeus-en": - return AURA_ZEUS_EN; - case "aura-2-ophelia-en": - return AURA2OPHELIA_EN; - case "aura-2-amalthea-en": - return AURA2AMALTHEA_EN; - case "aura-orpheus-en": - return AURA_ORPHEUS_EN; - case "aura-2-delia-en": - return AURA2DELIA_EN; - case "aura-luna-en": - return AURA_LUNA_EN; - case "aura-2-apollo-en": - return AURA2APOLLO_EN; - case "aura-2-selene-en": - return AURA2SELENE_EN; - case "aura-2-theia-en": - return AURA2THEIA_EN; - case "aura-hera-en": - return AURA_HERA_EN; - case "aura-2-cordelia-en": - return AURA2CORDELIA_EN; - case "aura-2-andromeda-en": - return AURA2ANDROMEDA_EN; - case "aura-2-aries-en": - return AURA2ARIES_EN; - case "aura-2-juno-en": - return AURA2JUNO_EN; - case "aura-2-luna-en": - return AURA2LUNA_EN; - case "aura-2-diana-es": - return AURA2DIANA_ES; - case "aura-2-javier-es": - return AURA2JAVIER_ES; - case "aura-orion-en": - return AURA_ORION_EN; - case "aura-arcas-en": - return AURA_ARCAS_EN; - case "aura-2-iris-en": - return AURA2IRIS_EN; - case "aura-2-athena-en": - return AURA2ATHENA_EN; - case "aura-2-saturn-en": - return AURA2SATURN_EN; - case "aura-2-phoebe-en": - return AURA2PHOEBE_EN; - default: - return new DeepgramSpeakProviderModel(Value.UNKNOWN, value); - } - } - - public enum Value { - AURA_ASTERIA_EN, - - AURA_LUNA_EN, - - AURA_STELLA_EN, - - AURA_ATHENA_EN, - - AURA_HERA_EN, - - AURA_ORION_EN, - - AURA_ARCAS_EN, - - AURA_PERSEUS_EN, - - AURA_ANGUS_EN, - - AURA_ORPHEUS_EN, - - AURA_HELIOS_EN, - - AURA_ZEUS_EN, - - AURA2AMALTHEA_EN, - - AURA2ANDROMEDA_EN, - - AURA2APOLLO_EN, - - AURA2ARCAS_EN, - - AURA2ARIES_EN, - - AURA2ASTERIA_EN, - - AURA2ATHENA_EN, - - AURA2ATLAS_EN, - - AURA2AURORA_EN, - - AURA2CALLISTA_EN, - - AURA2CORA_EN, - - AURA2CORDELIA_EN, - - AURA2DELIA_EN, - - AURA2DRACO_EN, - - AURA2ELECTRA_EN, - - AURA2HARMONIA_EN, - - AURA2HELENA_EN, - - AURA2HERA_EN, - - AURA2HERMES_EN, - - AURA2HYPERION_EN, - - AURA2IRIS_EN, - - AURA2JANUS_EN, - - AURA2JUNO_EN, - - AURA2JUPITER_EN, - - AURA2LUNA_EN, - - AURA2MARS_EN, - - AURA2MINERVA_EN, - - AURA2NEPTUNE_EN, - - AURA2ODYSSEUS_EN, - - AURA2OPHELIA_EN, - - AURA2ORION_EN, - - AURA2ORPHEUS_EN, - - AURA2PANDORA_EN, - - AURA2PHOEBE_EN, - - AURA2PLUTO_EN, - - AURA2SATURN_EN, - - AURA2SELENE_EN, - - AURA2THALIA_EN, - - AURA2THEIA_EN, - - AURA2VESTA_EN, - - AURA2ZEUS_EN, - - AURA2SIRIO_ES, - - AURA2NESTOR_ES, - - AURA2CARINA_ES, - - AURA2CELESTE_ES, - - AURA2ALVARO_ES, - - AURA2DIANA_ES, - - AURA2AQUILA_ES, - - AURA2SELENA_ES, - - AURA2ESTRELLA_ES, - - AURA2JAVIER_ES, - - UNKNOWN - } - - public interface Visitor { - T visitAuraAsteriaEn(); - - T visitAuraLunaEn(); - - T visitAuraStellaEn(); - - T visitAuraAthenaEn(); - - T visitAuraHeraEn(); - - T visitAuraOrionEn(); - - T visitAuraArcasEn(); - - T visitAuraPerseusEn(); - - T visitAuraAngusEn(); - - T visitAuraOrpheusEn(); - - T visitAuraHeliosEn(); - - T visitAuraZeusEn(); - - T visitAura2AmaltheaEn(); - - T visitAura2AndromedaEn(); - - T visitAura2ApolloEn(); - - T visitAura2ArcasEn(); - - T visitAura2AriesEn(); - - T visitAura2AsteriaEn(); - - T visitAura2AthenaEn(); - - T visitAura2AtlasEn(); - - T visitAura2AuroraEn(); - - T visitAura2CallistaEn(); - - T visitAura2CoraEn(); - - T visitAura2CordeliaEn(); - - T visitAura2DeliaEn(); - - T visitAura2DracoEn(); - - T visitAura2ElectraEn(); - - T visitAura2HarmoniaEn(); - - T visitAura2HelenaEn(); - - T visitAura2HeraEn(); - - T visitAura2HermesEn(); - - T visitAura2HyperionEn(); - - T visitAura2IrisEn(); - - T visitAura2JanusEn(); - - T visitAura2JunoEn(); - - T visitAura2JupiterEn(); - - T visitAura2LunaEn(); - - T visitAura2MarsEn(); - - T visitAura2MinervaEn(); - - T visitAura2NeptuneEn(); - - T visitAura2OdysseusEn(); - - T visitAura2OpheliaEn(); - - T visitAura2OrionEn(); - - T visitAura2OrpheusEn(); - - T visitAura2PandoraEn(); - - T visitAura2PhoebeEn(); - - T visitAura2PlutoEn(); - - T visitAura2SaturnEn(); - - T visitAura2SeleneEn(); - - T visitAura2ThaliaEn(); - - T visitAura2TheiaEn(); - - T visitAura2VestaEn(); - - T visitAura2ZeusEn(); - - T visitAura2SirioEs(); - - T visitAura2NestorEs(); - - T visitAura2CarinaEs(); - - T visitAura2CelesteEs(); - - T visitAura2AlvaroEs(); - - T visitAura2DianaEs(); - - T visitAura2AquilaEs(); - - T visitAura2SelenaEs(); - - T visitAura2EstrellaEs(); - - T visitAura2JavierEs(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/types/DeleteProjectInviteV1Response.java b/src/main/java/types/DeleteProjectInviteV1Response.java deleted file mode 100644 index 9a248c3..0000000 --- a/src/main/java/types/DeleteProjectInviteV1Response.java +++ /dev/null @@ -1,108 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = DeleteProjectInviteV1Response.Builder.class) -public final class DeleteProjectInviteV1Response { - private final Optional message; - - private final Map additionalProperties; - - private DeleteProjectInviteV1Response( - Optional message, Map additionalProperties) { - this.message = message; - this.additionalProperties = additionalProperties; - } - - /** - * @return confirmation message - */ - @JsonProperty("message") - public Optional getMessage() { - return message; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof DeleteProjectInviteV1Response - && equalTo((DeleteProjectInviteV1Response) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(DeleteProjectInviteV1Response 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 Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional message = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(DeleteProjectInviteV1Response other) { - message(other.getMessage()); - return this; - } - - /** confirmation message */ - @JsonSetter(value = "message", nulls = Nulls.SKIP) - public Builder message(Optional message) { - this.message = message; - return this; - } - - public Builder message(String message) { - this.message = Optional.ofNullable(message); - return this; - } - - public DeleteProjectInviteV1Response build() { - return new DeleteProjectInviteV1Response(message, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/DeleteProjectKeyV1Response.java b/src/main/java/types/DeleteProjectKeyV1Response.java deleted file mode 100644 index 9fece78..0000000 --- a/src/main/java/types/DeleteProjectKeyV1Response.java +++ /dev/null @@ -1,104 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = DeleteProjectKeyV1Response.Builder.class) -public final class DeleteProjectKeyV1Response { - private final Optional message; - - private final Map additionalProperties; - - private DeleteProjectKeyV1Response( - Optional message, Map additionalProperties) { - this.message = message; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("message") - public Optional getMessage() { - return message; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof DeleteProjectKeyV1Response - && equalTo((DeleteProjectKeyV1Response) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(DeleteProjectKeyV1Response 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 Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional message = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(DeleteProjectKeyV1Response other) { - message(other.getMessage()); - return this; - } - - @JsonSetter(value = "message", nulls = Nulls.SKIP) - public Builder message(Optional message) { - this.message = message; - return this; - } - - public Builder message(String message) { - this.message = Optional.ofNullable(message); - return this; - } - - public DeleteProjectKeyV1Response build() { - return new DeleteProjectKeyV1Response(message, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/DeleteProjectMemberV1Response.java b/src/main/java/types/DeleteProjectMemberV1Response.java deleted file mode 100644 index cde17c5..0000000 --- a/src/main/java/types/DeleteProjectMemberV1Response.java +++ /dev/null @@ -1,108 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = DeleteProjectMemberV1Response.Builder.class) -public final class DeleteProjectMemberV1Response { - private final Optional message; - - private final Map additionalProperties; - - private DeleteProjectMemberV1Response( - Optional message, Map additionalProperties) { - this.message = message; - this.additionalProperties = additionalProperties; - } - - /** - * @return confirmation message - */ - @JsonProperty("message") - public Optional getMessage() { - return message; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof DeleteProjectMemberV1Response - && equalTo((DeleteProjectMemberV1Response) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(DeleteProjectMemberV1Response 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 Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional message = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(DeleteProjectMemberV1Response other) { - message(other.getMessage()); - return this; - } - - /** confirmation message */ - @JsonSetter(value = "message", nulls = Nulls.SKIP) - public Builder message(Optional message) { - this.message = message; - return this; - } - - public Builder message(String message) { - this.message = Optional.ofNullable(message); - return this; - } - - public DeleteProjectMemberV1Response build() { - return new DeleteProjectMemberV1Response(message, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/DeleteProjectV1Response.java b/src/main/java/types/DeleteProjectV1Response.java deleted file mode 100644 index f10ace2..0000000 --- a/src/main/java/types/DeleteProjectV1Response.java +++ /dev/null @@ -1,107 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = DeleteProjectV1Response.Builder.class) -public final class DeleteProjectV1Response { - private final Optional message; - - private final Map additionalProperties; - - private DeleteProjectV1Response( - Optional message, Map additionalProperties) { - this.message = message; - this.additionalProperties = additionalProperties; - } - - /** - * @return Confirmation message - */ - @JsonProperty("message") - public Optional getMessage() { - return message; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof DeleteProjectV1Response && equalTo((DeleteProjectV1Response) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(DeleteProjectV1Response 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 Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional message = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(DeleteProjectV1Response other) { - message(other.getMessage()); - return this; - } - - /** Confirmation message */ - @JsonSetter(value = "message", nulls = Nulls.SKIP) - public Builder message(Optional message) { - this.message = message; - return this; - } - - public Builder message(String message) { - this.message = Optional.ofNullable(message); - return this; - } - - public DeleteProjectV1Response build() { - return new DeleteProjectV1Response(message, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ElevenLabsSpeakProvider.java b/src/main/java/types/ElevenLabsSpeakProvider.java deleted file mode 100644 index 174ba2c..0000000 --- a/src/main/java/types/ElevenLabsSpeakProvider.java +++ /dev/null @@ -1,264 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ElevenLabsSpeakProvider.Builder.class) -public final class ElevenLabsSpeakProvider { - private final Optional version; - - private final ElevenLabsSpeakProviderModelId modelId; - - private final Optional language; - - private final Optional languageCode; - - private final Map additionalProperties; - - private ElevenLabsSpeakProvider( - Optional version, - ElevenLabsSpeakProviderModelId modelId, - Optional language, - Optional languageCode, - Map additionalProperties) { - this.version = version; - this.modelId = modelId; - this.language = language; - this.languageCode = languageCode; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("type") - public String getType() { - return "eleven_labs"; - } - - /** - * @return The REST API version for the ElevenLabs text-to-speech API - */ - @JsonProperty("version") - public Optional getVersion() { - return version; - } - - /** - * @return Eleven Labs model ID - */ - @JsonProperty("model_id") - public ElevenLabsSpeakProviderModelId getModelId() { - return modelId; - } - - /** - * @return Optional language to use, e.g. 'en-US'. Corresponds to the language_code - * parameter in the ElevenLabs API - */ - @JsonProperty("language") - public Optional getLanguage() { - return language; - } - - /** - * @return Use the language field instead. - */ - @JsonProperty("language_code") - public Optional getLanguageCode() { - return languageCode; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ElevenLabsSpeakProvider && equalTo((ElevenLabsSpeakProvider) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ElevenLabsSpeakProvider other) { - return version.equals(other.version) - && modelId.equals(other.modelId) - && language.equals(other.language) - && languageCode.equals(other.languageCode); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.version, this.modelId, this.language, this.languageCode); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static ModelIdStage builder() { - return new Builder(); - } - - public interface ModelIdStage { - /** Eleven Labs model ID */ - _FinalStage modelId(@NotNull ElevenLabsSpeakProviderModelId modelId); - - Builder from(ElevenLabsSpeakProvider other); - } - - public interface _FinalStage { - ElevenLabsSpeakProvider build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** The REST API version for the ElevenLabs text-to-speech API */ - _FinalStage version(Optional version); - - _FinalStage version(String version); - - /** - * Optional language to use, e.g. 'en-US'. Corresponds to the language_code - * parameter in the ElevenLabs API - */ - _FinalStage language(Optional language); - - _FinalStage language(String language); - - /** Use the language field instead. */ - _FinalStage languageCode(Optional languageCode); - - _FinalStage languageCode(String languageCode); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements ModelIdStage, _FinalStage { - private ElevenLabsSpeakProviderModelId modelId; - - private Optional languageCode = Optional.empty(); - - private Optional language = Optional.empty(); - - private Optional version = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(ElevenLabsSpeakProvider other) { - version(other.getVersion()); - modelId(other.getModelId()); - language(other.getLanguage()); - languageCode(other.getLanguageCode()); - return this; - } - - /** - * Eleven Labs model ID - * - *

Eleven Labs model ID - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("model_id") - public _FinalStage modelId(@NotNull ElevenLabsSpeakProviderModelId modelId) { - this.modelId = Objects.requireNonNull(modelId, "modelId must not be null"); - return this; - } - - /** - * Use the language field instead. - * - * @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; - } - - /** Use the language field instead. */ - @java.lang.Override - @JsonSetter(value = "language_code", nulls = Nulls.SKIP) - public _FinalStage languageCode(Optional languageCode) { - this.languageCode = languageCode; - return this; - } - - /** - * Optional language to use, e.g. 'en-US'. Corresponds to the language_code - * parameter in the ElevenLabs API - * - * @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; - } - - /** - * Optional language to use, e.g. 'en-US'. Corresponds to the language_code - * parameter in the ElevenLabs API - */ - @java.lang.Override - @JsonSetter(value = "language", nulls = Nulls.SKIP) - public _FinalStage language(Optional language) { - this.language = language; - return this; - } - - /** - * The REST API version for the ElevenLabs text-to-speech API - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage version(String version) { - this.version = Optional.ofNullable(version); - return this; - } - - /** The REST API version for the ElevenLabs text-to-speech API */ - @java.lang.Override - @JsonSetter(value = "version", nulls = Nulls.SKIP) - public _FinalStage version(Optional version) { - this.version = version; - return this; - } - - @java.lang.Override - public ElevenLabsSpeakProvider build() { - return new ElevenLabsSpeakProvider( - version, modelId, language, languageCode, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ElevenLabsSpeakProviderModelId.java b/src/main/java/types/ElevenLabsSpeakProviderModelId.java deleted file mode 100644 index 777c893..0000000 --- a/src/main/java/types/ElevenLabsSpeakProviderModelId.java +++ /dev/null @@ -1,95 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class ElevenLabsSpeakProviderModelId { - public static final ElevenLabsSpeakProviderModelId ELEVEN_TURBO_V25 = - new ElevenLabsSpeakProviderModelId(Value.ELEVEN_TURBO_V25, "eleven_turbo_v2_5"); - - public static final ElevenLabsSpeakProviderModelId ELEVEN_MONOLINGUAL_V1 = - new ElevenLabsSpeakProviderModelId(Value.ELEVEN_MONOLINGUAL_V1, "eleven_monolingual_v1"); - - public static final ElevenLabsSpeakProviderModelId ELEVEN_MULTILINGUAL_V2 = - new ElevenLabsSpeakProviderModelId(Value.ELEVEN_MULTILINGUAL_V2, "eleven_multilingual_v2"); - - private final Value value; - - private final String string; - - ElevenLabsSpeakProviderModelId(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof ElevenLabsSpeakProviderModelId - && this.string.equals(((ElevenLabsSpeakProviderModelId) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case ELEVEN_TURBO_V25: - return visitor.visitElevenTurboV25(); - case ELEVEN_MONOLINGUAL_V1: - return visitor.visitElevenMonolingualV1(); - case ELEVEN_MULTILINGUAL_V2: - return visitor.visitElevenMultilingualV2(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ElevenLabsSpeakProviderModelId valueOf(String value) { - switch (value) { - case "eleven_turbo_v2_5": - return ELEVEN_TURBO_V25; - case "eleven_monolingual_v1": - return ELEVEN_MONOLINGUAL_V1; - case "eleven_multilingual_v2": - return ELEVEN_MULTILINGUAL_V2; - default: - return new ElevenLabsSpeakProviderModelId(Value.UNKNOWN, value); - } - } - - public enum Value { - ELEVEN_TURBO_V25, - - ELEVEN_MONOLINGUAL_V1, - - ELEVEN_MULTILINGUAL_V2, - - UNKNOWN - } - - public interface Visitor { - T visitElevenTurboV25(); - - T visitElevenMonolingualV1(); - - T visitElevenMultilingualV2(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/types/ErrorResponse.java b/src/main/java/types/ErrorResponse.java deleted file mode 100644 index c8250a5..0000000 --- a/src/main/java/types/ErrorResponse.java +++ /dev/null @@ -1,106 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package 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 core.ObjectMappers; -import java.io.IOException; -import java.util.Objects; - -@JsonDeserialize(using = ErrorResponse.Deserializer.class) -public final class ErrorResponse { - private final Object value; - - private final int type; - - private ErrorResponse(Object value, int type) { - this.value = value; - this.type = type; - } - - @JsonValue - public Object get() { - return this.value; - } - - @SuppressWarnings("unchecked") - public T visit(Visitor visitor) { - if (this.type == 0) { - return visitor.visit((String) this.value); - } else if (this.type == 1) { - return visitor.visit((ErrorResponseLegacyError) this.value); - } else if (this.type == 2) { - return visitor.visit((ErrorResponseModernError) 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 ErrorResponse && equalTo((ErrorResponse) other); - } - - private boolean equalTo(ErrorResponse 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 ErrorResponse of(String value) { - return new ErrorResponse(value, 0); - } - - public static ErrorResponse of(ErrorResponseLegacyError value) { - return new ErrorResponse(value, 1); - } - - public static ErrorResponse of(ErrorResponseModernError value) { - return new ErrorResponse(value, 2); - } - - public interface Visitor { - T visit(String value); - - T visit(ErrorResponseLegacyError value); - - T visit(ErrorResponseModernError value); - } - - static final class Deserializer extends StdDeserializer { - Deserializer() { - super(ErrorResponse.class); - } - - @java.lang.Override - public ErrorResponse deserialize(JsonParser p, DeserializationContext context) - throws IOException { - Object value = p.readValueAs(Object.class); - try { - return of(ObjectMappers.JSON_MAPPER.convertValue(value, String.class)); - } catch (RuntimeException e) { - } - try { - return of(ObjectMappers.JSON_MAPPER.convertValue(value, ErrorResponseLegacyError.class)); - } catch (RuntimeException e) { - } - try { - return of(ObjectMappers.JSON_MAPPER.convertValue(value, ErrorResponseModernError.class)); - } catch (RuntimeException e) { - } - throw new JsonParseException(p, "Failed to deserialize"); - } - } -} diff --git a/src/main/java/types/ErrorResponseLegacyError.java b/src/main/java/types/ErrorResponseLegacyError.java deleted file mode 100644 index 4accc6f..0000000 --- a/src/main/java/types/ErrorResponseLegacyError.java +++ /dev/null @@ -1,164 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ErrorResponseLegacyError.Builder.class) -public final class ErrorResponseLegacyError { - private final Optional errCode; - - private final Optional errMsg; - - private final Optional requestId; - - private final Map additionalProperties; - - private ErrorResponseLegacyError( - Optional errCode, - Optional errMsg, - Optional requestId, - Map additionalProperties) { - this.errCode = errCode; - this.errMsg = errMsg; - this.requestId = requestId; - this.additionalProperties = additionalProperties; - } - - /** - * @return The error code - */ - @JsonProperty("err_code") - public Optional getErrCode() { - return errCode; - } - - /** - * @return The error message - */ - @JsonProperty("err_msg") - public Optional getErrMsg() { - return errMsg; - } - - /** - * @return The request ID - */ - @JsonProperty("request_id") - public Optional getRequestId() { - return requestId; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ErrorResponseLegacyError && equalTo((ErrorResponseLegacyError) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ErrorResponseLegacyError other) { - return errCode.equals(other.errCode) - && errMsg.equals(other.errMsg) - && requestId.equals(other.requestId); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.errCode, this.errMsg, this.requestId); - } - - @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 errCode = Optional.empty(); - - private Optional errMsg = Optional.empty(); - - private Optional requestId = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ErrorResponseLegacyError other) { - errCode(other.getErrCode()); - errMsg(other.getErrMsg()); - requestId(other.getRequestId()); - return this; - } - - /** The error code */ - @JsonSetter(value = "err_code", nulls = Nulls.SKIP) - public Builder errCode(Optional errCode) { - this.errCode = errCode; - return this; - } - - public Builder errCode(String errCode) { - this.errCode = Optional.ofNullable(errCode); - return this; - } - - /** The error message */ - @JsonSetter(value = "err_msg", nulls = Nulls.SKIP) - public Builder errMsg(Optional errMsg) { - this.errMsg = errMsg; - return this; - } - - public Builder errMsg(String errMsg) { - this.errMsg = Optional.ofNullable(errMsg); - return this; - } - - /** The request ID */ - @JsonSetter(value = "request_id", nulls = Nulls.SKIP) - public Builder requestId(Optional requestId) { - this.requestId = requestId; - return this; - } - - public Builder requestId(String requestId) { - this.requestId = Optional.ofNullable(requestId); - return this; - } - - public ErrorResponseLegacyError build() { - return new ErrorResponseLegacyError(errCode, errMsg, requestId, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ErrorResponseModernError.java b/src/main/java/types/ErrorResponseModernError.java deleted file mode 100644 index 1bdc531..0000000 --- a/src/main/java/types/ErrorResponseModernError.java +++ /dev/null @@ -1,193 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ErrorResponseModernError.Builder.class) -public final class ErrorResponseModernError { - private final Optional category; - - private final Optional message; - - private final Optional details; - - private final Optional requestId; - - private final Map additionalProperties; - - private ErrorResponseModernError( - Optional category, - Optional message, - Optional details, - Optional requestId, - Map additionalProperties) { - this.category = category; - this.message = message; - this.details = details; - this.requestId = requestId; - this.additionalProperties = additionalProperties; - } - - /** - * @return The category of the error - */ - @JsonProperty("category") - public Optional getCategory() { - return category; - } - - /** - * @return A message about the error - */ - @JsonProperty("message") - public Optional getMessage() { - return message; - } - - /** - * @return A description of the error - */ - @JsonProperty("details") - public Optional getDetails() { - return details; - } - - /** - * @return The unique identifier of the request - */ - @JsonProperty("request_id") - public Optional getRequestId() { - return requestId; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ErrorResponseModernError && equalTo((ErrorResponseModernError) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ErrorResponseModernError other) { - return category.equals(other.category) - && message.equals(other.message) - && details.equals(other.details) - && requestId.equals(other.requestId); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.category, this.message, this.details, this.requestId); - } - - @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 category = Optional.empty(); - - private Optional message = Optional.empty(); - - private Optional details = Optional.empty(); - - private Optional requestId = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ErrorResponseModernError other) { - category(other.getCategory()); - message(other.getMessage()); - details(other.getDetails()); - requestId(other.getRequestId()); - return this; - } - - /** The category of the error */ - @JsonSetter(value = "category", nulls = Nulls.SKIP) - public Builder category(Optional category) { - this.category = category; - return this; - } - - public Builder category(String category) { - this.category = Optional.ofNullable(category); - return this; - } - - /** A message about the error */ - @JsonSetter(value = "message", nulls = Nulls.SKIP) - public Builder message(Optional message) { - this.message = message; - return this; - } - - public Builder message(String message) { - this.message = Optional.ofNullable(message); - return this; - } - - /** A description of the error */ - @JsonSetter(value = "details", nulls = Nulls.SKIP) - public Builder details(Optional details) { - this.details = details; - return this; - } - - public Builder details(String details) { - this.details = Optional.ofNullable(details); - return this; - } - - /** The unique identifier of the request */ - @JsonSetter(value = "request_id", nulls = Nulls.SKIP) - public Builder requestId(Optional requestId) { - this.requestId = requestId; - return this; - } - - public Builder requestId(String requestId) { - this.requestId = Optional.ofNullable(requestId); - return this; - } - - public ErrorResponseModernError build() { - return new ErrorResponseModernError( - category, message, details, requestId, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/GetModelV1Response.java b/src/main/java/types/GetModelV1Response.java deleted file mode 100644 index 769d594..0000000 --- a/src/main/java/types/GetModelV1Response.java +++ /dev/null @@ -1,94 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package 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 core.ObjectMappers; -import java.io.IOException; -import java.util.Objects; - -@JsonDeserialize(using = GetModelV1Response.Deserializer.class) -public final class GetModelV1Response { - private final Object value; - - private final int type; - - private GetModelV1Response(Object value, int type) { - this.value = value; - this.type = type; - } - - @JsonValue - public Object get() { - return this.value; - } - - @SuppressWarnings("unchecked") - public T visit(Visitor visitor) { - if (this.type == 0) { - return visitor.visit((GetModelV1ResponseBatch) this.value); - } else if (this.type == 1) { - return visitor.visit((GetModelV1ResponseMetadata) 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 GetModelV1Response && equalTo((GetModelV1Response) other); - } - - private boolean equalTo(GetModelV1Response 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 GetModelV1Response of(GetModelV1ResponseBatch value) { - return new GetModelV1Response(value, 0); - } - - public static GetModelV1Response of(GetModelV1ResponseMetadata value) { - return new GetModelV1Response(value, 1); - } - - public interface Visitor { - T visit(GetModelV1ResponseBatch value); - - T visit(GetModelV1ResponseMetadata value); - } - - static final class Deserializer extends StdDeserializer { - Deserializer() { - super(GetModelV1Response.class); - } - - @java.lang.Override - public GetModelV1Response deserialize(JsonParser p, DeserializationContext context) - throws IOException { - Object value = p.readValueAs(Object.class); - try { - return of(ObjectMappers.JSON_MAPPER.convertValue(value, GetModelV1ResponseBatch.class)); - } catch (RuntimeException e) { - } - try { - return of(ObjectMappers.JSON_MAPPER.convertValue(value, GetModelV1ResponseMetadata.class)); - } catch (RuntimeException e) { - } - throw new JsonParseException(p, "Failed to deserialize"); - } - } -} diff --git a/src/main/java/types/GetModelV1ResponseBatch.java b/src/main/java/types/GetModelV1ResponseBatch.java deleted file mode 100644 index 9e10c23..0000000 --- a/src/main/java/types/GetModelV1ResponseBatch.java +++ /dev/null @@ -1,316 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = GetModelV1ResponseBatch.Builder.class) -public final class GetModelV1ResponseBatch { - private final Optional name; - - private final Optional canonicalName; - - private final Optional architecture; - - private final Optional> languages; - - private final Optional version; - - private final Optional uuid; - - private final Optional batch; - - private final Optional streaming; - - private final Optional formattedOutput; - - private final Map additionalProperties; - - private GetModelV1ResponseBatch( - Optional name, - Optional canonicalName, - Optional architecture, - Optional> languages, - Optional version, - Optional uuid, - Optional batch, - Optional streaming, - Optional formattedOutput, - Map additionalProperties) { - this.name = name; - this.canonicalName = canonicalName; - this.architecture = architecture; - this.languages = languages; - this.version = version; - this.uuid = uuid; - this.batch = batch; - this.streaming = streaming; - this.formattedOutput = formattedOutput; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("name") - public Optional getName() { - return name; - } - - @JsonProperty("canonical_name") - public Optional getCanonicalName() { - return canonicalName; - } - - @JsonProperty("architecture") - public Optional getArchitecture() { - return architecture; - } - - @JsonProperty("languages") - public Optional> getLanguages() { - return languages; - } - - @JsonProperty("version") - public Optional getVersion() { - return version; - } - - @JsonProperty("uuid") - public Optional getUuid() { - return uuid; - } - - @JsonProperty("batch") - public Optional getBatch() { - return batch; - } - - @JsonProperty("streaming") - public Optional getStreaming() { - return streaming; - } - - @JsonProperty("formatted_output") - public Optional getFormattedOutput() { - return formattedOutput; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof GetModelV1ResponseBatch && equalTo((GetModelV1ResponseBatch) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(GetModelV1ResponseBatch other) { - return name.equals(other.name) - && canonicalName.equals(other.canonicalName) - && architecture.equals(other.architecture) - && languages.equals(other.languages) - && version.equals(other.version) - && uuid.equals(other.uuid) - && batch.equals(other.batch) - && streaming.equals(other.streaming) - && formattedOutput.equals(other.formattedOutput); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.name, - this.canonicalName, - this.architecture, - this.languages, - this.version, - this.uuid, - this.batch, - this.streaming, - this.formattedOutput); - } - - @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 canonicalName = Optional.empty(); - - private Optional architecture = Optional.empty(); - - private Optional> languages = Optional.empty(); - - private Optional version = Optional.empty(); - - private Optional uuid = Optional.empty(); - - private Optional batch = Optional.empty(); - - private Optional streaming = Optional.empty(); - - private Optional formattedOutput = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(GetModelV1ResponseBatch other) { - name(other.getName()); - canonicalName(other.getCanonicalName()); - architecture(other.getArchitecture()); - languages(other.getLanguages()); - version(other.getVersion()); - uuid(other.getUuid()); - batch(other.getBatch()); - streaming(other.getStreaming()); - formattedOutput(other.getFormattedOutput()); - 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 = "canonical_name", nulls = Nulls.SKIP) - public Builder canonicalName(Optional canonicalName) { - this.canonicalName = canonicalName; - return this; - } - - public Builder canonicalName(String canonicalName) { - this.canonicalName = Optional.ofNullable(canonicalName); - return this; - } - - @JsonSetter(value = "architecture", nulls = Nulls.SKIP) - public Builder architecture(Optional architecture) { - this.architecture = architecture; - return this; - } - - public Builder architecture(String architecture) { - this.architecture = Optional.ofNullable(architecture); - return this; - } - - @JsonSetter(value = "languages", nulls = Nulls.SKIP) - public Builder languages(Optional> languages) { - this.languages = languages; - return this; - } - - public Builder languages(List languages) { - this.languages = Optional.ofNullable(languages); - return this; - } - - @JsonSetter(value = "version", nulls = Nulls.SKIP) - public Builder version(Optional version) { - this.version = version; - return this; - } - - public Builder version(String version) { - this.version = Optional.ofNullable(version); - return this; - } - - @JsonSetter(value = "uuid", nulls = Nulls.SKIP) - public Builder uuid(Optional uuid) { - this.uuid = uuid; - return this; - } - - public Builder uuid(String uuid) { - this.uuid = Optional.ofNullable(uuid); - return this; - } - - @JsonSetter(value = "batch", nulls = Nulls.SKIP) - public Builder batch(Optional batch) { - this.batch = batch; - return this; - } - - public Builder batch(Boolean batch) { - this.batch = Optional.ofNullable(batch); - return this; - } - - @JsonSetter(value = "streaming", nulls = Nulls.SKIP) - public Builder streaming(Optional streaming) { - this.streaming = streaming; - return this; - } - - public Builder streaming(Boolean streaming) { - this.streaming = Optional.ofNullable(streaming); - return this; - } - - @JsonSetter(value = "formatted_output", nulls = Nulls.SKIP) - public Builder formattedOutput(Optional formattedOutput) { - this.formattedOutput = formattedOutput; - return this; - } - - public Builder formattedOutput(Boolean formattedOutput) { - this.formattedOutput = Optional.ofNullable(formattedOutput); - return this; - } - - public GetModelV1ResponseBatch build() { - return new GetModelV1ResponseBatch( - name, - canonicalName, - architecture, - languages, - version, - uuid, - batch, - streaming, - formattedOutput, - additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/GetModelV1ResponseMetadata.java b/src/main/java/types/GetModelV1ResponseMetadata.java deleted file mode 100644 index a71fa0b..0000000 --- a/src/main/java/types/GetModelV1ResponseMetadata.java +++ /dev/null @@ -1,265 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = GetModelV1ResponseMetadata.Builder.class) -public final class GetModelV1ResponseMetadata { - private final Optional name; - - private final Optional canonicalName; - - private final Optional architecture; - - private final Optional> languages; - - private final Optional version; - - private final Optional uuid; - - private final Optional metadata; - - private final Map additionalProperties; - - private GetModelV1ResponseMetadata( - Optional name, - Optional canonicalName, - Optional architecture, - Optional> languages, - Optional version, - Optional uuid, - Optional metadata, - Map additionalProperties) { - this.name = name; - this.canonicalName = canonicalName; - this.architecture = architecture; - this.languages = languages; - this.version = version; - this.uuid = uuid; - this.metadata = metadata; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("name") - public Optional getName() { - return name; - } - - @JsonProperty("canonical_name") - public Optional getCanonicalName() { - return canonicalName; - } - - @JsonProperty("architecture") - public Optional getArchitecture() { - return architecture; - } - - @JsonProperty("languages") - public Optional> getLanguages() { - return languages; - } - - @JsonProperty("version") - public Optional getVersion() { - return version; - } - - @JsonProperty("uuid") - public Optional getUuid() { - return uuid; - } - - @JsonProperty("metadata") - public Optional getMetadata() { - return metadata; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof GetModelV1ResponseMetadata - && equalTo((GetModelV1ResponseMetadata) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(GetModelV1ResponseMetadata other) { - return name.equals(other.name) - && canonicalName.equals(other.canonicalName) - && architecture.equals(other.architecture) - && languages.equals(other.languages) - && version.equals(other.version) - && uuid.equals(other.uuid) - && metadata.equals(other.metadata); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.name, - this.canonicalName, - this.architecture, - this.languages, - this.version, - this.uuid, - this.metadata); - } - - @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 canonicalName = Optional.empty(); - - private Optional architecture = Optional.empty(); - - private Optional> languages = Optional.empty(); - - private Optional version = Optional.empty(); - - private Optional uuid = Optional.empty(); - - private Optional metadata = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(GetModelV1ResponseMetadata other) { - name(other.getName()); - canonicalName(other.getCanonicalName()); - architecture(other.getArchitecture()); - languages(other.getLanguages()); - version(other.getVersion()); - uuid(other.getUuid()); - metadata(other.getMetadata()); - 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 = "canonical_name", nulls = Nulls.SKIP) - public Builder canonicalName(Optional canonicalName) { - this.canonicalName = canonicalName; - return this; - } - - public Builder canonicalName(String canonicalName) { - this.canonicalName = Optional.ofNullable(canonicalName); - return this; - } - - @JsonSetter(value = "architecture", nulls = Nulls.SKIP) - public Builder architecture(Optional architecture) { - this.architecture = architecture; - return this; - } - - public Builder architecture(String architecture) { - this.architecture = Optional.ofNullable(architecture); - return this; - } - - @JsonSetter(value = "languages", nulls = Nulls.SKIP) - public Builder languages(Optional> languages) { - this.languages = languages; - return this; - } - - public Builder languages(List languages) { - this.languages = Optional.ofNullable(languages); - return this; - } - - @JsonSetter(value = "version", nulls = Nulls.SKIP) - public Builder version(Optional version) { - this.version = version; - return this; - } - - public Builder version(String version) { - this.version = Optional.ofNullable(version); - return this; - } - - @JsonSetter(value = "uuid", nulls = Nulls.SKIP) - public Builder uuid(Optional uuid) { - this.uuid = uuid; - return this; - } - - public Builder uuid(String uuid) { - this.uuid = Optional.ofNullable(uuid); - return this; - } - - @JsonSetter(value = "metadata", nulls = Nulls.SKIP) - public Builder metadata(Optional metadata) { - this.metadata = metadata; - return this; - } - - public Builder metadata(GetModelV1ResponseMetadataMetadata metadata) { - this.metadata = Optional.ofNullable(metadata); - return this; - } - - public GetModelV1ResponseMetadata build() { - return new GetModelV1ResponseMetadata( - name, - canonicalName, - architecture, - languages, - version, - uuid, - metadata, - additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/GetModelV1ResponseMetadataMetadata.java b/src/main/java/types/GetModelV1ResponseMetadataMetadata.java deleted file mode 100644 index 9b19e5d..0000000 --- a/src/main/java/types/GetModelV1ResponseMetadataMetadata.java +++ /dev/null @@ -1,252 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = GetModelV1ResponseMetadataMetadata.Builder.class) -public final class GetModelV1ResponseMetadataMetadata { - private final Optional accent; - - private final Optional age; - - private final Optional color; - - private final Optional image; - - private final Optional sample; - - private final Optional> tags; - - private final Optional> useCases; - - private final Map additionalProperties; - - private GetModelV1ResponseMetadataMetadata( - Optional accent, - Optional age, - Optional color, - Optional image, - Optional sample, - Optional> tags, - Optional> useCases, - Map additionalProperties) { - this.accent = accent; - this.age = age; - this.color = color; - this.image = image; - this.sample = sample; - this.tags = tags; - this.useCases = useCases; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("accent") - public Optional getAccent() { - return accent; - } - - @JsonProperty("age") - public Optional getAge() { - return age; - } - - @JsonProperty("color") - public Optional getColor() { - return color; - } - - @JsonProperty("image") - public Optional getImage() { - return image; - } - - @JsonProperty("sample") - public Optional getSample() { - return sample; - } - - @JsonProperty("tags") - public Optional> getTags() { - return tags; - } - - @JsonProperty("use_cases") - public Optional> getUseCases() { - return useCases; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof GetModelV1ResponseMetadataMetadata - && equalTo((GetModelV1ResponseMetadataMetadata) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(GetModelV1ResponseMetadataMetadata other) { - return accent.equals(other.accent) - && age.equals(other.age) - && color.equals(other.color) - && image.equals(other.image) - && sample.equals(other.sample) - && tags.equals(other.tags) - && useCases.equals(other.useCases); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.accent, this.age, this.color, this.image, this.sample, this.tags, this.useCases); - } - - @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 accent = Optional.empty(); - - private Optional age = Optional.empty(); - - private Optional color = Optional.empty(); - - private Optional image = Optional.empty(); - - private Optional sample = Optional.empty(); - - private Optional> tags = Optional.empty(); - - private Optional> useCases = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(GetModelV1ResponseMetadataMetadata other) { - accent(other.getAccent()); - age(other.getAge()); - color(other.getColor()); - image(other.getImage()); - sample(other.getSample()); - tags(other.getTags()); - useCases(other.getUseCases()); - return this; - } - - @JsonSetter(value = "accent", nulls = Nulls.SKIP) - public Builder accent(Optional accent) { - this.accent = accent; - return this; - } - - public Builder accent(String accent) { - this.accent = Optional.ofNullable(accent); - return this; - } - - @JsonSetter(value = "age", nulls = Nulls.SKIP) - public Builder age(Optional age) { - this.age = age; - return this; - } - - public Builder age(String age) { - this.age = Optional.ofNullable(age); - return this; - } - - @JsonSetter(value = "color", nulls = Nulls.SKIP) - public Builder color(Optional color) { - this.color = color; - return this; - } - - public Builder color(String color) { - this.color = Optional.ofNullable(color); - return this; - } - - @JsonSetter(value = "image", nulls = Nulls.SKIP) - public Builder image(Optional image) { - this.image = image; - return this; - } - - public Builder image(String image) { - this.image = Optional.ofNullable(image); - return this; - } - - @JsonSetter(value = "sample", nulls = Nulls.SKIP) - public Builder sample(Optional sample) { - this.sample = sample; - return this; - } - - public Builder sample(String sample) { - this.sample = Optional.ofNullable(sample); - return this; - } - - @JsonSetter(value = "tags", nulls = Nulls.SKIP) - public Builder tags(Optional> tags) { - this.tags = tags; - return this; - } - - public Builder tags(List tags) { - this.tags = Optional.ofNullable(tags); - return this; - } - - @JsonSetter(value = "use_cases", nulls = Nulls.SKIP) - public Builder useCases(Optional> useCases) { - this.useCases = useCases; - return this; - } - - public Builder useCases(List useCases) { - this.useCases = Optional.ofNullable(useCases); - return this; - } - - public GetModelV1ResponseMetadataMetadata build() { - return new GetModelV1ResponseMetadataMetadata( - accent, age, color, image, sample, tags, useCases, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/GetProjectBalanceV1Response.java b/src/main/java/types/GetProjectBalanceV1Response.java deleted file mode 100644 index e886ec2..0000000 --- a/src/main/java/types/GetProjectBalanceV1Response.java +++ /dev/null @@ -1,194 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = GetProjectBalanceV1Response.Builder.class) -public final class GetProjectBalanceV1Response { - private final Optional balanceId; - - private final Optional amount; - - private final Optional units; - - private final Optional purchaseOrderId; - - private final Map additionalProperties; - - private GetProjectBalanceV1Response( - Optional balanceId, - Optional amount, - Optional units, - Optional purchaseOrderId, - Map additionalProperties) { - this.balanceId = balanceId; - this.amount = amount; - this.units = units; - this.purchaseOrderId = purchaseOrderId; - this.additionalProperties = additionalProperties; - } - - /** - * @return The unique identifier of the balance - */ - @JsonProperty("balance_id") - public Optional getBalanceId() { - return balanceId; - } - - /** - * @return The amount of the balance - */ - @JsonProperty("amount") - public Optional getAmount() { - return amount; - } - - /** - * @return The units of the balance, such as "USD" - */ - @JsonProperty("units") - public Optional getUnits() { - return units; - } - - /** - * @return Description or reference of the purchase - */ - @JsonProperty("purchase_order_id") - public Optional getPurchaseOrderId() { - return purchaseOrderId; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof GetProjectBalanceV1Response - && equalTo((GetProjectBalanceV1Response) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(GetProjectBalanceV1Response other) { - return balanceId.equals(other.balanceId) - && amount.equals(other.amount) - && units.equals(other.units) - && purchaseOrderId.equals(other.purchaseOrderId); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.balanceId, this.amount, this.units, this.purchaseOrderId); - } - - @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 balanceId = Optional.empty(); - - private Optional amount = Optional.empty(); - - private Optional units = Optional.empty(); - - private Optional purchaseOrderId = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(GetProjectBalanceV1Response other) { - balanceId(other.getBalanceId()); - amount(other.getAmount()); - units(other.getUnits()); - purchaseOrderId(other.getPurchaseOrderId()); - return this; - } - - /** The unique identifier of the balance */ - @JsonSetter(value = "balance_id", nulls = Nulls.SKIP) - public Builder balanceId(Optional balanceId) { - this.balanceId = balanceId; - return this; - } - - public Builder balanceId(String balanceId) { - this.balanceId = Optional.ofNullable(balanceId); - return this; - } - - /** The amount of the balance */ - @JsonSetter(value = "amount", nulls = Nulls.SKIP) - public Builder amount(Optional amount) { - this.amount = amount; - return this; - } - - public Builder amount(Double amount) { - this.amount = Optional.ofNullable(amount); - return this; - } - - /** The units of the balance, such as "USD" */ - @JsonSetter(value = "units", nulls = Nulls.SKIP) - public Builder units(Optional units) { - this.units = units; - return this; - } - - public Builder units(String units) { - this.units = Optional.ofNullable(units); - return this; - } - - /** Description or reference of the purchase */ - @JsonSetter(value = "purchase_order_id", nulls = Nulls.SKIP) - public Builder purchaseOrderId(Optional purchaseOrderId) { - this.purchaseOrderId = purchaseOrderId; - return this; - } - - public Builder purchaseOrderId(String purchaseOrderId) { - this.purchaseOrderId = Optional.ofNullable(purchaseOrderId); - return this; - } - - public GetProjectBalanceV1Response build() { - return new GetProjectBalanceV1Response( - balanceId, amount, units, purchaseOrderId, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/GetProjectDistributionCredentialsV1Response.java b/src/main/java/types/GetProjectDistributionCredentialsV1Response.java deleted file mode 100644 index 656cdfe..0000000 --- a/src/main/java/types/GetProjectDistributionCredentialsV1Response.java +++ /dev/null @@ -1,157 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = GetProjectDistributionCredentialsV1Response.Builder.class) -public final class GetProjectDistributionCredentialsV1Response { - private final GetProjectDistributionCredentialsV1ResponseMember member; - - private final GetProjectDistributionCredentialsV1ResponseDistributionCredentials - distributionCredentials; - - private final Map additionalProperties; - - private GetProjectDistributionCredentialsV1Response( - GetProjectDistributionCredentialsV1ResponseMember member, - GetProjectDistributionCredentialsV1ResponseDistributionCredentials distributionCredentials, - Map additionalProperties) { - this.member = member; - this.distributionCredentials = distributionCredentials; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("member") - public GetProjectDistributionCredentialsV1ResponseMember getMember() { - return member; - } - - @JsonProperty("distribution_credentials") - public GetProjectDistributionCredentialsV1ResponseDistributionCredentials - getDistributionCredentials() { - return distributionCredentials; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof GetProjectDistributionCredentialsV1Response - && equalTo((GetProjectDistributionCredentialsV1Response) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(GetProjectDistributionCredentialsV1Response other) { - return member.equals(other.member) - && distributionCredentials.equals(other.distributionCredentials); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.member, this.distributionCredentials); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static MemberStage builder() { - return new Builder(); - } - - public interface MemberStage { - DistributionCredentialsStage member( - @NotNull GetProjectDistributionCredentialsV1ResponseMember member); - - Builder from(GetProjectDistributionCredentialsV1Response other); - } - - public interface DistributionCredentialsStage { - _FinalStage distributionCredentials( - @NotNull - GetProjectDistributionCredentialsV1ResponseDistributionCredentials - distributionCredentials); - } - - public interface _FinalStage { - GetProjectDistributionCredentialsV1Response build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements MemberStage, DistributionCredentialsStage, _FinalStage { - private GetProjectDistributionCredentialsV1ResponseMember member; - - private GetProjectDistributionCredentialsV1ResponseDistributionCredentials - distributionCredentials; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(GetProjectDistributionCredentialsV1Response other) { - member(other.getMember()); - distributionCredentials(other.getDistributionCredentials()); - return this; - } - - @java.lang.Override - @JsonSetter("member") - public DistributionCredentialsStage member( - @NotNull GetProjectDistributionCredentialsV1ResponseMember member) { - this.member = Objects.requireNonNull(member, "member must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("distribution_credentials") - public _FinalStage distributionCredentials( - @NotNull - GetProjectDistributionCredentialsV1ResponseDistributionCredentials - distributionCredentials) { - this.distributionCredentials = - Objects.requireNonNull( - distributionCredentials, "distributionCredentials must not be null"); - return this; - } - - @java.lang.Override - public GetProjectDistributionCredentialsV1Response build() { - return new GetProjectDistributionCredentialsV1Response( - member, distributionCredentials, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/GetProjectDistributionCredentialsV1ResponseDistributionCredentials.java b/src/main/java/types/GetProjectDistributionCredentialsV1ResponseDistributionCredentials.java deleted file mode 100644 index 79e9cb4..0000000 --- a/src/main/java/types/GetProjectDistributionCredentialsV1ResponseDistributionCredentials.java +++ /dev/null @@ -1,309 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = GetProjectDistributionCredentialsV1ResponseDistributionCredentials.Builder.class) -public final class GetProjectDistributionCredentialsV1ResponseDistributionCredentials { - private final String distributionCredentialsId; - - private final String provider; - - private final Optional comment; - - private final List scopes; - - private final OffsetDateTime created; - - private final Map additionalProperties; - - private GetProjectDistributionCredentialsV1ResponseDistributionCredentials( - String distributionCredentialsId, - String provider, - Optional comment, - List scopes, - OffsetDateTime created, - Map additionalProperties) { - this.distributionCredentialsId = distributionCredentialsId; - this.provider = provider; - this.comment = comment; - this.scopes = scopes; - this.created = created; - this.additionalProperties = additionalProperties; - } - - /** - * @return Unique identifier for the distribution credentials - */ - @JsonProperty("distribution_credentials_id") - public String getDistributionCredentialsId() { - return distributionCredentialsId; - } - - /** - * @return The provider of the distribution service - */ - @JsonProperty("provider") - public String getProvider() { - return provider; - } - - /** - * @return Optional comment about the credentials - */ - @JsonProperty("comment") - public Optional getComment() { - return comment; - } - - /** - * @return List of permission scopes for the credentials - */ - @JsonProperty("scopes") - public List getScopes() { - return scopes; - } - - /** - * @return Timestamp when the credentials were created - */ - @JsonProperty("created") - public OffsetDateTime getCreated() { - return created; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof GetProjectDistributionCredentialsV1ResponseDistributionCredentials - && equalTo((GetProjectDistributionCredentialsV1ResponseDistributionCredentials) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo( - GetProjectDistributionCredentialsV1ResponseDistributionCredentials other) { - return distributionCredentialsId.equals(other.distributionCredentialsId) - && provider.equals(other.provider) - && comment.equals(other.comment) - && scopes.equals(other.scopes) - && created.equals(other.created); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.distributionCredentialsId, this.provider, this.comment, this.scopes, this.created); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static DistributionCredentialsIdStage builder() { - return new Builder(); - } - - public interface DistributionCredentialsIdStage { - /** Unique identifier for the distribution credentials */ - ProviderStage distributionCredentialsId(@NotNull String distributionCredentialsId); - - Builder from(GetProjectDistributionCredentialsV1ResponseDistributionCredentials other); - } - - public interface ProviderStage { - /** The provider of the distribution service */ - CreatedStage provider(@NotNull String provider); - } - - public interface CreatedStage { - /** Timestamp when the credentials were created */ - _FinalStage created(@NotNull OffsetDateTime created); - } - - public interface _FinalStage { - GetProjectDistributionCredentialsV1ResponseDistributionCredentials build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** Optional comment about the credentials */ - _FinalStage comment(Optional comment); - - _FinalStage comment(String comment); - - /** List of permission scopes for the credentials */ - _FinalStage scopes(List scopes); - - _FinalStage addScopes(String scopes); - - _FinalStage addAllScopes(List scopes); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements DistributionCredentialsIdStage, ProviderStage, CreatedStage, _FinalStage { - private String distributionCredentialsId; - - private String provider; - - private OffsetDateTime created; - - private List scopes = new ArrayList<>(); - - private Optional comment = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(GetProjectDistributionCredentialsV1ResponseDistributionCredentials other) { - distributionCredentialsId(other.getDistributionCredentialsId()); - provider(other.getProvider()); - comment(other.getComment()); - scopes(other.getScopes()); - created(other.getCreated()); - return this; - } - - /** - * Unique identifier for the distribution credentials - * - *

Unique identifier for the distribution credentials - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("distribution_credentials_id") - public ProviderStage distributionCredentialsId(@NotNull String distributionCredentialsId) { - this.distributionCredentialsId = - Objects.requireNonNull( - distributionCredentialsId, "distributionCredentialsId must not be null"); - return this; - } - - /** - * The provider of the distribution service - * - *

The provider of the distribution service - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("provider") - public CreatedStage provider(@NotNull String provider) { - this.provider = Objects.requireNonNull(provider, "provider must not be null"); - return this; - } - - /** - * Timestamp when the credentials were created - * - *

Timestamp when the credentials were created - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("created") - public _FinalStage created(@NotNull OffsetDateTime created) { - this.created = Objects.requireNonNull(created, "created must not be null"); - return this; - } - - /** - * List of permission scopes for the credentials - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage addAllScopes(List scopes) { - if (scopes != null) { - this.scopes.addAll(scopes); - } - return this; - } - - /** - * List of permission scopes for the credentials - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage addScopes(String scopes) { - this.scopes.add(scopes); - return this; - } - - /** List of permission scopes for the credentials */ - @java.lang.Override - @JsonSetter(value = "scopes", nulls = Nulls.SKIP) - public _FinalStage scopes(List scopes) { - this.scopes.clear(); - if (scopes != null) { - this.scopes.addAll(scopes); - } - return this; - } - - /** - * Optional comment about the credentials - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage comment(String comment) { - this.comment = Optional.ofNullable(comment); - return this; - } - - /** Optional comment about the credentials */ - @java.lang.Override - @JsonSetter(value = "comment", nulls = Nulls.SKIP) - public _FinalStage comment(Optional comment) { - this.comment = comment; - return this; - } - - @java.lang.Override - public GetProjectDistributionCredentialsV1ResponseDistributionCredentials build() { - return new GetProjectDistributionCredentialsV1ResponseDistributionCredentials( - distributionCredentialsId, provider, comment, scopes, created, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/GetProjectDistributionCredentialsV1ResponseMember.java b/src/main/java/types/GetProjectDistributionCredentialsV1ResponseMember.java deleted file mode 100644 index bd96af0..0000000 --- a/src/main/java/types/GetProjectDistributionCredentialsV1ResponseMember.java +++ /dev/null @@ -1,162 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = GetProjectDistributionCredentialsV1ResponseMember.Builder.class) -public final class GetProjectDistributionCredentialsV1ResponseMember { - private final String memberId; - - private final String email; - - private final Map additionalProperties; - - private GetProjectDistributionCredentialsV1ResponseMember( - String memberId, String email, Map additionalProperties) { - this.memberId = memberId; - this.email = email; - this.additionalProperties = additionalProperties; - } - - /** - * @return Unique identifier for the member - */ - @JsonProperty("member_id") - public String getMemberId() { - return memberId; - } - - /** - * @return Email address of the member - */ - @JsonProperty("email") - public String getEmail() { - return email; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof GetProjectDistributionCredentialsV1ResponseMember - && equalTo((GetProjectDistributionCredentialsV1ResponseMember) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(GetProjectDistributionCredentialsV1ResponseMember other) { - return memberId.equals(other.memberId) && email.equals(other.email); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.memberId, this.email); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static MemberIdStage builder() { - return new Builder(); - } - - public interface MemberIdStage { - /** Unique identifier for the member */ - EmailStage memberId(@NotNull String memberId); - - Builder from(GetProjectDistributionCredentialsV1ResponseMember other); - } - - public interface EmailStage { - /** Email address of the member */ - _FinalStage email(@NotNull String email); - } - - public interface _FinalStage { - GetProjectDistributionCredentialsV1ResponseMember build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements MemberIdStage, EmailStage, _FinalStage { - private String memberId; - - private String email; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(GetProjectDistributionCredentialsV1ResponseMember other) { - memberId(other.getMemberId()); - email(other.getEmail()); - return this; - } - - /** - * Unique identifier for the member - * - *

Unique identifier for the member - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("member_id") - public EmailStage memberId(@NotNull String memberId) { - this.memberId = Objects.requireNonNull(memberId, "memberId must not be null"); - return this; - } - - /** - * Email address of the member - * - *

Email address of the member - * - * @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; - } - - @java.lang.Override - public GetProjectDistributionCredentialsV1ResponseMember build() { - return new GetProjectDistributionCredentialsV1ResponseMember( - memberId, email, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/GetProjectKeyV1Response.java b/src/main/java/types/GetProjectKeyV1Response.java deleted file mode 100644 index a96fc53..0000000 --- a/src/main/java/types/GetProjectKeyV1Response.java +++ /dev/null @@ -1,103 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = GetProjectKeyV1Response.Builder.class) -public final class GetProjectKeyV1Response { - private final Optional item; - - private final Map additionalProperties; - - private GetProjectKeyV1Response( - Optional item, Map additionalProperties) { - this.item = item; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("item") - public Optional getItem() { - return item; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof GetProjectKeyV1Response && equalTo((GetProjectKeyV1Response) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(GetProjectKeyV1Response other) { - return item.equals(other.item); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.item); - } - - @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 item = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(GetProjectKeyV1Response other) { - item(other.getItem()); - return this; - } - - @JsonSetter(value = "item", nulls = Nulls.SKIP) - public Builder item(Optional item) { - this.item = item; - return this; - } - - public Builder item(GetProjectKeyV1ResponseItem item) { - this.item = Optional.ofNullable(item); - return this; - } - - public GetProjectKeyV1Response build() { - return new GetProjectKeyV1Response(item, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/GetProjectKeyV1ResponseItem.java b/src/main/java/types/GetProjectKeyV1ResponseItem.java deleted file mode 100644 index ac59dfa..0000000 --- a/src/main/java/types/GetProjectKeyV1ResponseItem.java +++ /dev/null @@ -1,105 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = GetProjectKeyV1ResponseItem.Builder.class) -public final class GetProjectKeyV1ResponseItem { - private final Optional member; - - private final Map additionalProperties; - - private GetProjectKeyV1ResponseItem( - Optional member, - Map additionalProperties) { - this.member = member; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("member") - public Optional getMember() { - return member; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof GetProjectKeyV1ResponseItem - && equalTo((GetProjectKeyV1ResponseItem) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(GetProjectKeyV1ResponseItem other) { - return member.equals(other.member); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.member); - } - - @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 member = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(GetProjectKeyV1ResponseItem other) { - member(other.getMember()); - return this; - } - - @JsonSetter(value = "member", nulls = Nulls.SKIP) - public Builder member(Optional member) { - this.member = member; - return this; - } - - public Builder member(GetProjectKeyV1ResponseItemMember member) { - this.member = Optional.ofNullable(member); - return this; - } - - public GetProjectKeyV1ResponseItem build() { - return new GetProjectKeyV1ResponseItem(member, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/GetProjectKeyV1ResponseItemMember.java b/src/main/java/types/GetProjectKeyV1ResponseItemMember.java deleted file mode 100644 index 8dfe40e..0000000 --- a/src/main/java/types/GetProjectKeyV1ResponseItemMember.java +++ /dev/null @@ -1,202 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = GetProjectKeyV1ResponseItemMember.Builder.class) -public final class GetProjectKeyV1ResponseItemMember { - private final Optional memberId; - - private final Optional email; - - private final Optional firstName; - - private final Optional lastName; - - private final Optional apiKey; - - private final Map additionalProperties; - - private GetProjectKeyV1ResponseItemMember( - Optional memberId, - Optional email, - Optional firstName, - Optional lastName, - Optional apiKey, - Map additionalProperties) { - this.memberId = memberId; - this.email = email; - this.firstName = firstName; - this.lastName = lastName; - this.apiKey = apiKey; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("member_id") - public Optional getMemberId() { - return memberId; - } - - @JsonProperty("email") - public Optional getEmail() { - return email; - } - - @JsonProperty("first_name") - public Optional getFirstName() { - return firstName; - } - - @JsonProperty("last_name") - public Optional getLastName() { - return lastName; - } - - @JsonProperty("api_key") - public Optional getApiKey() { - return apiKey; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof GetProjectKeyV1ResponseItemMember - && equalTo((GetProjectKeyV1ResponseItemMember) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(GetProjectKeyV1ResponseItemMember other) { - return memberId.equals(other.memberId) - && email.equals(other.email) - && firstName.equals(other.firstName) - && lastName.equals(other.lastName) - && apiKey.equals(other.apiKey); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.memberId, this.email, this.firstName, this.lastName, this.apiKey); - } - - @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 memberId = Optional.empty(); - - private Optional email = Optional.empty(); - - private Optional firstName = Optional.empty(); - - private Optional lastName = Optional.empty(); - - private Optional apiKey = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(GetProjectKeyV1ResponseItemMember other) { - memberId(other.getMemberId()); - email(other.getEmail()); - firstName(other.getFirstName()); - lastName(other.getLastName()); - apiKey(other.getApiKey()); - return this; - } - - @JsonSetter(value = "member_id", nulls = Nulls.SKIP) - public Builder memberId(Optional memberId) { - this.memberId = memberId; - return this; - } - - public Builder memberId(String memberId) { - this.memberId = Optional.ofNullable(memberId); - return this; - } - - @JsonSetter(value = "email", nulls = Nulls.SKIP) - public Builder email(Optional email) { - this.email = email; - return this; - } - - public Builder email(String email) { - this.email = Optional.ofNullable(email); - return this; - } - - @JsonSetter(value = "first_name", nulls = Nulls.SKIP) - public Builder firstName(Optional firstName) { - this.firstName = firstName; - return this; - } - - public Builder firstName(String firstName) { - this.firstName = Optional.ofNullable(firstName); - return this; - } - - @JsonSetter(value = "last_name", nulls = Nulls.SKIP) - public Builder lastName(Optional lastName) { - this.lastName = lastName; - return this; - } - - public Builder lastName(String lastName) { - this.lastName = Optional.ofNullable(lastName); - return this; - } - - @JsonSetter(value = "api_key", nulls = Nulls.SKIP) - public Builder apiKey(Optional apiKey) { - this.apiKey = apiKey; - return this; - } - - public Builder apiKey(GetProjectKeyV1ResponseItemMemberApiKey apiKey) { - this.apiKey = Optional.ofNullable(apiKey); - return this; - } - - public GetProjectKeyV1ResponseItemMember build() { - return new GetProjectKeyV1ResponseItemMember( - memberId, email, firstName, lastName, apiKey, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/GetProjectKeyV1ResponseItemMemberApiKey.java b/src/main/java/types/GetProjectKeyV1ResponseItemMemberApiKey.java deleted file mode 100644 index a435016..0000000 --- a/src/main/java/types/GetProjectKeyV1ResponseItemMemberApiKey.java +++ /dev/null @@ -1,229 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = GetProjectKeyV1ResponseItemMemberApiKey.Builder.class) -public final class GetProjectKeyV1ResponseItemMemberApiKey { - private final Optional apiKeyId; - - private final Optional comment; - - private final Optional> scopes; - - private final Optional> tags; - - private final Optional expirationDate; - - private final Optional created; - - private final Map additionalProperties; - - private GetProjectKeyV1ResponseItemMemberApiKey( - Optional apiKeyId, - Optional comment, - Optional> scopes, - Optional> tags, - Optional expirationDate, - Optional created, - Map additionalProperties) { - this.apiKeyId = apiKeyId; - this.comment = comment; - this.scopes = scopes; - this.tags = tags; - this.expirationDate = expirationDate; - this.created = created; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("api_key_id") - public Optional getApiKeyId() { - return apiKeyId; - } - - @JsonProperty("comment") - public Optional getComment() { - return comment; - } - - @JsonProperty("scopes") - public Optional> getScopes() { - return scopes; - } - - @JsonProperty("tags") - public Optional> getTags() { - return tags; - } - - @JsonProperty("expiration_date") - public Optional getExpirationDate() { - return expirationDate; - } - - @JsonProperty("created") - public Optional getCreated() { - return created; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof GetProjectKeyV1ResponseItemMemberApiKey - && equalTo((GetProjectKeyV1ResponseItemMemberApiKey) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(GetProjectKeyV1ResponseItemMemberApiKey other) { - return apiKeyId.equals(other.apiKeyId) - && comment.equals(other.comment) - && scopes.equals(other.scopes) - && tags.equals(other.tags) - && expirationDate.equals(other.expirationDate) - && created.equals(other.created); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.apiKeyId, this.comment, this.scopes, this.tags, this.expirationDate, this.created); - } - - @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 apiKeyId = Optional.empty(); - - private Optional comment = Optional.empty(); - - private Optional> scopes = Optional.empty(); - - private Optional> tags = Optional.empty(); - - private Optional expirationDate = Optional.empty(); - - private Optional created = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(GetProjectKeyV1ResponseItemMemberApiKey other) { - apiKeyId(other.getApiKeyId()); - comment(other.getComment()); - scopes(other.getScopes()); - tags(other.getTags()); - expirationDate(other.getExpirationDate()); - created(other.getCreated()); - return this; - } - - @JsonSetter(value = "api_key_id", nulls = Nulls.SKIP) - public Builder apiKeyId(Optional apiKeyId) { - this.apiKeyId = apiKeyId; - return this; - } - - public Builder apiKeyId(String apiKeyId) { - this.apiKeyId = Optional.ofNullable(apiKeyId); - return this; - } - - @JsonSetter(value = "comment", nulls = Nulls.SKIP) - public Builder comment(Optional comment) { - this.comment = comment; - return this; - } - - public Builder comment(String comment) { - this.comment = Optional.ofNullable(comment); - return this; - } - - @JsonSetter(value = "scopes", nulls = Nulls.SKIP) - public Builder scopes(Optional> scopes) { - this.scopes = scopes; - return this; - } - - public Builder scopes(List scopes) { - this.scopes = Optional.ofNullable(scopes); - return this; - } - - @JsonSetter(value = "tags", nulls = Nulls.SKIP) - public Builder tags(Optional> tags) { - this.tags = tags; - return this; - } - - public Builder tags(List tags) { - this.tags = Optional.ofNullable(tags); - return this; - } - - @JsonSetter(value = "expiration_date", nulls = Nulls.SKIP) - public Builder expirationDate(Optional expirationDate) { - this.expirationDate = expirationDate; - return this; - } - - public Builder expirationDate(OffsetDateTime expirationDate) { - this.expirationDate = Optional.ofNullable(expirationDate); - return this; - } - - @JsonSetter(value = "created", nulls = Nulls.SKIP) - public Builder created(Optional created) { - this.created = created; - return this; - } - - public Builder created(OffsetDateTime created) { - this.created = Optional.ofNullable(created); - return this; - } - - public GetProjectKeyV1ResponseItemMemberApiKey build() { - return new GetProjectKeyV1ResponseItemMemberApiKey( - apiKeyId, comment, scopes, tags, expirationDate, created, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/GetProjectRequestV1Response.java b/src/main/java/types/GetProjectRequestV1Response.java deleted file mode 100644 index e82b606..0000000 --- a/src/main/java/types/GetProjectRequestV1Response.java +++ /dev/null @@ -1,104 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = GetProjectRequestV1Response.Builder.class) -public final class GetProjectRequestV1Response { - private final Optional request; - - private final Map additionalProperties; - - private GetProjectRequestV1Response( - Optional request, Map additionalProperties) { - this.request = request; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("request") - public Optional getRequest() { - return request; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof GetProjectRequestV1Response - && equalTo((GetProjectRequestV1Response) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(GetProjectRequestV1Response other) { - return request.equals(other.request); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.request); - } - - @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 request = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(GetProjectRequestV1Response other) { - request(other.getRequest()); - return this; - } - - @JsonSetter(value = "request", nulls = Nulls.SKIP) - public Builder request(Optional request) { - this.request = request; - return this; - } - - public Builder request(ProjectRequestResponse request) { - this.request = Optional.ofNullable(request); - return this; - } - - public GetProjectRequestV1Response build() { - return new GetProjectRequestV1Response(request, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/GetProjectV1Response.java b/src/main/java/types/GetProjectV1Response.java deleted file mode 100644 index 2be60e1..0000000 --- a/src/main/java/types/GetProjectV1Response.java +++ /dev/null @@ -1,164 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = GetProjectV1Response.Builder.class) -public final class GetProjectV1Response { - private final Optional projectId; - - private final Optional mipOptOut; - - private final Optional name; - - private final Map additionalProperties; - - private GetProjectV1Response( - Optional projectId, - Optional mipOptOut, - Optional name, - Map additionalProperties) { - this.projectId = projectId; - this.mipOptOut = mipOptOut; - this.name = name; - this.additionalProperties = additionalProperties; - } - - /** - * @return The unique identifier of the project - */ - @JsonProperty("project_id") - public Optional getProjectId() { - return projectId; - } - - /** - * @return Model Improvement Program opt-out - */ - @JsonProperty("mip_opt_out") - public Optional getMipOptOut() { - return mipOptOut; - } - - /** - * @return The name of the project - */ - @JsonProperty("name") - public Optional getName() { - return name; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof GetProjectV1Response && equalTo((GetProjectV1Response) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(GetProjectV1Response other) { - return projectId.equals(other.projectId) - && mipOptOut.equals(other.mipOptOut) - && name.equals(other.name); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.projectId, this.mipOptOut, 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 projectId = Optional.empty(); - - private Optional mipOptOut = Optional.empty(); - - private Optional name = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(GetProjectV1Response other) { - projectId(other.getProjectId()); - mipOptOut(other.getMipOptOut()); - name(other.getName()); - return this; - } - - /** The unique identifier of the project */ - @JsonSetter(value = "project_id", nulls = Nulls.SKIP) - public Builder projectId(Optional projectId) { - this.projectId = projectId; - return this; - } - - public Builder projectId(String projectId) { - this.projectId = Optional.ofNullable(projectId); - return this; - } - - /** Model Improvement Program opt-out */ - @JsonSetter(value = "mip_opt_out", nulls = Nulls.SKIP) - public Builder mipOptOut(Optional mipOptOut) { - this.mipOptOut = mipOptOut; - return this; - } - - public Builder mipOptOut(Boolean mipOptOut) { - this.mipOptOut = Optional.ofNullable(mipOptOut); - return this; - } - - /** The name of the project */ - @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 GetProjectV1Response build() { - return new GetProjectV1Response(projectId, mipOptOut, name, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/Google.java b/src/main/java/types/Google.java deleted file mode 100644 index 414f645..0000000 --- a/src/main/java/types/Google.java +++ /dev/null @@ -1,215 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = Google.Builder.class) -public final class Google { - private final Optional version; - - private final GoogleThinkProviderModel model; - - private final Optional temperature; - - private final Map additionalProperties; - - private Google( - Optional version, - GoogleThinkProviderModel model, - Optional temperature, - Map additionalProperties) { - this.version = version; - this.model = model; - this.temperature = temperature; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("type") - public String getType() { - return "google"; - } - - /** - * @return The REST API version for the Google generative language API - */ - @JsonProperty("version") - public Optional getVersion() { - return version; - } - - /** - * @return Google model to use - */ - @JsonProperty("model") - public GoogleThinkProviderModel getModel() { - return model; - } - - /** - * @return Google temperature (0-2) - */ - @JsonProperty("temperature") - public Optional getTemperature() { - return temperature; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof Google && equalTo((Google) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(Google other) { - return version.equals(other.version) - && model.equals(other.model) - && temperature.equals(other.temperature); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.version, this.model, this.temperature); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static ModelStage builder() { - return new Builder(); - } - - public interface ModelStage { - /** Google model to use */ - _FinalStage model(@NotNull GoogleThinkProviderModel model); - - Builder from(Google other); - } - - public interface _FinalStage { - Google build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** The REST API version for the Google generative language API */ - _FinalStage version(Optional version); - - _FinalStage version(String version); - - /** Google temperature (0-2) */ - _FinalStage temperature(Optional temperature); - - _FinalStage temperature(Double temperature); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements ModelStage, _FinalStage { - private GoogleThinkProviderModel model; - - private Optional temperature = Optional.empty(); - - private Optional version = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(Google other) { - version(other.getVersion()); - model(other.getModel()); - temperature(other.getTemperature()); - return this; - } - - /** - * Google model to use - * - *

Google model to use - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("model") - public _FinalStage model(@NotNull GoogleThinkProviderModel model) { - this.model = Objects.requireNonNull(model, "model must not be null"); - return this; - } - - /** - * Google temperature (0-2) - * - * @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; - } - - /** Google temperature (0-2) */ - @java.lang.Override - @JsonSetter(value = "temperature", nulls = Nulls.SKIP) - public _FinalStage temperature(Optional temperature) { - this.temperature = temperature; - return this; - } - - /** - * The REST API version for the Google generative language API - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage version(String version) { - this.version = Optional.ofNullable(version); - return this; - } - - /** The REST API version for the Google generative language API */ - @java.lang.Override - @JsonSetter(value = "version", nulls = Nulls.SKIP) - public _FinalStage version(Optional version) { - this.version = version; - return this; - } - - @java.lang.Override - public Google build() { - return new Google(version, model, temperature, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/GoogleThinkProviderModel.java b/src/main/java/types/GoogleThinkProviderModel.java deleted file mode 100644 index d26f12c..0000000 --- a/src/main/java/types/GoogleThinkProviderModel.java +++ /dev/null @@ -1,95 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class GoogleThinkProviderModel { - public static final GoogleThinkProviderModel GEMINI20FLASH_LITE = - new GoogleThinkProviderModel(Value.GEMINI20FLASH_LITE, "gemini-2.0-flash-lite"); - - public static final GoogleThinkProviderModel GEMINI25FLASH = - new GoogleThinkProviderModel(Value.GEMINI25FLASH, "gemini-2.5-flash"); - - public static final GoogleThinkProviderModel GEMINI20FLASH = - new GoogleThinkProviderModel(Value.GEMINI20FLASH, "gemini-2.0-flash"); - - private final Value value; - - private final String string; - - GoogleThinkProviderModel(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof GoogleThinkProviderModel - && this.string.equals(((GoogleThinkProviderModel) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case GEMINI20FLASH_LITE: - return visitor.visitGemini20FlashLite(); - case GEMINI25FLASH: - return visitor.visitGemini25Flash(); - case GEMINI20FLASH: - return visitor.visitGemini20Flash(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static GoogleThinkProviderModel valueOf(String value) { - switch (value) { - case "gemini-2.0-flash-lite": - return GEMINI20FLASH_LITE; - case "gemini-2.5-flash": - return GEMINI25FLASH; - case "gemini-2.0-flash": - return GEMINI20FLASH; - default: - return new GoogleThinkProviderModel(Value.UNKNOWN, value); - } - } - - public enum Value { - GEMINI20FLASH, - - GEMINI20FLASH_LITE, - - GEMINI25FLASH, - - UNKNOWN - } - - public interface Visitor { - T visitGemini20Flash(); - - T visitGemini20FlashLite(); - - T visitGemini25Flash(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/types/GrantV1Response.java b/src/main/java/types/GrantV1Response.java deleted file mode 100644 index cb750a1..0000000 --- a/src/main/java/types/GrantV1Response.java +++ /dev/null @@ -1,167 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = GrantV1Response.Builder.class) -public final class GrantV1Response { - private final String accessToken; - - private final Optional expiresIn; - - private final Map additionalProperties; - - private GrantV1Response( - String accessToken, Optional expiresIn, Map additionalProperties) { - this.accessToken = accessToken; - this.expiresIn = expiresIn; - this.additionalProperties = additionalProperties; - } - - /** - * @return JSON Web Token (JWT) - */ - @JsonProperty("access_token") - public String getAccessToken() { - return accessToken; - } - - /** - * @return Time in seconds until the JWT expires - */ - @JsonProperty("expires_in") - public Optional getExpiresIn() { - return expiresIn; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof GrantV1Response && equalTo((GrantV1Response) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(GrantV1Response other) { - return accessToken.equals(other.accessToken) && expiresIn.equals(other.expiresIn); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.accessToken, this.expiresIn); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static AccessTokenStage builder() { - return new Builder(); - } - - public interface AccessTokenStage { - /** JSON Web Token (JWT) */ - _FinalStage accessToken(@NotNull String accessToken); - - Builder from(GrantV1Response other); - } - - public interface _FinalStage { - GrantV1Response build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** Time in seconds until the JWT expires */ - _FinalStage expiresIn(Optional expiresIn); - - _FinalStage expiresIn(Double expiresIn); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements AccessTokenStage, _FinalStage { - private String accessToken; - - private Optional expiresIn = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(GrantV1Response other) { - accessToken(other.getAccessToken()); - expiresIn(other.getExpiresIn()); - return this; - } - - /** - * JSON Web Token (JWT) - * - *

JSON Web Token (JWT) - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("access_token") - public _FinalStage accessToken(@NotNull String accessToken) { - this.accessToken = Objects.requireNonNull(accessToken, "accessToken must not be null"); - return this; - } - - /** - * Time in seconds until the JWT expires - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage expiresIn(Double expiresIn) { - this.expiresIn = Optional.ofNullable(expiresIn); - return this; - } - - /** Time in seconds until the JWT expires */ - @java.lang.Override - @JsonSetter(value = "expires_in", nulls = Nulls.SKIP) - public _FinalStage expiresIn(Optional expiresIn) { - this.expiresIn = expiresIn; - return this; - } - - @java.lang.Override - public GrantV1Response build() { - return new GrantV1Response(accessToken, expiresIn, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/Groq.java b/src/main/java/types/Groq.java deleted file mode 100644 index 4f50204..0000000 --- a/src/main/java/types/Groq.java +++ /dev/null @@ -1,148 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = Groq.Builder.class) -public final class Groq { - private final Optional version; - - private final Optional temperature; - - private final Map additionalProperties; - - private Groq( - Optional version, - Optional temperature, - Map additionalProperties) { - this.version = version; - this.temperature = temperature; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("type") - public String getType() { - return "groq"; - } - - /** - * @return The REST API version for the Groq's chat completions API (mostly OpenAI-compatible) - */ - @JsonProperty("version") - public Optional getVersion() { - return version; - } - - /** - * @return Groq model to use - */ - @JsonProperty("model") - public String getModel() { - return "openai/gpt-oss-20b"; - } - - /** - * @return Groq temperature (0-2) - */ - @JsonProperty("temperature") - public Optional getTemperature() { - return temperature; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof Groq && equalTo((Groq) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(Groq other) { - return version.equals(other.version) && temperature.equals(other.temperature); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.version, this.temperature); - } - - @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 version = Optional.empty(); - - private Optional temperature = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(Groq other) { - version(other.getVersion()); - temperature(other.getTemperature()); - return this; - } - - /** The REST API version for the Groq's chat completions API (mostly OpenAI-compatible) */ - @JsonSetter(value = "version", nulls = Nulls.SKIP) - public Builder version(Optional version) { - this.version = version; - return this; - } - - public Builder version(String version) { - this.version = Optional.ofNullable(version); - return this; - } - - /** Groq temperature (0-2) */ - @JsonSetter(value = "temperature", nulls = Nulls.SKIP) - public Builder temperature(Optional temperature) { - this.temperature = temperature; - return this; - } - - public Builder temperature(Double temperature) { - this.temperature = Optional.ofNullable(temperature); - return this; - } - - public Groq build() { - return new Groq(version, temperature, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/LeaveProjectV1Response.java b/src/main/java/types/LeaveProjectV1Response.java deleted file mode 100644 index cc3f5f4..0000000 --- a/src/main/java/types/LeaveProjectV1Response.java +++ /dev/null @@ -1,107 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = LeaveProjectV1Response.Builder.class) -public final class LeaveProjectV1Response { - private final Optional message; - - private final Map additionalProperties; - - private LeaveProjectV1Response( - Optional message, Map additionalProperties) { - this.message = message; - this.additionalProperties = additionalProperties; - } - - /** - * @return confirmation message - */ - @JsonProperty("message") - public Optional getMessage() { - return message; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof LeaveProjectV1Response && equalTo((LeaveProjectV1Response) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(LeaveProjectV1Response 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 Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional message = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(LeaveProjectV1Response other) { - message(other.getMessage()); - return this; - } - - /** confirmation message */ - @JsonSetter(value = "message", nulls = Nulls.SKIP) - public Builder message(Optional message) { - this.message = message; - return this; - } - - public Builder message(String message) { - this.message = Optional.ofNullable(message); - return this; - } - - public LeaveProjectV1Response build() { - return new LeaveProjectV1Response(message, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListBillingFieldsV1Response.java b/src/main/java/types/ListBillingFieldsV1Response.java deleted file mode 100644 index d205175..0000000 --- a/src/main/java/types/ListBillingFieldsV1Response.java +++ /dev/null @@ -1,197 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListBillingFieldsV1Response.Builder.class) -public final class ListBillingFieldsV1Response { - private final Optional> accessors; - - private final Optional> deployments; - - private final Optional> tags; - - private final Optional> lineItems; - - private final Map additionalProperties; - - private ListBillingFieldsV1Response( - Optional> accessors, - Optional> deployments, - Optional> tags, - Optional> lineItems, - Map additionalProperties) { - this.accessors = accessors; - this.deployments = deployments; - this.tags = tags; - this.lineItems = lineItems; - this.additionalProperties = additionalProperties; - } - - /** - * @return List of accessor UUIDs for the time period - */ - @JsonProperty("accessors") - public Optional> getAccessors() { - return accessors; - } - - /** - * @return List of deployment types for the time period - */ - @JsonProperty("deployments") - public Optional> getDeployments() { - return deployments; - } - - /** - * @return List of tags for the time period - */ - @JsonProperty("tags") - public Optional> getTags() { - return tags; - } - - /** - * @return Map of line item names to human-readable descriptions for the time period - */ - @JsonProperty("line_items") - public Optional> getLineItems() { - return lineItems; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListBillingFieldsV1Response - && equalTo((ListBillingFieldsV1Response) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListBillingFieldsV1Response other) { - return accessors.equals(other.accessors) - && deployments.equals(other.deployments) - && tags.equals(other.tags) - && lineItems.equals(other.lineItems); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.accessors, this.deployments, this.tags, this.lineItems); - } - - @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> accessors = Optional.empty(); - - private Optional> deployments = - Optional.empty(); - - private Optional> tags = Optional.empty(); - - private Optional> lineItems = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListBillingFieldsV1Response other) { - accessors(other.getAccessors()); - deployments(other.getDeployments()); - tags(other.getTags()); - lineItems(other.getLineItems()); - return this; - } - - /** List of accessor UUIDs for the time period */ - @JsonSetter(value = "accessors", nulls = Nulls.SKIP) - public Builder accessors(Optional> accessors) { - this.accessors = accessors; - return this; - } - - public Builder accessors(List accessors) { - this.accessors = Optional.ofNullable(accessors); - return this; - } - - /** List of deployment types for the time period */ - @JsonSetter(value = "deployments", nulls = Nulls.SKIP) - public Builder deployments( - Optional> deployments) { - this.deployments = deployments; - return this; - } - - public Builder deployments(List deployments) { - this.deployments = Optional.ofNullable(deployments); - return this; - } - - /** List of tags for the time period */ - @JsonSetter(value = "tags", nulls = Nulls.SKIP) - public Builder tags(Optional> tags) { - this.tags = tags; - return this; - } - - public Builder tags(List tags) { - this.tags = Optional.ofNullable(tags); - return this; - } - - /** Map of line item names to human-readable descriptions for the time period */ - @JsonSetter(value = "line_items", nulls = Nulls.SKIP) - public Builder lineItems(Optional> lineItems) { - this.lineItems = lineItems; - return this; - } - - public Builder lineItems(Map lineItems) { - this.lineItems = Optional.ofNullable(lineItems); - return this; - } - - public ListBillingFieldsV1Response build() { - return new ListBillingFieldsV1Response( - accessors, deployments, tags, lineItems, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListBillingFieldsV1ResponseDeploymentsItem.java b/src/main/java/types/ListBillingFieldsV1ResponseDeploymentsItem.java deleted file mode 100644 index 1abb834..0000000 --- a/src/main/java/types/ListBillingFieldsV1ResponseDeploymentsItem.java +++ /dev/null @@ -1,106 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class ListBillingFieldsV1ResponseDeploymentsItem { - public static final ListBillingFieldsV1ResponseDeploymentsItem SELF_HOSTED = - new ListBillingFieldsV1ResponseDeploymentsItem(Value.SELF_HOSTED, "self-hosted"); - - public static final ListBillingFieldsV1ResponseDeploymentsItem BETA = - new ListBillingFieldsV1ResponseDeploymentsItem(Value.BETA, "beta"); - - public static final ListBillingFieldsV1ResponseDeploymentsItem HOSTED = - new ListBillingFieldsV1ResponseDeploymentsItem(Value.HOSTED, "hosted"); - - public static final ListBillingFieldsV1ResponseDeploymentsItem DEDICATED = - new ListBillingFieldsV1ResponseDeploymentsItem(Value.DEDICATED, "dedicated"); - - private final Value value; - - private final String string; - - ListBillingFieldsV1ResponseDeploymentsItem(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof ListBillingFieldsV1ResponseDeploymentsItem - && this.string.equals(((ListBillingFieldsV1ResponseDeploymentsItem) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case SELF_HOSTED: - return visitor.visitSelfHosted(); - case BETA: - return visitor.visitBeta(); - case HOSTED: - return visitor.visitHosted(); - case DEDICATED: - return visitor.visitDedicated(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListBillingFieldsV1ResponseDeploymentsItem valueOf(String value) { - switch (value) { - case "self-hosted": - return SELF_HOSTED; - case "beta": - return BETA; - case "hosted": - return HOSTED; - case "dedicated": - return DEDICATED; - default: - return new ListBillingFieldsV1ResponseDeploymentsItem(Value.UNKNOWN, value); - } - } - - public enum Value { - HOSTED, - - BETA, - - SELF_HOSTED, - - DEDICATED, - - UNKNOWN - } - - public interface Visitor { - T visitHosted(); - - T visitBeta(); - - T visitSelfHosted(); - - T visitDedicated(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/types/ListModelsV1Response.java b/src/main/java/types/ListModelsV1Response.java deleted file mode 100644 index 8473a01..0000000 --- a/src/main/java/types/ListModelsV1Response.java +++ /dev/null @@ -1,128 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListModelsV1Response.Builder.class) -public final class ListModelsV1Response { - private final Optional> stt; - - private final Optional> tts; - - private final Map additionalProperties; - - private ListModelsV1Response( - Optional> stt, - Optional> tts, - Map additionalProperties) { - this.stt = stt; - this.tts = tts; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("stt") - public Optional> getStt() { - return stt; - } - - @JsonProperty("tts") - public Optional> getTts() { - return tts; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListModelsV1Response && equalTo((ListModelsV1Response) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListModelsV1Response other) { - return stt.equals(other.stt) && tts.equals(other.tts); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.stt, this.tts); - } - - @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> stt = Optional.empty(); - - private Optional> tts = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListModelsV1Response other) { - stt(other.getStt()); - tts(other.getTts()); - return this; - } - - @JsonSetter(value = "stt", nulls = Nulls.SKIP) - public Builder stt(Optional> stt) { - this.stt = stt; - return this; - } - - public Builder stt(List stt) { - this.stt = Optional.ofNullable(stt); - return this; - } - - @JsonSetter(value = "tts", nulls = Nulls.SKIP) - public Builder tts(Optional> tts) { - this.tts = tts; - return this; - } - - public Builder tts(List tts) { - this.tts = Optional.ofNullable(tts); - return this; - } - - public ListModelsV1Response build() { - return new ListModelsV1Response(stt, tts, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListModelsV1ResponseSttModels.java b/src/main/java/types/ListModelsV1ResponseSttModels.java deleted file mode 100644 index ec8e2e2..0000000 --- a/src/main/java/types/ListModelsV1ResponseSttModels.java +++ /dev/null @@ -1,317 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListModelsV1ResponseSttModels.Builder.class) -public final class ListModelsV1ResponseSttModels { - private final Optional name; - - private final Optional canonicalName; - - private final Optional architecture; - - private final Optional> languages; - - private final Optional version; - - private final Optional uuid; - - private final Optional batch; - - private final Optional streaming; - - private final Optional formattedOutput; - - private final Map additionalProperties; - - private ListModelsV1ResponseSttModels( - Optional name, - Optional canonicalName, - Optional architecture, - Optional> languages, - Optional version, - Optional uuid, - Optional batch, - Optional streaming, - Optional formattedOutput, - Map additionalProperties) { - this.name = name; - this.canonicalName = canonicalName; - this.architecture = architecture; - this.languages = languages; - this.version = version; - this.uuid = uuid; - this.batch = batch; - this.streaming = streaming; - this.formattedOutput = formattedOutput; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("name") - public Optional getName() { - return name; - } - - @JsonProperty("canonical_name") - public Optional getCanonicalName() { - return canonicalName; - } - - @JsonProperty("architecture") - public Optional getArchitecture() { - return architecture; - } - - @JsonProperty("languages") - public Optional> getLanguages() { - return languages; - } - - @JsonProperty("version") - public Optional getVersion() { - return version; - } - - @JsonProperty("uuid") - public Optional getUuid() { - return uuid; - } - - @JsonProperty("batch") - public Optional getBatch() { - return batch; - } - - @JsonProperty("streaming") - public Optional getStreaming() { - return streaming; - } - - @JsonProperty("formatted_output") - public Optional getFormattedOutput() { - return formattedOutput; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListModelsV1ResponseSttModels - && equalTo((ListModelsV1ResponseSttModels) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListModelsV1ResponseSttModels other) { - return name.equals(other.name) - && canonicalName.equals(other.canonicalName) - && architecture.equals(other.architecture) - && languages.equals(other.languages) - && version.equals(other.version) - && uuid.equals(other.uuid) - && batch.equals(other.batch) - && streaming.equals(other.streaming) - && formattedOutput.equals(other.formattedOutput); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.name, - this.canonicalName, - this.architecture, - this.languages, - this.version, - this.uuid, - this.batch, - this.streaming, - this.formattedOutput); - } - - @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 canonicalName = Optional.empty(); - - private Optional architecture = Optional.empty(); - - private Optional> languages = Optional.empty(); - - private Optional version = Optional.empty(); - - private Optional uuid = Optional.empty(); - - private Optional batch = Optional.empty(); - - private Optional streaming = Optional.empty(); - - private Optional formattedOutput = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListModelsV1ResponseSttModels other) { - name(other.getName()); - canonicalName(other.getCanonicalName()); - architecture(other.getArchitecture()); - languages(other.getLanguages()); - version(other.getVersion()); - uuid(other.getUuid()); - batch(other.getBatch()); - streaming(other.getStreaming()); - formattedOutput(other.getFormattedOutput()); - 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 = "canonical_name", nulls = Nulls.SKIP) - public Builder canonicalName(Optional canonicalName) { - this.canonicalName = canonicalName; - return this; - } - - public Builder canonicalName(String canonicalName) { - this.canonicalName = Optional.ofNullable(canonicalName); - return this; - } - - @JsonSetter(value = "architecture", nulls = Nulls.SKIP) - public Builder architecture(Optional architecture) { - this.architecture = architecture; - return this; - } - - public Builder architecture(String architecture) { - this.architecture = Optional.ofNullable(architecture); - return this; - } - - @JsonSetter(value = "languages", nulls = Nulls.SKIP) - public Builder languages(Optional> languages) { - this.languages = languages; - return this; - } - - public Builder languages(List languages) { - this.languages = Optional.ofNullable(languages); - return this; - } - - @JsonSetter(value = "version", nulls = Nulls.SKIP) - public Builder version(Optional version) { - this.version = version; - return this; - } - - public Builder version(String version) { - this.version = Optional.ofNullable(version); - return this; - } - - @JsonSetter(value = "uuid", nulls = Nulls.SKIP) - public Builder uuid(Optional uuid) { - this.uuid = uuid; - return this; - } - - public Builder uuid(String uuid) { - this.uuid = Optional.ofNullable(uuid); - return this; - } - - @JsonSetter(value = "batch", nulls = Nulls.SKIP) - public Builder batch(Optional batch) { - this.batch = batch; - return this; - } - - public Builder batch(Boolean batch) { - this.batch = Optional.ofNullable(batch); - return this; - } - - @JsonSetter(value = "streaming", nulls = Nulls.SKIP) - public Builder streaming(Optional streaming) { - this.streaming = streaming; - return this; - } - - public Builder streaming(Boolean streaming) { - this.streaming = Optional.ofNullable(streaming); - return this; - } - - @JsonSetter(value = "formatted_output", nulls = Nulls.SKIP) - public Builder formattedOutput(Optional formattedOutput) { - this.formattedOutput = formattedOutput; - return this; - } - - public Builder formattedOutput(Boolean formattedOutput) { - this.formattedOutput = Optional.ofNullable(formattedOutput); - return this; - } - - public ListModelsV1ResponseSttModels build() { - return new ListModelsV1ResponseSttModels( - name, - canonicalName, - architecture, - languages, - version, - uuid, - batch, - streaming, - formattedOutput, - additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListModelsV1ResponseTtsModels.java b/src/main/java/types/ListModelsV1ResponseTtsModels.java deleted file mode 100644 index a175214..0000000 --- a/src/main/java/types/ListModelsV1ResponseTtsModels.java +++ /dev/null @@ -1,265 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListModelsV1ResponseTtsModels.Builder.class) -public final class ListModelsV1ResponseTtsModels { - private final Optional name; - - private final Optional canonicalName; - - private final Optional architecture; - - private final Optional> languages; - - private final Optional version; - - private final Optional uuid; - - private final Optional metadata; - - private final Map additionalProperties; - - private ListModelsV1ResponseTtsModels( - Optional name, - Optional canonicalName, - Optional architecture, - Optional> languages, - Optional version, - Optional uuid, - Optional metadata, - Map additionalProperties) { - this.name = name; - this.canonicalName = canonicalName; - this.architecture = architecture; - this.languages = languages; - this.version = version; - this.uuid = uuid; - this.metadata = metadata; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("name") - public Optional getName() { - return name; - } - - @JsonProperty("canonical_name") - public Optional getCanonicalName() { - return canonicalName; - } - - @JsonProperty("architecture") - public Optional getArchitecture() { - return architecture; - } - - @JsonProperty("languages") - public Optional> getLanguages() { - return languages; - } - - @JsonProperty("version") - public Optional getVersion() { - return version; - } - - @JsonProperty("uuid") - public Optional getUuid() { - return uuid; - } - - @JsonProperty("metadata") - public Optional getMetadata() { - return metadata; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListModelsV1ResponseTtsModels - && equalTo((ListModelsV1ResponseTtsModels) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListModelsV1ResponseTtsModels other) { - return name.equals(other.name) - && canonicalName.equals(other.canonicalName) - && architecture.equals(other.architecture) - && languages.equals(other.languages) - && version.equals(other.version) - && uuid.equals(other.uuid) - && metadata.equals(other.metadata); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.name, - this.canonicalName, - this.architecture, - this.languages, - this.version, - this.uuid, - this.metadata); - } - - @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 canonicalName = Optional.empty(); - - private Optional architecture = Optional.empty(); - - private Optional> languages = Optional.empty(); - - private Optional version = Optional.empty(); - - private Optional uuid = Optional.empty(); - - private Optional metadata = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListModelsV1ResponseTtsModels other) { - name(other.getName()); - canonicalName(other.getCanonicalName()); - architecture(other.getArchitecture()); - languages(other.getLanguages()); - version(other.getVersion()); - uuid(other.getUuid()); - metadata(other.getMetadata()); - 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 = "canonical_name", nulls = Nulls.SKIP) - public Builder canonicalName(Optional canonicalName) { - this.canonicalName = canonicalName; - return this; - } - - public Builder canonicalName(String canonicalName) { - this.canonicalName = Optional.ofNullable(canonicalName); - return this; - } - - @JsonSetter(value = "architecture", nulls = Nulls.SKIP) - public Builder architecture(Optional architecture) { - this.architecture = architecture; - return this; - } - - public Builder architecture(String architecture) { - this.architecture = Optional.ofNullable(architecture); - return this; - } - - @JsonSetter(value = "languages", nulls = Nulls.SKIP) - public Builder languages(Optional> languages) { - this.languages = languages; - return this; - } - - public Builder languages(List languages) { - this.languages = Optional.ofNullable(languages); - return this; - } - - @JsonSetter(value = "version", nulls = Nulls.SKIP) - public Builder version(Optional version) { - this.version = version; - return this; - } - - public Builder version(String version) { - this.version = Optional.ofNullable(version); - return this; - } - - @JsonSetter(value = "uuid", nulls = Nulls.SKIP) - public Builder uuid(Optional uuid) { - this.uuid = uuid; - return this; - } - - public Builder uuid(String uuid) { - this.uuid = Optional.ofNullable(uuid); - return this; - } - - @JsonSetter(value = "metadata", nulls = Nulls.SKIP) - public Builder metadata(Optional metadata) { - this.metadata = metadata; - return this; - } - - public Builder metadata(ListModelsV1ResponseTtsModelsMetadata metadata) { - this.metadata = Optional.ofNullable(metadata); - return this; - } - - public ListModelsV1ResponseTtsModels build() { - return new ListModelsV1ResponseTtsModels( - name, - canonicalName, - architecture, - languages, - version, - uuid, - metadata, - additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListModelsV1ResponseTtsModelsMetadata.java b/src/main/java/types/ListModelsV1ResponseTtsModelsMetadata.java deleted file mode 100644 index c473d21..0000000 --- a/src/main/java/types/ListModelsV1ResponseTtsModelsMetadata.java +++ /dev/null @@ -1,252 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListModelsV1ResponseTtsModelsMetadata.Builder.class) -public final class ListModelsV1ResponseTtsModelsMetadata { - private final Optional accent; - - private final Optional age; - - private final Optional color; - - private final Optional image; - - private final Optional sample; - - private final Optional> tags; - - private final Optional> useCases; - - private final Map additionalProperties; - - private ListModelsV1ResponseTtsModelsMetadata( - Optional accent, - Optional age, - Optional color, - Optional image, - Optional sample, - Optional> tags, - Optional> useCases, - Map additionalProperties) { - this.accent = accent; - this.age = age; - this.color = color; - this.image = image; - this.sample = sample; - this.tags = tags; - this.useCases = useCases; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("accent") - public Optional getAccent() { - return accent; - } - - @JsonProperty("age") - public Optional getAge() { - return age; - } - - @JsonProperty("color") - public Optional getColor() { - return color; - } - - @JsonProperty("image") - public Optional getImage() { - return image; - } - - @JsonProperty("sample") - public Optional getSample() { - return sample; - } - - @JsonProperty("tags") - public Optional> getTags() { - return tags; - } - - @JsonProperty("use_cases") - public Optional> getUseCases() { - return useCases; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListModelsV1ResponseTtsModelsMetadata - && equalTo((ListModelsV1ResponseTtsModelsMetadata) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListModelsV1ResponseTtsModelsMetadata other) { - return accent.equals(other.accent) - && age.equals(other.age) - && color.equals(other.color) - && image.equals(other.image) - && sample.equals(other.sample) - && tags.equals(other.tags) - && useCases.equals(other.useCases); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.accent, this.age, this.color, this.image, this.sample, this.tags, this.useCases); - } - - @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 accent = Optional.empty(); - - private Optional age = Optional.empty(); - - private Optional color = Optional.empty(); - - private Optional image = Optional.empty(); - - private Optional sample = Optional.empty(); - - private Optional> tags = Optional.empty(); - - private Optional> useCases = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListModelsV1ResponseTtsModelsMetadata other) { - accent(other.getAccent()); - age(other.getAge()); - color(other.getColor()); - image(other.getImage()); - sample(other.getSample()); - tags(other.getTags()); - useCases(other.getUseCases()); - return this; - } - - @JsonSetter(value = "accent", nulls = Nulls.SKIP) - public Builder accent(Optional accent) { - this.accent = accent; - return this; - } - - public Builder accent(String accent) { - this.accent = Optional.ofNullable(accent); - return this; - } - - @JsonSetter(value = "age", nulls = Nulls.SKIP) - public Builder age(Optional age) { - this.age = age; - return this; - } - - public Builder age(String age) { - this.age = Optional.ofNullable(age); - return this; - } - - @JsonSetter(value = "color", nulls = Nulls.SKIP) - public Builder color(Optional color) { - this.color = color; - return this; - } - - public Builder color(String color) { - this.color = Optional.ofNullable(color); - return this; - } - - @JsonSetter(value = "image", nulls = Nulls.SKIP) - public Builder image(Optional image) { - this.image = image; - return this; - } - - public Builder image(String image) { - this.image = Optional.ofNullable(image); - return this; - } - - @JsonSetter(value = "sample", nulls = Nulls.SKIP) - public Builder sample(Optional sample) { - this.sample = sample; - return this; - } - - public Builder sample(String sample) { - this.sample = Optional.ofNullable(sample); - return this; - } - - @JsonSetter(value = "tags", nulls = Nulls.SKIP) - public Builder tags(Optional> tags) { - this.tags = tags; - return this; - } - - public Builder tags(List tags) { - this.tags = Optional.ofNullable(tags); - return this; - } - - @JsonSetter(value = "use_cases", nulls = Nulls.SKIP) - public Builder useCases(Optional> useCases) { - this.useCases = useCases; - return this; - } - - public Builder useCases(List useCases) { - this.useCases = Optional.ofNullable(useCases); - return this; - } - - public ListModelsV1ResponseTtsModelsMetadata build() { - return new ListModelsV1ResponseTtsModelsMetadata( - accent, age, color, image, sample, tags, useCases, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListProjectBalancesV1Response.java b/src/main/java/types/ListProjectBalancesV1Response.java deleted file mode 100644 index a132576..0000000 --- a/src/main/java/types/ListProjectBalancesV1Response.java +++ /dev/null @@ -1,106 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListProjectBalancesV1Response.Builder.class) -public final class ListProjectBalancesV1Response { - private final Optional> balances; - - private final Map additionalProperties; - - private ListProjectBalancesV1Response( - Optional> balances, - Map additionalProperties) { - this.balances = balances; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("balances") - public Optional> getBalances() { - return balances; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListProjectBalancesV1Response - && equalTo((ListProjectBalancesV1Response) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListProjectBalancesV1Response other) { - return balances.equals(other.balances); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.balances); - } - - @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> balances = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListProjectBalancesV1Response other) { - balances(other.getBalances()); - return this; - } - - @JsonSetter(value = "balances", nulls = Nulls.SKIP) - public Builder balances(Optional> balances) { - this.balances = balances; - return this; - } - - public Builder balances(List balances) { - this.balances = Optional.ofNullable(balances); - return this; - } - - public ListProjectBalancesV1Response build() { - return new ListProjectBalancesV1Response(balances, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListProjectBalancesV1ResponseBalancesItem.java b/src/main/java/types/ListProjectBalancesV1ResponseBalancesItem.java deleted file mode 100644 index ef34501..0000000 --- a/src/main/java/types/ListProjectBalancesV1ResponseBalancesItem.java +++ /dev/null @@ -1,194 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListProjectBalancesV1ResponseBalancesItem.Builder.class) -public final class ListProjectBalancesV1ResponseBalancesItem { - private final Optional balanceId; - - private final Optional amount; - - private final Optional units; - - private final Optional purchaseOrderId; - - private final Map additionalProperties; - - private ListProjectBalancesV1ResponseBalancesItem( - Optional balanceId, - Optional amount, - Optional units, - Optional purchaseOrderId, - Map additionalProperties) { - this.balanceId = balanceId; - this.amount = amount; - this.units = units; - this.purchaseOrderId = purchaseOrderId; - this.additionalProperties = additionalProperties; - } - - /** - * @return The unique identifier of the balance - */ - @JsonProperty("balance_id") - public Optional getBalanceId() { - return balanceId; - } - - /** - * @return The amount of the balance - */ - @JsonProperty("amount") - public Optional getAmount() { - return amount; - } - - /** - * @return The units of the balance, such as "USD" - */ - @JsonProperty("units") - public Optional getUnits() { - return units; - } - - /** - * @return Description or reference of the purchase - */ - @JsonProperty("purchase_order_id") - public Optional getPurchaseOrderId() { - return purchaseOrderId; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListProjectBalancesV1ResponseBalancesItem - && equalTo((ListProjectBalancesV1ResponseBalancesItem) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListProjectBalancesV1ResponseBalancesItem other) { - return balanceId.equals(other.balanceId) - && amount.equals(other.amount) - && units.equals(other.units) - && purchaseOrderId.equals(other.purchaseOrderId); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.balanceId, this.amount, this.units, this.purchaseOrderId); - } - - @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 balanceId = Optional.empty(); - - private Optional amount = Optional.empty(); - - private Optional units = Optional.empty(); - - private Optional purchaseOrderId = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListProjectBalancesV1ResponseBalancesItem other) { - balanceId(other.getBalanceId()); - amount(other.getAmount()); - units(other.getUnits()); - purchaseOrderId(other.getPurchaseOrderId()); - return this; - } - - /** The unique identifier of the balance */ - @JsonSetter(value = "balance_id", nulls = Nulls.SKIP) - public Builder balanceId(Optional balanceId) { - this.balanceId = balanceId; - return this; - } - - public Builder balanceId(String balanceId) { - this.balanceId = Optional.ofNullable(balanceId); - return this; - } - - /** The amount of the balance */ - @JsonSetter(value = "amount", nulls = Nulls.SKIP) - public Builder amount(Optional amount) { - this.amount = amount; - return this; - } - - public Builder amount(Double amount) { - this.amount = Optional.ofNullable(amount); - return this; - } - - /** The units of the balance, such as "USD" */ - @JsonSetter(value = "units", nulls = Nulls.SKIP) - public Builder units(Optional units) { - this.units = units; - return this; - } - - public Builder units(String units) { - this.units = Optional.ofNullable(units); - return this; - } - - /** Description or reference of the purchase */ - @JsonSetter(value = "purchase_order_id", nulls = Nulls.SKIP) - public Builder purchaseOrderId(Optional purchaseOrderId) { - this.purchaseOrderId = purchaseOrderId; - return this; - } - - public Builder purchaseOrderId(String purchaseOrderId) { - this.purchaseOrderId = Optional.ofNullable(purchaseOrderId); - return this; - } - - public ListProjectBalancesV1ResponseBalancesItem build() { - return new ListProjectBalancesV1ResponseBalancesItem( - balanceId, amount, units, purchaseOrderId, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListProjectDistributionCredentialsV1Response.java b/src/main/java/types/ListProjectDistributionCredentialsV1Response.java deleted file mode 100644 index f552310..0000000 --- a/src/main/java/types/ListProjectDistributionCredentialsV1Response.java +++ /dev/null @@ -1,120 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListProjectDistributionCredentialsV1Response.Builder.class) -public final class ListProjectDistributionCredentialsV1Response { - private final Optional< - List> - distributionCredentials; - - private final Map additionalProperties; - - private ListProjectDistributionCredentialsV1Response( - Optional> - distributionCredentials, - Map additionalProperties) { - this.distributionCredentials = distributionCredentials; - this.additionalProperties = additionalProperties; - } - - /** - * @return Array of distribution credentials with associated member information - */ - @JsonProperty("distribution_credentials") - public Optional> - getDistributionCredentials() { - return distributionCredentials; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListProjectDistributionCredentialsV1Response - && equalTo((ListProjectDistributionCredentialsV1Response) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListProjectDistributionCredentialsV1Response other) { - return distributionCredentials.equals(other.distributionCredentials); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.distributionCredentials); - } - - @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> - distributionCredentials = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListProjectDistributionCredentialsV1Response other) { - distributionCredentials(other.getDistributionCredentials()); - return this; - } - - /** Array of distribution credentials with associated member information */ - @JsonSetter(value = "distribution_credentials", nulls = Nulls.SKIP) - public Builder distributionCredentials( - Optional> - distributionCredentials) { - this.distributionCredentials = distributionCredentials; - return this; - } - - public Builder distributionCredentials( - List - distributionCredentials) { - this.distributionCredentials = Optional.ofNullable(distributionCredentials); - return this; - } - - public ListProjectDistributionCredentialsV1Response build() { - return new ListProjectDistributionCredentialsV1Response( - distributionCredentials, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItem.java b/src/main/java/types/ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItem.java deleted file mode 100644 index a7af9cf..0000000 --- a/src/main/java/types/ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItem.java +++ /dev/null @@ -1,167 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItem.Builder.class) -public final class ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItem { - private final ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember - member; - - private final - ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials - distributionCredentials; - - private final Map additionalProperties; - - private ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItem( - ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember member, - ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials - distributionCredentials, - Map additionalProperties) { - this.member = member; - this.distributionCredentials = distributionCredentials; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("member") - public ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember getMember() { - return member; - } - - @JsonProperty("distribution_credentials") - public - ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials - getDistributionCredentials() { - return distributionCredentials; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItem - && equalTo((ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItem) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo( - ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItem other) { - return member.equals(other.member) - && distributionCredentials.equals(other.distributionCredentials); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.member, this.distributionCredentials); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static MemberStage builder() { - return new Builder(); - } - - public interface MemberStage { - DistributionCredentialsStage member( - @NotNull - ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember member); - - Builder from(ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItem other); - } - - public interface DistributionCredentialsStage { - _FinalStage distributionCredentials( - @NotNull - ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials - distributionCredentials); - } - - public interface _FinalStage { - ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItem build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements MemberStage, DistributionCredentialsStage, _FinalStage { - private ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember member; - - private - ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials - distributionCredentials; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from( - ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItem other) { - member(other.getMember()); - distributionCredentials(other.getDistributionCredentials()); - return this; - } - - @java.lang.Override - @JsonSetter("member") - public DistributionCredentialsStage member( - @NotNull - ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember member) { - this.member = Objects.requireNonNull(member, "member must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("distribution_credentials") - public _FinalStage distributionCredentials( - @NotNull - ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials - distributionCredentials) { - this.distributionCredentials = - Objects.requireNonNull( - distributionCredentials, "distributionCredentials must not be null"); - return this; - } - - @java.lang.Override - public ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItem build() { - return new ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItem( - member, distributionCredentials, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials.java b/src/main/java/types/ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials.java deleted file mode 100644 index 2b4a3be..0000000 --- a/src/main/java/types/ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials.java +++ /dev/null @@ -1,325 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = - ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials - .Builder.class) -public final -class ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials { - private final String distributionCredentialsId; - - private final String provider; - - private final Optional comment; - - private final List scopes; - - private final OffsetDateTime created; - - private final Map additionalProperties; - - private - ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials( - String distributionCredentialsId, - String provider, - Optional comment, - List scopes, - OffsetDateTime created, - Map additionalProperties) { - this.distributionCredentialsId = distributionCredentialsId; - this.provider = provider; - this.comment = comment; - this.scopes = scopes; - this.created = created; - this.additionalProperties = additionalProperties; - } - - /** - * @return Unique identifier for the distribution credentials - */ - @JsonProperty("distribution_credentials_id") - public String getDistributionCredentialsId() { - return distributionCredentialsId; - } - - /** - * @return The provider of the distribution service - */ - @JsonProperty("provider") - public String getProvider() { - return provider; - } - - /** - * @return Optional comment about the credentials - */ - @JsonProperty("comment") - public Optional getComment() { - return comment; - } - - /** - * @return List of permission scopes for the credentials - */ - @JsonProperty("scopes") - public List getScopes() { - return scopes; - } - - /** - * @return Timestamp when the credentials were created - */ - @JsonProperty("created") - public OffsetDateTime getCreated() { - return created; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other - instanceof - ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials - && equalTo( - (ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials) - other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo( - ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials - other) { - return distributionCredentialsId.equals(other.distributionCredentialsId) - && provider.equals(other.provider) - && comment.equals(other.comment) - && scopes.equals(other.scopes) - && created.equals(other.created); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.distributionCredentialsId, this.provider, this.comment, this.scopes, this.created); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static DistributionCredentialsIdStage builder() { - return new Builder(); - } - - public interface DistributionCredentialsIdStage { - /** Unique identifier for the distribution credentials */ - ProviderStage distributionCredentialsId(@NotNull String distributionCredentialsId); - - Builder from( - ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials - other); - } - - public interface ProviderStage { - /** The provider of the distribution service */ - CreatedStage provider(@NotNull String provider); - } - - public interface CreatedStage { - /** Timestamp when the credentials were created */ - _FinalStage created(@NotNull OffsetDateTime created); - } - - public interface _FinalStage { - ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials - build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** Optional comment about the credentials */ - _FinalStage comment(Optional comment); - - _FinalStage comment(String comment); - - /** List of permission scopes for the credentials */ - _FinalStage scopes(List scopes); - - _FinalStage addScopes(String scopes); - - _FinalStage addAllScopes(List scopes); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements DistributionCredentialsIdStage, ProviderStage, CreatedStage, _FinalStage { - private String distributionCredentialsId; - - private String provider; - - private OffsetDateTime created; - - private List scopes = new ArrayList<>(); - - private Optional comment = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from( - ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials - other) { - distributionCredentialsId(other.getDistributionCredentialsId()); - provider(other.getProvider()); - comment(other.getComment()); - scopes(other.getScopes()); - created(other.getCreated()); - return this; - } - - /** - * Unique identifier for the distribution credentials - * - *

Unique identifier for the distribution credentials - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("distribution_credentials_id") - public ProviderStage distributionCredentialsId(@NotNull String distributionCredentialsId) { - this.distributionCredentialsId = - Objects.requireNonNull( - distributionCredentialsId, "distributionCredentialsId must not be null"); - return this; - } - - /** - * The provider of the distribution service - * - *

The provider of the distribution service - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("provider") - public CreatedStage provider(@NotNull String provider) { - this.provider = Objects.requireNonNull(provider, "provider must not be null"); - return this; - } - - /** - * Timestamp when the credentials were created - * - *

Timestamp when the credentials were created - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("created") - public _FinalStage created(@NotNull OffsetDateTime created) { - this.created = Objects.requireNonNull(created, "created must not be null"); - return this; - } - - /** - * List of permission scopes for the credentials - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage addAllScopes(List scopes) { - if (scopes != null) { - this.scopes.addAll(scopes); - } - return this; - } - - /** - * List of permission scopes for the credentials - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage addScopes(String scopes) { - this.scopes.add(scopes); - return this; - } - - /** List of permission scopes for the credentials */ - @java.lang.Override - @JsonSetter(value = "scopes", nulls = Nulls.SKIP) - public _FinalStage scopes(List scopes) { - this.scopes.clear(); - if (scopes != null) { - this.scopes.addAll(scopes); - } - return this; - } - - /** - * Optional comment about the credentials - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage comment(String comment) { - this.comment = Optional.ofNullable(comment); - return this; - } - - /** Optional comment about the credentials */ - @java.lang.Override - @JsonSetter(value = "comment", nulls = Nulls.SKIP) - public _FinalStage comment(Optional comment) { - this.comment = comment; - return this; - } - - @java.lang.Override - public - ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials - build() { - return new ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemDistributionCredentials( - distributionCredentialsId, provider, comment, scopes, created, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember.java b/src/main/java/types/ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember.java deleted file mode 100644 index aaea356..0000000 --- a/src/main/java/types/ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember.java +++ /dev/null @@ -1,169 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = - ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember.Builder.class) -public final class ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember { - private final String memberId; - - private final String email; - - private final Map additionalProperties; - - private ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember( - String memberId, String email, Map additionalProperties) { - this.memberId = memberId; - this.email = email; - this.additionalProperties = additionalProperties; - } - - /** - * @return Unique identifier for the member - */ - @JsonProperty("member_id") - public String getMemberId() { - return memberId; - } - - /** - * @return Email address of the member - */ - @JsonProperty("email") - public String getEmail() { - return email; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other - instanceof ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember - && equalTo( - (ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo( - ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember other) { - return memberId.equals(other.memberId) && email.equals(other.email); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.memberId, this.email); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static MemberIdStage builder() { - return new Builder(); - } - - public interface MemberIdStage { - /** Unique identifier for the member */ - EmailStage memberId(@NotNull String memberId); - - Builder from( - ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember other); - } - - public interface EmailStage { - /** Email address of the member */ - _FinalStage email(@NotNull String email); - } - - public interface _FinalStage { - ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements MemberIdStage, EmailStage, _FinalStage { - private String memberId; - - private String email; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from( - ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember other) { - memberId(other.getMemberId()); - email(other.getEmail()); - return this; - } - - /** - * Unique identifier for the member - * - *

Unique identifier for the member - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("member_id") - public EmailStage memberId(@NotNull String memberId) { - this.memberId = Objects.requireNonNull(memberId, "memberId must not be null"); - return this; - } - - /** - * Email address of the member - * - *

Email address of the member - * - * @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; - } - - @java.lang.Override - public ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember build() { - return new ListProjectDistributionCredentialsV1ResponseDistributionCredentialsItemMember( - memberId, email, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListProjectInvitesV1Response.java b/src/main/java/types/ListProjectInvitesV1Response.java deleted file mode 100644 index 4d2ea4a..0000000 --- a/src/main/java/types/ListProjectInvitesV1Response.java +++ /dev/null @@ -1,106 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListProjectInvitesV1Response.Builder.class) -public final class ListProjectInvitesV1Response { - private final Optional> invites; - - private final Map additionalProperties; - - private ListProjectInvitesV1Response( - Optional> invites, - Map additionalProperties) { - this.invites = invites; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("invites") - public Optional> getInvites() { - return invites; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListProjectInvitesV1Response - && equalTo((ListProjectInvitesV1Response) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListProjectInvitesV1Response other) { - return invites.equals(other.invites); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.invites); - } - - @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> invites = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListProjectInvitesV1Response other) { - invites(other.getInvites()); - return this; - } - - @JsonSetter(value = "invites", nulls = Nulls.SKIP) - public Builder invites(Optional> invites) { - this.invites = invites; - return this; - } - - public Builder invites(List invites) { - this.invites = Optional.ofNullable(invites); - return this; - } - - public ListProjectInvitesV1Response build() { - return new ListProjectInvitesV1Response(invites, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListProjectInvitesV1ResponseInvitesItem.java b/src/main/java/types/ListProjectInvitesV1ResponseInvitesItem.java deleted file mode 100644 index 4bf144d..0000000 --- a/src/main/java/types/ListProjectInvitesV1ResponseInvitesItem.java +++ /dev/null @@ -1,134 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListProjectInvitesV1ResponseInvitesItem.Builder.class) -public final class ListProjectInvitesV1ResponseInvitesItem { - private final Optional email; - - private final Optional scope; - - private final Map additionalProperties; - - private ListProjectInvitesV1ResponseInvitesItem( - Optional email, Optional scope, Map additionalProperties) { - this.email = email; - this.scope = scope; - this.additionalProperties = additionalProperties; - } - - /** - * @return The email address of the invitee - */ - @JsonProperty("email") - public Optional getEmail() { - return email; - } - - /** - * @return The scope of the invitee - */ - @JsonProperty("scope") - public Optional getScope() { - return scope; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListProjectInvitesV1ResponseInvitesItem - && equalTo((ListProjectInvitesV1ResponseInvitesItem) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListProjectInvitesV1ResponseInvitesItem other) { - return email.equals(other.email) && scope.equals(other.scope); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.email, this.scope); - } - - @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 email = Optional.empty(); - - private Optional scope = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListProjectInvitesV1ResponseInvitesItem other) { - email(other.getEmail()); - scope(other.getScope()); - return this; - } - - /** The email address of the invitee */ - @JsonSetter(value = "email", nulls = Nulls.SKIP) - public Builder email(Optional email) { - this.email = email; - return this; - } - - public Builder email(String email) { - this.email = Optional.ofNullable(email); - return this; - } - - /** The scope of the invitee */ - @JsonSetter(value = "scope", nulls = Nulls.SKIP) - public Builder scope(Optional scope) { - this.scope = scope; - return this; - } - - public Builder scope(String scope) { - this.scope = Optional.ofNullable(scope); - return this; - } - - public ListProjectInvitesV1ResponseInvitesItem build() { - return new ListProjectInvitesV1ResponseInvitesItem(email, scope, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListProjectKeysV1Response.java b/src/main/java/types/ListProjectKeysV1Response.java deleted file mode 100644 index d4e3edf..0000000 --- a/src/main/java/types/ListProjectKeysV1Response.java +++ /dev/null @@ -1,105 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListProjectKeysV1Response.Builder.class) -public final class ListProjectKeysV1Response { - private final Optional> apiKeys; - - private final Map additionalProperties; - - private ListProjectKeysV1Response( - Optional> apiKeys, - Map additionalProperties) { - this.apiKeys = apiKeys; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("api_keys") - public Optional> getApiKeys() { - return apiKeys; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListProjectKeysV1Response && equalTo((ListProjectKeysV1Response) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListProjectKeysV1Response other) { - return apiKeys.equals(other.apiKeys); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.apiKeys); - } - - @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> apiKeys = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListProjectKeysV1Response other) { - apiKeys(other.getApiKeys()); - return this; - } - - @JsonSetter(value = "api_keys", nulls = Nulls.SKIP) - public Builder apiKeys(Optional> apiKeys) { - this.apiKeys = apiKeys; - return this; - } - - public Builder apiKeys(List apiKeys) { - this.apiKeys = Optional.ofNullable(apiKeys); - return this; - } - - public ListProjectKeysV1Response build() { - return new ListProjectKeysV1Response(apiKeys, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListProjectKeysV1ResponseApiKeysItem.java b/src/main/java/types/ListProjectKeysV1ResponseApiKeysItem.java deleted file mode 100644 index e237f3d..0000000 --- a/src/main/java/types/ListProjectKeysV1ResponseApiKeysItem.java +++ /dev/null @@ -1,128 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListProjectKeysV1ResponseApiKeysItem.Builder.class) -public final class ListProjectKeysV1ResponseApiKeysItem { - private final Optional member; - - private final Optional apiKey; - - private final Map additionalProperties; - - private ListProjectKeysV1ResponseApiKeysItem( - Optional member, - Optional apiKey, - Map additionalProperties) { - this.member = member; - this.apiKey = apiKey; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("member") - public Optional getMember() { - return member; - } - - @JsonProperty("api_key") - public Optional getApiKey() { - return apiKey; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListProjectKeysV1ResponseApiKeysItem - && equalTo((ListProjectKeysV1ResponseApiKeysItem) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListProjectKeysV1ResponseApiKeysItem other) { - return member.equals(other.member) && apiKey.equals(other.apiKey); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.member, this.apiKey); - } - - @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 member = Optional.empty(); - - private Optional apiKey = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListProjectKeysV1ResponseApiKeysItem other) { - member(other.getMember()); - apiKey(other.getApiKey()); - return this; - } - - @JsonSetter(value = "member", nulls = Nulls.SKIP) - public Builder member(Optional member) { - this.member = member; - return this; - } - - public Builder member(ListProjectKeysV1ResponseApiKeysItemMember member) { - this.member = Optional.ofNullable(member); - return this; - } - - @JsonSetter(value = "api_key", nulls = Nulls.SKIP) - public Builder apiKey(Optional apiKey) { - this.apiKey = apiKey; - return this; - } - - public Builder apiKey(ListProjectKeysV1ResponseApiKeysItemApiKey apiKey) { - this.apiKey = Optional.ofNullable(apiKey); - return this; - } - - public ListProjectKeysV1ResponseApiKeysItem build() { - return new ListProjectKeysV1ResponseApiKeysItem(member, apiKey, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListProjectKeysV1ResponseApiKeysItemApiKey.java b/src/main/java/types/ListProjectKeysV1ResponseApiKeysItemApiKey.java deleted file mode 100644 index ee93088..0000000 --- a/src/main/java/types/ListProjectKeysV1ResponseApiKeysItemApiKey.java +++ /dev/null @@ -1,180 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize(builder = ListProjectKeysV1ResponseApiKeysItemApiKey.Builder.class) -public final class ListProjectKeysV1ResponseApiKeysItemApiKey { - private final Optional apiKeyId; - - private final Optional comment; - - private final Optional> scopes; - - private final Optional created; - - private final Map additionalProperties; - - private ListProjectKeysV1ResponseApiKeysItemApiKey( - Optional apiKeyId, - Optional comment, - Optional> scopes, - Optional created, - Map additionalProperties) { - this.apiKeyId = apiKeyId; - this.comment = comment; - this.scopes = scopes; - this.created = created; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("api_key_id") - public Optional getApiKeyId() { - return apiKeyId; - } - - @JsonProperty("comment") - public Optional getComment() { - return comment; - } - - @JsonProperty("scopes") - public Optional> getScopes() { - return scopes; - } - - @JsonProperty("created") - public Optional getCreated() { - return created; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListProjectKeysV1ResponseApiKeysItemApiKey - && equalTo((ListProjectKeysV1ResponseApiKeysItemApiKey) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListProjectKeysV1ResponseApiKeysItemApiKey other) { - return apiKeyId.equals(other.apiKeyId) - && comment.equals(other.comment) - && scopes.equals(other.scopes) - && created.equals(other.created); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.apiKeyId, this.comment, this.scopes, this.created); - } - - @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 apiKeyId = Optional.empty(); - - private Optional comment = Optional.empty(); - - private Optional> scopes = Optional.empty(); - - private Optional created = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListProjectKeysV1ResponseApiKeysItemApiKey other) { - apiKeyId(other.getApiKeyId()); - comment(other.getComment()); - scopes(other.getScopes()); - created(other.getCreated()); - return this; - } - - @JsonSetter(value = "api_key_id", nulls = Nulls.SKIP) - public Builder apiKeyId(Optional apiKeyId) { - this.apiKeyId = apiKeyId; - return this; - } - - public Builder apiKeyId(String apiKeyId) { - this.apiKeyId = Optional.ofNullable(apiKeyId); - return this; - } - - @JsonSetter(value = "comment", nulls = Nulls.SKIP) - public Builder comment(Optional comment) { - this.comment = comment; - return this; - } - - public Builder comment(String comment) { - this.comment = Optional.ofNullable(comment); - return this; - } - - @JsonSetter(value = "scopes", nulls = Nulls.SKIP) - public Builder scopes(Optional> scopes) { - this.scopes = scopes; - return this; - } - - public Builder scopes(List scopes) { - this.scopes = Optional.ofNullable(scopes); - return this; - } - - @JsonSetter(value = "created", nulls = Nulls.SKIP) - public Builder created(Optional created) { - this.created = created; - return this; - } - - public Builder created(OffsetDateTime created) { - this.created = Optional.ofNullable(created); - return this; - } - - public ListProjectKeysV1ResponseApiKeysItemApiKey build() { - return new ListProjectKeysV1ResponseApiKeysItemApiKey( - apiKeyId, comment, scopes, created, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListProjectKeysV1ResponseApiKeysItemMember.java b/src/main/java/types/ListProjectKeysV1ResponseApiKeysItemMember.java deleted file mode 100644 index bb3e0ce..0000000 --- a/src/main/java/types/ListProjectKeysV1ResponseApiKeysItemMember.java +++ /dev/null @@ -1,126 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListProjectKeysV1ResponseApiKeysItemMember.Builder.class) -public final class ListProjectKeysV1ResponseApiKeysItemMember { - private final Optional memberId; - - private final Optional email; - - private final Map additionalProperties; - - private ListProjectKeysV1ResponseApiKeysItemMember( - Optional memberId, Optional email, Map additionalProperties) { - this.memberId = memberId; - this.email = email; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("member_id") - public Optional getMemberId() { - return memberId; - } - - @JsonProperty("email") - public Optional getEmail() { - return email; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListProjectKeysV1ResponseApiKeysItemMember - && equalTo((ListProjectKeysV1ResponseApiKeysItemMember) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListProjectKeysV1ResponseApiKeysItemMember other) { - return memberId.equals(other.memberId) && email.equals(other.email); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.memberId, this.email); - } - - @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 memberId = Optional.empty(); - - private Optional email = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListProjectKeysV1ResponseApiKeysItemMember other) { - memberId(other.getMemberId()); - email(other.getEmail()); - return this; - } - - @JsonSetter(value = "member_id", nulls = Nulls.SKIP) - public Builder memberId(Optional memberId) { - this.memberId = memberId; - return this; - } - - public Builder memberId(String memberId) { - this.memberId = Optional.ofNullable(memberId); - return this; - } - - @JsonSetter(value = "email", nulls = Nulls.SKIP) - public Builder email(Optional email) { - this.email = email; - return this; - } - - public Builder email(String email) { - this.email = Optional.ofNullable(email); - return this; - } - - public ListProjectKeysV1ResponseApiKeysItemMember build() { - return new ListProjectKeysV1ResponseApiKeysItemMember(memberId, email, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListProjectMemberScopesV1Response.java b/src/main/java/types/ListProjectMemberScopesV1Response.java deleted file mode 100644 index d813777..0000000 --- a/src/main/java/types/ListProjectMemberScopesV1Response.java +++ /dev/null @@ -1,109 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListProjectMemberScopesV1Response.Builder.class) -public final class ListProjectMemberScopesV1Response { - private final Optional> scopes; - - private final Map additionalProperties; - - private ListProjectMemberScopesV1Response( - Optional> scopes, Map additionalProperties) { - this.scopes = scopes; - this.additionalProperties = additionalProperties; - } - - /** - * @return The API scopes of the member - */ - @JsonProperty("scopes") - public Optional> getScopes() { - return scopes; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListProjectMemberScopesV1Response - && equalTo((ListProjectMemberScopesV1Response) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListProjectMemberScopesV1Response other) { - return scopes.equals(other.scopes); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.scopes); - } - - @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> scopes = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListProjectMemberScopesV1Response other) { - scopes(other.getScopes()); - return this; - } - - /** The API scopes of the member */ - @JsonSetter(value = "scopes", nulls = Nulls.SKIP) - public Builder scopes(Optional> scopes) { - this.scopes = scopes; - return this; - } - - public Builder scopes(List scopes) { - this.scopes = Optional.ofNullable(scopes); - return this; - } - - public ListProjectMemberScopesV1Response build() { - return new ListProjectMemberScopesV1Response(scopes, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListProjectMembersV1Response.java b/src/main/java/types/ListProjectMembersV1Response.java deleted file mode 100644 index f93c11a..0000000 --- a/src/main/java/types/ListProjectMembersV1Response.java +++ /dev/null @@ -1,106 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListProjectMembersV1Response.Builder.class) -public final class ListProjectMembersV1Response { - private final Optional> members; - - private final Map additionalProperties; - - private ListProjectMembersV1Response( - Optional> members, - Map additionalProperties) { - this.members = members; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("members") - public Optional> getMembers() { - return members; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListProjectMembersV1Response - && equalTo((ListProjectMembersV1Response) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListProjectMembersV1Response other) { - return members.equals(other.members); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.members); - } - - @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> members = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListProjectMembersV1Response other) { - members(other.getMembers()); - return this; - } - - @JsonSetter(value = "members", nulls = Nulls.SKIP) - public Builder members(Optional> members) { - this.members = members; - return this; - } - - public Builder members(List members) { - this.members = Optional.ofNullable(members); - return this; - } - - public ListProjectMembersV1Response build() { - return new ListProjectMembersV1Response(members, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListProjectMembersV1ResponseMembersItem.java b/src/main/java/types/ListProjectMembersV1ResponseMembersItem.java deleted file mode 100644 index 28bcc2e..0000000 --- a/src/main/java/types/ListProjectMembersV1ResponseMembersItem.java +++ /dev/null @@ -1,211 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListProjectMembersV1ResponseMembersItem.Builder.class) -public final class ListProjectMembersV1ResponseMembersItem { - private final Optional memberId; - - private final Optional> scopes; - - private final Optional email; - - private final Optional firstName; - - private final Optional lastName; - - private final Map additionalProperties; - - private ListProjectMembersV1ResponseMembersItem( - Optional memberId, - Optional> scopes, - Optional email, - Optional firstName, - Optional lastName, - Map additionalProperties) { - this.memberId = memberId; - this.scopes = scopes; - this.email = email; - this.firstName = firstName; - this.lastName = lastName; - this.additionalProperties = additionalProperties; - } - - /** - * @return The unique identifier of the member - */ - @JsonProperty("member_id") - public Optional getMemberId() { - return memberId; - } - - /** - * @return The API scopes of the member - */ - @JsonProperty("scopes") - public Optional> getScopes() { - return scopes; - } - - @JsonProperty("email") - public Optional getEmail() { - return email; - } - - @JsonProperty("first_name") - public Optional getFirstName() { - return firstName; - } - - @JsonProperty("last_name") - public Optional getLastName() { - return lastName; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListProjectMembersV1ResponseMembersItem - && equalTo((ListProjectMembersV1ResponseMembersItem) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListProjectMembersV1ResponseMembersItem other) { - return memberId.equals(other.memberId) - && scopes.equals(other.scopes) - && email.equals(other.email) - && firstName.equals(other.firstName) - && lastName.equals(other.lastName); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.memberId, this.scopes, this.email, this.firstName, this.lastName); - } - - @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 memberId = Optional.empty(); - - private Optional> scopes = Optional.empty(); - - private Optional email = Optional.empty(); - - private Optional firstName = Optional.empty(); - - private Optional lastName = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListProjectMembersV1ResponseMembersItem other) { - memberId(other.getMemberId()); - scopes(other.getScopes()); - email(other.getEmail()); - firstName(other.getFirstName()); - lastName(other.getLastName()); - return this; - } - - /** The unique identifier of the member */ - @JsonSetter(value = "member_id", nulls = Nulls.SKIP) - public Builder memberId(Optional memberId) { - this.memberId = memberId; - return this; - } - - public Builder memberId(String memberId) { - this.memberId = Optional.ofNullable(memberId); - return this; - } - - /** The API scopes of the member */ - @JsonSetter(value = "scopes", nulls = Nulls.SKIP) - public Builder scopes(Optional> scopes) { - this.scopes = scopes; - return this; - } - - public Builder scopes(List scopes) { - this.scopes = Optional.ofNullable(scopes); - return this; - } - - @JsonSetter(value = "email", nulls = Nulls.SKIP) - public Builder email(Optional email) { - this.email = email; - return this; - } - - public Builder email(String email) { - this.email = Optional.ofNullable(email); - return this; - } - - @JsonSetter(value = "first_name", nulls = Nulls.SKIP) - public Builder firstName(Optional firstName) { - this.firstName = firstName; - return this; - } - - public Builder firstName(String firstName) { - this.firstName = Optional.ofNullable(firstName); - return this; - } - - @JsonSetter(value = "last_name", nulls = Nulls.SKIP) - public Builder lastName(Optional lastName) { - this.lastName = lastName; - return this; - } - - public Builder lastName(String lastName) { - this.lastName = Optional.ofNullable(lastName); - return this; - } - - public ListProjectMembersV1ResponseMembersItem build() { - return new ListProjectMembersV1ResponseMembersItem( - memberId, scopes, email, firstName, lastName, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListProjectPurchasesV1Response.java b/src/main/java/types/ListProjectPurchasesV1Response.java deleted file mode 100644 index ae45581..0000000 --- a/src/main/java/types/ListProjectPurchasesV1Response.java +++ /dev/null @@ -1,106 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListProjectPurchasesV1Response.Builder.class) -public final class ListProjectPurchasesV1Response { - private final Optional> orders; - - private final Map additionalProperties; - - private ListProjectPurchasesV1Response( - Optional> orders, - Map additionalProperties) { - this.orders = orders; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("orders") - public Optional> getOrders() { - return orders; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListProjectPurchasesV1Response - && equalTo((ListProjectPurchasesV1Response) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListProjectPurchasesV1Response other) { - return orders.equals(other.orders); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.orders); - } - - @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> orders = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListProjectPurchasesV1Response other) { - orders(other.getOrders()); - return this; - } - - @JsonSetter(value = "orders", nulls = Nulls.SKIP) - public Builder orders(Optional> orders) { - this.orders = orders; - return this; - } - - public Builder orders(List orders) { - this.orders = Optional.ofNullable(orders); - return this; - } - - public ListProjectPurchasesV1Response build() { - return new ListProjectPurchasesV1Response(orders, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListProjectPurchasesV1ResponseOrdersItem.java b/src/main/java/types/ListProjectPurchasesV1ResponseOrdersItem.java deleted file mode 100644 index 5f2c83c..0000000 --- a/src/main/java/types/ListProjectPurchasesV1ResponseOrdersItem.java +++ /dev/null @@ -1,228 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListProjectPurchasesV1ResponseOrdersItem.Builder.class) -public final class ListProjectPurchasesV1ResponseOrdersItem { - private final Optional orderId; - - private final Optional expiration; - - private final Optional created; - - private final Optional amount; - - private final Optional units; - - private final Optional orderType; - - private final Map additionalProperties; - - private ListProjectPurchasesV1ResponseOrdersItem( - Optional orderId, - Optional expiration, - Optional created, - Optional amount, - Optional units, - Optional orderType, - Map additionalProperties) { - this.orderId = orderId; - this.expiration = expiration; - this.created = created; - this.amount = amount; - this.units = units; - this.orderType = orderType; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("order_id") - public Optional getOrderId() { - return orderId; - } - - @JsonProperty("expiration") - public Optional getExpiration() { - return expiration; - } - - @JsonProperty("created") - public Optional getCreated() { - return created; - } - - @JsonProperty("amount") - public Optional getAmount() { - return amount; - } - - @JsonProperty("units") - public Optional getUnits() { - return units; - } - - @JsonProperty("order_type") - public Optional getOrderType() { - return orderType; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListProjectPurchasesV1ResponseOrdersItem - && equalTo((ListProjectPurchasesV1ResponseOrdersItem) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListProjectPurchasesV1ResponseOrdersItem other) { - return orderId.equals(other.orderId) - && expiration.equals(other.expiration) - && created.equals(other.created) - && amount.equals(other.amount) - && units.equals(other.units) - && orderType.equals(other.orderType); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.orderId, this.expiration, this.created, this.amount, this.units, this.orderType); - } - - @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 orderId = Optional.empty(); - - private Optional expiration = Optional.empty(); - - private Optional created = Optional.empty(); - - private Optional amount = Optional.empty(); - - private Optional units = Optional.empty(); - - private Optional orderType = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListProjectPurchasesV1ResponseOrdersItem other) { - orderId(other.getOrderId()); - expiration(other.getExpiration()); - created(other.getCreated()); - amount(other.getAmount()); - units(other.getUnits()); - orderType(other.getOrderType()); - return this; - } - - @JsonSetter(value = "order_id", nulls = Nulls.SKIP) - public Builder orderId(Optional orderId) { - this.orderId = orderId; - return this; - } - - public Builder orderId(String orderId) { - this.orderId = Optional.ofNullable(orderId); - return this; - } - - @JsonSetter(value = "expiration", nulls = Nulls.SKIP) - public Builder expiration(Optional expiration) { - this.expiration = expiration; - return this; - } - - public Builder expiration(OffsetDateTime expiration) { - this.expiration = Optional.ofNullable(expiration); - return this; - } - - @JsonSetter(value = "created", nulls = Nulls.SKIP) - public Builder created(Optional created) { - this.created = created; - return this; - } - - public Builder created(OffsetDateTime created) { - this.created = Optional.ofNullable(created); - return this; - } - - @JsonSetter(value = "amount", nulls = Nulls.SKIP) - public Builder amount(Optional amount) { - this.amount = amount; - return this; - } - - public Builder amount(Float amount) { - this.amount = Optional.ofNullable(amount); - return this; - } - - @JsonSetter(value = "units", nulls = Nulls.SKIP) - public Builder units(Optional units) { - this.units = units; - return this; - } - - public Builder units(String units) { - this.units = Optional.ofNullable(units); - return this; - } - - @JsonSetter(value = "order_type", nulls = Nulls.SKIP) - public Builder orderType(Optional orderType) { - this.orderType = orderType; - return this; - } - - public Builder orderType(String orderType) { - this.orderType = Optional.ofNullable(orderType); - return this; - } - - public ListProjectPurchasesV1ResponseOrdersItem build() { - return new ListProjectPurchasesV1ResponseOrdersItem( - orderId, expiration, created, amount, units, orderType, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListProjectRequestsV1Response.java b/src/main/java/types/ListProjectRequestsV1Response.java deleted file mode 100644 index b45bfac..0000000 --- a/src/main/java/types/ListProjectRequestsV1Response.java +++ /dev/null @@ -1,160 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListProjectRequestsV1Response.Builder.class) -public final class ListProjectRequestsV1Response { - private final Optional page; - - private final Optional limit; - - private final Optional> requests; - - private final Map additionalProperties; - - private ListProjectRequestsV1Response( - Optional page, - Optional limit, - Optional> requests, - Map additionalProperties) { - this.page = page; - this.limit = limit; - this.requests = requests; - this.additionalProperties = additionalProperties; - } - - /** - * @return The page number of the paginated response - */ - @JsonProperty("page") - public Optional getPage() { - return page; - } - - /** - * @return The number of results per page - */ - @JsonProperty("limit") - public Optional getLimit() { - return limit; - } - - @JsonProperty("requests") - public Optional> getRequests() { - return requests; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListProjectRequestsV1Response - && equalTo((ListProjectRequestsV1Response) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListProjectRequestsV1Response other) { - return page.equals(other.page) && limit.equals(other.limit) && requests.equals(other.requests); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.page, this.limit, this.requests); - } - - @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 page = Optional.empty(); - - private Optional limit = Optional.empty(); - - private Optional> requests = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListProjectRequestsV1Response other) { - page(other.getPage()); - limit(other.getLimit()); - requests(other.getRequests()); - return this; - } - - /** The page number of the paginated response */ - @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; - } - - /** The number of results per page */ - @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 = "requests", nulls = Nulls.SKIP) - public Builder requests(Optional> requests) { - this.requests = requests; - return this; - } - - public Builder requests(List requests) { - this.requests = Optional.ofNullable(requests); - return this; - } - - public ListProjectRequestsV1Response build() { - return new ListProjectRequestsV1Response(page, limit, requests, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListProjectsV1Response.java b/src/main/java/types/ListProjectsV1Response.java deleted file mode 100644 index 2c9eef4..0000000 --- a/src/main/java/types/ListProjectsV1Response.java +++ /dev/null @@ -1,105 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListProjectsV1Response.Builder.class) -public final class ListProjectsV1Response { - private final Optional> projects; - - private final Map additionalProperties; - - private ListProjectsV1Response( - Optional> projects, - Map additionalProperties) { - this.projects = projects; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("projects") - public Optional> getProjects() { - return projects; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListProjectsV1Response && equalTo((ListProjectsV1Response) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListProjectsV1Response other) { - return projects.equals(other.projects); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.projects); - } - - @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> projects = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListProjectsV1Response other) { - projects(other.getProjects()); - return this; - } - - @JsonSetter(value = "projects", nulls = Nulls.SKIP) - public Builder projects(Optional> projects) { - this.projects = projects; - return this; - } - - public Builder projects(List projects) { - this.projects = Optional.ofNullable(projects); - return this; - } - - public ListProjectsV1Response build() { - return new ListProjectsV1Response(projects, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListProjectsV1ResponseProjectsItem.java b/src/main/java/types/ListProjectsV1ResponseProjectsItem.java deleted file mode 100644 index a9f829b..0000000 --- a/src/main/java/types/ListProjectsV1ResponseProjectsItem.java +++ /dev/null @@ -1,134 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListProjectsV1ResponseProjectsItem.Builder.class) -public final class ListProjectsV1ResponseProjectsItem { - private final Optional projectId; - - private final Optional name; - - private final Map additionalProperties; - - private ListProjectsV1ResponseProjectsItem( - Optional projectId, Optional name, Map additionalProperties) { - this.projectId = projectId; - this.name = name; - this.additionalProperties = additionalProperties; - } - - /** - * @return The unique identifier of the project - */ - @JsonProperty("project_id") - public Optional getProjectId() { - return projectId; - } - - /** - * @return The name of the project - */ - @JsonProperty("name") - public Optional getName() { - return name; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListProjectsV1ResponseProjectsItem - && equalTo((ListProjectsV1ResponseProjectsItem) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListProjectsV1ResponseProjectsItem other) { - return projectId.equals(other.projectId) && name.equals(other.name); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.projectId, 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 projectId = Optional.empty(); - - private Optional name = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListProjectsV1ResponseProjectsItem other) { - projectId(other.getProjectId()); - name(other.getName()); - return this; - } - - /** The unique identifier of the project */ - @JsonSetter(value = "project_id", nulls = Nulls.SKIP) - public Builder projectId(Optional projectId) { - this.projectId = projectId; - return this; - } - - public Builder projectId(String projectId) { - this.projectId = Optional.ofNullable(projectId); - return this; - } - - /** The name of the project */ - @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 ListProjectsV1ResponseProjectsItem build() { - return new ListProjectsV1ResponseProjectsItem(projectId, name, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListenV1AcceptedResponse.java b/src/main/java/types/ListenV1AcceptedResponse.java deleted file mode 100644 index 8cd89ce..0000000 --- a/src/main/java/types/ListenV1AcceptedResponse.java +++ /dev/null @@ -1,126 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListenV1AcceptedResponse.Builder.class) -public final class ListenV1AcceptedResponse { - private final String requestId; - - private final Map additionalProperties; - - private ListenV1AcceptedResponse(String requestId, Map additionalProperties) { - this.requestId = requestId; - this.additionalProperties = additionalProperties; - } - - /** - * @return Unique identifier for tracking the asynchronous request - */ - @JsonProperty("request_id") - public String getRequestId() { - return requestId; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListenV1AcceptedResponse && equalTo((ListenV1AcceptedResponse) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListenV1AcceptedResponse other) { - return requestId.equals(other.requestId); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.requestId); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static RequestIdStage builder() { - return new Builder(); - } - - public interface RequestIdStage { - /** Unique identifier for tracking the asynchronous request */ - _FinalStage requestId(@NotNull String requestId); - - Builder from(ListenV1AcceptedResponse other); - } - - public interface _FinalStage { - ListenV1AcceptedResponse build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements RequestIdStage, _FinalStage { - private String requestId; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(ListenV1AcceptedResponse other) { - requestId(other.getRequestId()); - return this; - } - - /** - * Unique identifier for tracking the asynchronous request - * - *

Unique identifier for tracking the asynchronous request - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("request_id") - public _FinalStage requestId(@NotNull String requestId) { - this.requestId = Objects.requireNonNull(requestId, "requestId must not be null"); - return this; - } - - @java.lang.Override - public ListenV1AcceptedResponse build() { - return new ListenV1AcceptedResponse(requestId, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListenV1Callback.java b/src/main/java/types/ListenV1Callback.java deleted file mode 100644 index 47dba30..0000000 --- a/src/main/java/types/ListenV1Callback.java +++ /dev/null @@ -1,41 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import core.WrappedAlias; - -public final class ListenV1Callback implements WrappedAlias { - private final Object value; - - private ListenV1Callback(Object value) { - this.value = value; - } - - @JsonValue - public Object get() { - return this.value; - } - - @java.lang.Override - public boolean equals(Object other) { - return this == other - || (other instanceof ListenV1Callback - && this.value.equals(((ListenV1Callback) other).value)); - } - - @java.lang.Override - public int hashCode() { - return value.hashCode(); - } - - @java.lang.Override - public String toString() { - return value.toString(); - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListenV1Callback of(Object value) { - return new ListenV1Callback(value); - } -} diff --git a/src/main/java/types/ListenV1CallbackMethod.java b/src/main/java/types/ListenV1CallbackMethod.java deleted file mode 100644 index 3aa07b0..0000000 --- a/src/main/java/types/ListenV1CallbackMethod.java +++ /dev/null @@ -1,103 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class ListenV1CallbackMethod { - public static final ListenV1CallbackMethod DELETE = - new ListenV1CallbackMethod(Value.DELETE, "DELETE"); - - public static final ListenV1CallbackMethod GET = new ListenV1CallbackMethod(Value.GET, "GET"); - - public static final ListenV1CallbackMethod PUT = new ListenV1CallbackMethod(Value.PUT, "PUT"); - - public static final ListenV1CallbackMethod POST = new ListenV1CallbackMethod(Value.POST, "POST"); - - private final Value value; - - private final String string; - - ListenV1CallbackMethod(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof ListenV1CallbackMethod - && this.string.equals(((ListenV1CallbackMethod) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case DELETE: - return visitor.visitDelete(); - case GET: - return visitor.visitGet(); - case PUT: - return visitor.visitPut(); - case POST: - return visitor.visitPost(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListenV1CallbackMethod valueOf(String value) { - switch (value) { - case "DELETE": - return DELETE; - case "GET": - return GET; - case "PUT": - return PUT; - case "POST": - return POST; - default: - return new ListenV1CallbackMethod(Value.UNKNOWN, value); - } - } - - public enum Value { - POST, - - GET, - - PUT, - - DELETE, - - UNKNOWN - } - - public interface Visitor { - T visitPost(); - - T visitGet(); - - T visitPut(); - - T visitDelete(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/types/ListenV1Channels.java b/src/main/java/types/ListenV1Channels.java deleted file mode 100644 index 5a34ae3..0000000 --- a/src/main/java/types/ListenV1Channels.java +++ /dev/null @@ -1,41 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import core.WrappedAlias; - -public final class ListenV1Channels implements WrappedAlias { - private final Object value; - - private ListenV1Channels(Object value) { - this.value = value; - } - - @JsonValue - public Object get() { - return this.value; - } - - @java.lang.Override - public boolean equals(Object other) { - return this == other - || (other instanceof ListenV1Channels - && this.value.equals(((ListenV1Channels) other).value)); - } - - @java.lang.Override - public int hashCode() { - return value.hashCode(); - } - - @java.lang.Override - public String toString() { - return value.toString(); - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListenV1Channels of(Object value) { - return new ListenV1Channels(value); - } -} diff --git a/src/main/java/types/ListenV1DetectEntities.java b/src/main/java/types/ListenV1DetectEntities.java deleted file mode 100644 index 1eca3e2..0000000 --- a/src/main/java/types/ListenV1DetectEntities.java +++ /dev/null @@ -1,83 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class ListenV1DetectEntities { - public static final ListenV1DetectEntities FALSE = - new ListenV1DetectEntities(Value.FALSE, "false"); - - public static final ListenV1DetectEntities TRUE = new ListenV1DetectEntities(Value.TRUE, "true"); - - private final Value value; - - private final String string; - - ListenV1DetectEntities(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof ListenV1DetectEntities - && this.string.equals(((ListenV1DetectEntities) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case FALSE: - return visitor.visitFalse(); - case TRUE: - return visitor.visitTrue(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListenV1DetectEntities valueOf(String value) { - switch (value) { - case "false": - return FALSE; - case "true": - return TRUE; - default: - return new ListenV1DetectEntities(Value.UNKNOWN, value); - } - } - - public enum Value { - TRUE, - - FALSE, - - UNKNOWN - } - - public interface Visitor { - T visitTrue(); - - T visitFalse(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/types/ListenV1Diarize.java b/src/main/java/types/ListenV1Diarize.java deleted file mode 100644 index 4cda247..0000000 --- a/src/main/java/types/ListenV1Diarize.java +++ /dev/null @@ -1,82 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class ListenV1Diarize { - public static final ListenV1Diarize FALSE = new ListenV1Diarize(Value.FALSE, "false"); - - public static final ListenV1Diarize TRUE = new ListenV1Diarize(Value.TRUE, "true"); - - private final Value value; - - private final String string; - - ListenV1Diarize(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof ListenV1Diarize - && this.string.equals(((ListenV1Diarize) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case FALSE: - return visitor.visitFalse(); - case TRUE: - return visitor.visitTrue(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListenV1Diarize valueOf(String value) { - switch (value) { - case "false": - return FALSE; - case "true": - return TRUE; - default: - return new ListenV1Diarize(Value.UNKNOWN, value); - } - } - - public enum Value { - TRUE, - - FALSE, - - UNKNOWN - } - - public interface Visitor { - T visitTrue(); - - T visitFalse(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/types/ListenV1Dictation.java b/src/main/java/types/ListenV1Dictation.java deleted file mode 100644 index 32152dc..0000000 --- a/src/main/java/types/ListenV1Dictation.java +++ /dev/null @@ -1,82 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class ListenV1Dictation { - public static final ListenV1Dictation FALSE = new ListenV1Dictation(Value.FALSE, "false"); - - public static final ListenV1Dictation TRUE = new ListenV1Dictation(Value.TRUE, "true"); - - private final Value value; - - private final String string; - - ListenV1Dictation(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof ListenV1Dictation - && this.string.equals(((ListenV1Dictation) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case FALSE: - return visitor.visitFalse(); - case TRUE: - return visitor.visitTrue(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListenV1Dictation valueOf(String value) { - switch (value) { - case "false": - return FALSE; - case "true": - return TRUE; - default: - return new ListenV1Dictation(Value.UNKNOWN, value); - } - } - - public enum Value { - TRUE, - - FALSE, - - UNKNOWN - } - - public interface Visitor { - T visitTrue(); - - T visitFalse(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/types/ListenV1Encoding.java b/src/main/java/types/ListenV1Encoding.java deleted file mode 100644 index 3e17d21..0000000 --- a/src/main/java/types/ListenV1Encoding.java +++ /dev/null @@ -1,172 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class ListenV1Encoding { - public static final ListenV1Encoding MULAW = new ListenV1Encoding(Value.MULAW, "mulaw"); - - public static final ListenV1Encoding AMR_WB = new ListenV1Encoding(Value.AMR_WB, "amr-wb"); - - public static final ListenV1Encoding LINEAR32 = new ListenV1Encoding(Value.LINEAR32, "linear32"); - - public static final ListenV1Encoding OGG_OPUS = new ListenV1Encoding(Value.OGG_OPUS, "ogg-opus"); - - public static final ListenV1Encoding FLAC = new ListenV1Encoding(Value.FLAC, "flac"); - - public static final ListenV1Encoding SPEEX = new ListenV1Encoding(Value.SPEEX, "speex"); - - public static final ListenV1Encoding LINEAR16 = new ListenV1Encoding(Value.LINEAR16, "linear16"); - - public static final ListenV1Encoding OPUS = new ListenV1Encoding(Value.OPUS, "opus"); - - public static final ListenV1Encoding ALAW = new ListenV1Encoding(Value.ALAW, "alaw"); - - public static final ListenV1Encoding AMR_NB = new ListenV1Encoding(Value.AMR_NB, "amr-nb"); - - public static final ListenV1Encoding G729 = new ListenV1Encoding(Value.G729, "g729"); - - private final Value value; - - private final String string; - - ListenV1Encoding(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof ListenV1Encoding - && this.string.equals(((ListenV1Encoding) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case MULAW: - return visitor.visitMulaw(); - case AMR_WB: - return visitor.visitAmrWb(); - case LINEAR32: - return visitor.visitLinear32(); - case OGG_OPUS: - return visitor.visitOggOpus(); - case FLAC: - return visitor.visitFlac(); - case SPEEX: - return visitor.visitSpeex(); - case LINEAR16: - return visitor.visitLinear16(); - case OPUS: - return visitor.visitOpus(); - case ALAW: - return visitor.visitAlaw(); - case AMR_NB: - return visitor.visitAmrNb(); - case G729: - return visitor.visitG729(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListenV1Encoding valueOf(String value) { - switch (value) { - case "mulaw": - return MULAW; - case "amr-wb": - return AMR_WB; - case "linear32": - return LINEAR32; - case "ogg-opus": - return OGG_OPUS; - case "flac": - return FLAC; - case "speex": - return SPEEX; - case "linear16": - return LINEAR16; - case "opus": - return OPUS; - case "alaw": - return ALAW; - case "amr-nb": - return AMR_NB; - case "g729": - return G729; - default: - return new ListenV1Encoding(Value.UNKNOWN, value); - } - } - - public enum Value { - LINEAR16, - - LINEAR32, - - FLAC, - - ALAW, - - MULAW, - - AMR_NB, - - AMR_WB, - - OPUS, - - OGG_OPUS, - - SPEEX, - - G729, - - UNKNOWN - } - - public interface Visitor { - T visitLinear16(); - - T visitLinear32(); - - T visitFlac(); - - T visitAlaw(); - - T visitMulaw(); - - T visitAmrNb(); - - T visitAmrWb(); - - T visitOpus(); - - T visitOggOpus(); - - T visitSpeex(); - - T visitG729(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/types/ListenV1Endpointing.java b/src/main/java/types/ListenV1Endpointing.java deleted file mode 100644 index 4e13232..0000000 --- a/src/main/java/types/ListenV1Endpointing.java +++ /dev/null @@ -1,41 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import core.WrappedAlias; - -public final class ListenV1Endpointing implements WrappedAlias { - private final Object value; - - private ListenV1Endpointing(Object value) { - this.value = value; - } - - @JsonValue - public Object get() { - return this.value; - } - - @java.lang.Override - public boolean equals(Object other) { - return this == other - || (other instanceof ListenV1Endpointing - && this.value.equals(((ListenV1Endpointing) other).value)); - } - - @java.lang.Override - public int hashCode() { - return value.hashCode(); - } - - @java.lang.Override - public String toString() { - return value.toString(); - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListenV1Endpointing of(Object value) { - return new ListenV1Endpointing(value); - } -} diff --git a/src/main/java/types/ListenV1Extra.java b/src/main/java/types/ListenV1Extra.java deleted file mode 100644 index f20bbc5..0000000 --- a/src/main/java/types/ListenV1Extra.java +++ /dev/null @@ -1,40 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import core.WrappedAlias; - -public final class ListenV1Extra implements WrappedAlias { - private final Object value; - - private ListenV1Extra(Object value) { - this.value = value; - } - - @JsonValue - public Object get() { - return this.value; - } - - @java.lang.Override - public boolean equals(Object other) { - return this == other - || (other instanceof ListenV1Extra && this.value.equals(((ListenV1Extra) other).value)); - } - - @java.lang.Override - public int hashCode() { - return value.hashCode(); - } - - @java.lang.Override - public String toString() { - return value.toString(); - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListenV1Extra of(Object value) { - return new ListenV1Extra(value); - } -} diff --git a/src/main/java/types/ListenV1InterimResults.java b/src/main/java/types/ListenV1InterimResults.java deleted file mode 100644 index e3c88a8..0000000 --- a/src/main/java/types/ListenV1InterimResults.java +++ /dev/null @@ -1,83 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class ListenV1InterimResults { - public static final ListenV1InterimResults FALSE = - new ListenV1InterimResults(Value.FALSE, "false"); - - public static final ListenV1InterimResults TRUE = new ListenV1InterimResults(Value.TRUE, "true"); - - private final Value value; - - private final String string; - - ListenV1InterimResults(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof ListenV1InterimResults - && this.string.equals(((ListenV1InterimResults) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case FALSE: - return visitor.visitFalse(); - case TRUE: - return visitor.visitTrue(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListenV1InterimResults valueOf(String value) { - switch (value) { - case "false": - return FALSE; - case "true": - return TRUE; - default: - return new ListenV1InterimResults(Value.UNKNOWN, value); - } - } - - public enum Value { - TRUE, - - FALSE, - - UNKNOWN - } - - public interface Visitor { - T visitTrue(); - - T visitFalse(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/types/ListenV1Keyterm.java b/src/main/java/types/ListenV1Keyterm.java deleted file mode 100644 index cd248c3..0000000 --- a/src/main/java/types/ListenV1Keyterm.java +++ /dev/null @@ -1,40 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import core.WrappedAlias; - -public final class ListenV1Keyterm implements WrappedAlias { - private final Object value; - - private ListenV1Keyterm(Object value) { - this.value = value; - } - - @JsonValue - public Object get() { - return this.value; - } - - @java.lang.Override - public boolean equals(Object other) { - return this == other - || (other instanceof ListenV1Keyterm && this.value.equals(((ListenV1Keyterm) other).value)); - } - - @java.lang.Override - public int hashCode() { - return value.hashCode(); - } - - @java.lang.Override - public String toString() { - return value.toString(); - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListenV1Keyterm of(Object value) { - return new ListenV1Keyterm(value); - } -} diff --git a/src/main/java/types/ListenV1Keywords.java b/src/main/java/types/ListenV1Keywords.java deleted file mode 100644 index f97d92b..0000000 --- a/src/main/java/types/ListenV1Keywords.java +++ /dev/null @@ -1,41 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import core.WrappedAlias; - -public final class ListenV1Keywords implements WrappedAlias { - private final Object value; - - private ListenV1Keywords(Object value) { - this.value = value; - } - - @JsonValue - public Object get() { - return this.value; - } - - @java.lang.Override - public boolean equals(Object other) { - return this == other - || (other instanceof ListenV1Keywords - && this.value.equals(((ListenV1Keywords) other).value)); - } - - @java.lang.Override - public int hashCode() { - return value.hashCode(); - } - - @java.lang.Override - public String toString() { - return value.toString(); - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListenV1Keywords of(Object value) { - return new ListenV1Keywords(value); - } -} diff --git a/src/main/java/types/ListenV1Language.java b/src/main/java/types/ListenV1Language.java deleted file mode 100644 index aac60fc..0000000 --- a/src/main/java/types/ListenV1Language.java +++ /dev/null @@ -1,41 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import core.WrappedAlias; - -public final class ListenV1Language implements WrappedAlias { - private final Object value; - - private ListenV1Language(Object value) { - this.value = value; - } - - @JsonValue - public Object get() { - return this.value; - } - - @java.lang.Override - public boolean equals(Object other) { - return this == other - || (other instanceof ListenV1Language - && this.value.equals(((ListenV1Language) other).value)); - } - - @java.lang.Override - public int hashCode() { - return value.hashCode(); - } - - @java.lang.Override - public String toString() { - return value.toString(); - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListenV1Language of(Object value) { - return new ListenV1Language(value); - } -} diff --git a/src/main/java/types/ListenV1MipOptOut.java b/src/main/java/types/ListenV1MipOptOut.java deleted file mode 100644 index 1213cea..0000000 --- a/src/main/java/types/ListenV1MipOptOut.java +++ /dev/null @@ -1,41 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import core.WrappedAlias; - -public final class ListenV1MipOptOut implements WrappedAlias { - private final Object value; - - private ListenV1MipOptOut(Object value) { - this.value = value; - } - - @JsonValue - public Object get() { - return this.value; - } - - @java.lang.Override - public boolean equals(Object other) { - return this == other - || (other instanceof ListenV1MipOptOut - && this.value.equals(((ListenV1MipOptOut) other).value)); - } - - @java.lang.Override - public int hashCode() { - return value.hashCode(); - } - - @java.lang.Override - public String toString() { - return value.toString(); - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListenV1MipOptOut of(Object value) { - return new ListenV1MipOptOut(value); - } -} diff --git a/src/main/java/types/ListenV1Model.java b/src/main/java/types/ListenV1Model.java deleted file mode 100644 index 3108a88..0000000 --- a/src/main/java/types/ListenV1Model.java +++ /dev/null @@ -1,380 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class ListenV1Model { - public static final ListenV1Model NOVA2VOICEMAIL = - new ListenV1Model(Value.NOVA2VOICEMAIL, "nova-2-voicemail"); - - public static final ListenV1Model NOVA3 = new ListenV1Model(Value.NOVA3, "nova-3"); - - public static final ListenV1Model FINANCE = new ListenV1Model(Value.FINANCE, "finance"); - - public static final ListenV1Model NOVA_MEDICAL = - new ListenV1Model(Value.NOVA_MEDICAL, "nova-medical"); - - public static final ListenV1Model ENHANCED_GENERAL = - new ListenV1Model(Value.ENHANCED_GENERAL, "enhanced-general"); - - public static final ListenV1Model NOVA_GENERAL = - new ListenV1Model(Value.NOVA_GENERAL, "nova-general"); - - public static final ListenV1Model NOVA3MEDICAL = - new ListenV1Model(Value.NOVA3MEDICAL, "nova-3-medical"); - - public static final ListenV1Model NOVA2 = new ListenV1Model(Value.NOVA2, "nova-2"); - - public static final ListenV1Model VOICEMAIL = new ListenV1Model(Value.VOICEMAIL, "voicemail"); - - public static final ListenV1Model ENHANCED_FINANCE = - new ListenV1Model(Value.ENHANCED_FINANCE, "enhanced-finance"); - - public static final ListenV1Model NOVA2FINANCE = - new ListenV1Model(Value.NOVA2FINANCE, "nova-2-finance"); - - public static final ListenV1Model MEETING = new ListenV1Model(Value.MEETING, "meeting"); - - public static final ListenV1Model PHONECALL = new ListenV1Model(Value.PHONECALL, "phonecall"); - - public static final ListenV1Model NOVA2CONVERSATIONALAI = - new ListenV1Model(Value.NOVA2CONVERSATIONALAI, "nova-2-conversationalai"); - - public static final ListenV1Model VIDEO = new ListenV1Model(Value.VIDEO, "video"); - - public static final ListenV1Model CONVERSATIONALAI = - new ListenV1Model(Value.CONVERSATIONALAI, "conversationalai"); - - public static final ListenV1Model NOVA2VIDEO = - new ListenV1Model(Value.NOVA2VIDEO, "nova-2-video"); - - public static final ListenV1Model NOVA2DRIVETHRU = - new ListenV1Model(Value.NOVA2DRIVETHRU, "nova-2-drivethru"); - - public static final ListenV1Model BASE = new ListenV1Model(Value.BASE, "base"); - - public static final ListenV1Model NOVA2GENERAL = - new ListenV1Model(Value.NOVA2GENERAL, "nova-2-general"); - - public static final ListenV1Model NOVA = new ListenV1Model(Value.NOVA, "nova"); - - public static final ListenV1Model ENHANCED_PHONECALL = - new ListenV1Model(Value.ENHANCED_PHONECALL, "enhanced-phonecall"); - - public static final ListenV1Model NOVA2MEDICAL = - new ListenV1Model(Value.NOVA2MEDICAL, "nova-2-medical"); - - public static final ListenV1Model CUSTOM = new ListenV1Model(Value.CUSTOM, "custom"); - - public static final ListenV1Model NOVA3GENERAL = - new ListenV1Model(Value.NOVA3GENERAL, "nova-3-general"); - - public static final ListenV1Model ENHANCED = new ListenV1Model(Value.ENHANCED, "enhanced"); - - public static final ListenV1Model NOVA_PHONECALL = - new ListenV1Model(Value.NOVA_PHONECALL, "nova-phonecall"); - - public static final ListenV1Model NOVA2MEETING = - new ListenV1Model(Value.NOVA2MEETING, "nova-2-meeting"); - - public static final ListenV1Model NOVA2AUTOMOTIVE = - new ListenV1Model(Value.NOVA2AUTOMOTIVE, "nova-2-automotive"); - - public static final ListenV1Model ENHANCED_MEETING = - new ListenV1Model(Value.ENHANCED_MEETING, "enhanced-meeting"); - - private final Value value; - - private final String string; - - ListenV1Model(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof ListenV1Model && this.string.equals(((ListenV1Model) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case NOVA2VOICEMAIL: - return visitor.visitNova2Voicemail(); - case NOVA3: - return visitor.visitNova3(); - case FINANCE: - return visitor.visitFinance(); - case NOVA_MEDICAL: - return visitor.visitNovaMedical(); - case ENHANCED_GENERAL: - return visitor.visitEnhancedGeneral(); - case NOVA_GENERAL: - return visitor.visitNovaGeneral(); - case NOVA3MEDICAL: - return visitor.visitNova3Medical(); - case NOVA2: - return visitor.visitNova2(); - case VOICEMAIL: - return visitor.visitVoicemail(); - case ENHANCED_FINANCE: - return visitor.visitEnhancedFinance(); - case NOVA2FINANCE: - return visitor.visitNova2Finance(); - case MEETING: - return visitor.visitMeeting(); - case PHONECALL: - return visitor.visitPhonecall(); - case NOVA2CONVERSATIONALAI: - return visitor.visitNova2Conversationalai(); - case VIDEO: - return visitor.visitVideo(); - case CONVERSATIONALAI: - return visitor.visitConversationalai(); - case NOVA2VIDEO: - return visitor.visitNova2Video(); - case NOVA2DRIVETHRU: - return visitor.visitNova2Drivethru(); - case BASE: - return visitor.visitBase(); - case NOVA2GENERAL: - return visitor.visitNova2General(); - case NOVA: - return visitor.visitNova(); - case ENHANCED_PHONECALL: - return visitor.visitEnhancedPhonecall(); - case NOVA2MEDICAL: - return visitor.visitNova2Medical(); - case CUSTOM: - return visitor.visitCustom(); - case NOVA3GENERAL: - return visitor.visitNova3General(); - case ENHANCED: - return visitor.visitEnhanced(); - case NOVA_PHONECALL: - return visitor.visitNovaPhonecall(); - case NOVA2MEETING: - return visitor.visitNova2Meeting(); - case NOVA2AUTOMOTIVE: - return visitor.visitNova2Automotive(); - case ENHANCED_MEETING: - return visitor.visitEnhancedMeeting(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListenV1Model valueOf(String value) { - switch (value) { - case "nova-2-voicemail": - return NOVA2VOICEMAIL; - case "nova-3": - return NOVA3; - case "finance": - return FINANCE; - case "nova-medical": - return NOVA_MEDICAL; - case "enhanced-general": - return ENHANCED_GENERAL; - case "nova-general": - return NOVA_GENERAL; - case "nova-3-medical": - return NOVA3MEDICAL; - case "nova-2": - return NOVA2; - case "voicemail": - return VOICEMAIL; - case "enhanced-finance": - return ENHANCED_FINANCE; - case "nova-2-finance": - return NOVA2FINANCE; - case "meeting": - return MEETING; - case "phonecall": - return PHONECALL; - case "nova-2-conversationalai": - return NOVA2CONVERSATIONALAI; - case "video": - return VIDEO; - case "conversationalai": - return CONVERSATIONALAI; - case "nova-2-video": - return NOVA2VIDEO; - case "nova-2-drivethru": - return NOVA2DRIVETHRU; - case "base": - return BASE; - case "nova-2-general": - return NOVA2GENERAL; - case "nova": - return NOVA; - case "enhanced-phonecall": - return ENHANCED_PHONECALL; - case "nova-2-medical": - return NOVA2MEDICAL; - case "custom": - return CUSTOM; - case "nova-3-general": - return NOVA3GENERAL; - case "enhanced": - return ENHANCED; - case "nova-phonecall": - return NOVA_PHONECALL; - case "nova-2-meeting": - return NOVA2MEETING; - case "nova-2-automotive": - return NOVA2AUTOMOTIVE; - case "enhanced-meeting": - return ENHANCED_MEETING; - default: - return new ListenV1Model(Value.UNKNOWN, value); - } - } - - public enum Value { - NOVA3, - - NOVA3GENERAL, - - NOVA3MEDICAL, - - NOVA2, - - NOVA2GENERAL, - - NOVA2MEETING, - - NOVA2FINANCE, - - NOVA2CONVERSATIONALAI, - - NOVA2VOICEMAIL, - - NOVA2VIDEO, - - NOVA2MEDICAL, - - NOVA2DRIVETHRU, - - NOVA2AUTOMOTIVE, - - NOVA, - - NOVA_GENERAL, - - NOVA_PHONECALL, - - NOVA_MEDICAL, - - ENHANCED, - - ENHANCED_GENERAL, - - ENHANCED_MEETING, - - ENHANCED_PHONECALL, - - ENHANCED_FINANCE, - - BASE, - - MEETING, - - PHONECALL, - - FINANCE, - - CONVERSATIONALAI, - - VOICEMAIL, - - VIDEO, - - CUSTOM, - - UNKNOWN - } - - public interface Visitor { - T visitNova3(); - - T visitNova3General(); - - T visitNova3Medical(); - - T visitNova2(); - - T visitNova2General(); - - T visitNova2Meeting(); - - T visitNova2Finance(); - - T visitNova2Conversationalai(); - - T visitNova2Voicemail(); - - T visitNova2Video(); - - T visitNova2Medical(); - - T visitNova2Drivethru(); - - T visitNova2Automotive(); - - T visitNova(); - - T visitNovaGeneral(); - - T visitNovaPhonecall(); - - T visitNovaMedical(); - - T visitEnhanced(); - - T visitEnhancedGeneral(); - - T visitEnhancedMeeting(); - - T visitEnhancedPhonecall(); - - T visitEnhancedFinance(); - - T visitBase(); - - T visitMeeting(); - - T visitPhonecall(); - - T visitFinance(); - - T visitConversationalai(); - - T visitVoicemail(); - - T visitVideo(); - - T visitCustom(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/types/ListenV1Multichannel.java b/src/main/java/types/ListenV1Multichannel.java deleted file mode 100644 index 8a88326..0000000 --- a/src/main/java/types/ListenV1Multichannel.java +++ /dev/null @@ -1,82 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class ListenV1Multichannel { - public static final ListenV1Multichannel FALSE = new ListenV1Multichannel(Value.FALSE, "false"); - - public static final ListenV1Multichannel TRUE = new ListenV1Multichannel(Value.TRUE, "true"); - - private final Value value; - - private final String string; - - ListenV1Multichannel(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof ListenV1Multichannel - && this.string.equals(((ListenV1Multichannel) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case FALSE: - return visitor.visitFalse(); - case TRUE: - return visitor.visitTrue(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListenV1Multichannel valueOf(String value) { - switch (value) { - case "false": - return FALSE; - case "true": - return TRUE; - default: - return new ListenV1Multichannel(Value.UNKNOWN, value); - } - } - - public enum Value { - TRUE, - - FALSE, - - UNKNOWN - } - - public interface Visitor { - T visitTrue(); - - T visitFalse(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/types/ListenV1Numerals.java b/src/main/java/types/ListenV1Numerals.java deleted file mode 100644 index 2548b57..0000000 --- a/src/main/java/types/ListenV1Numerals.java +++ /dev/null @@ -1,82 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class ListenV1Numerals { - public static final ListenV1Numerals FALSE = new ListenV1Numerals(Value.FALSE, "false"); - - public static final ListenV1Numerals TRUE = new ListenV1Numerals(Value.TRUE, "true"); - - private final Value value; - - private final String string; - - ListenV1Numerals(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof ListenV1Numerals - && this.string.equals(((ListenV1Numerals) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case FALSE: - return visitor.visitFalse(); - case TRUE: - return visitor.visitTrue(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListenV1Numerals valueOf(String value) { - switch (value) { - case "false": - return FALSE; - case "true": - return TRUE; - default: - return new ListenV1Numerals(Value.UNKNOWN, value); - } - } - - public enum Value { - TRUE, - - FALSE, - - UNKNOWN - } - - public interface Visitor { - T visitTrue(); - - T visitFalse(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/types/ListenV1ProfanityFilter.java b/src/main/java/types/ListenV1ProfanityFilter.java deleted file mode 100644 index 2e53456..0000000 --- a/src/main/java/types/ListenV1ProfanityFilter.java +++ /dev/null @@ -1,84 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class ListenV1ProfanityFilter { - public static final ListenV1ProfanityFilter FALSE = - new ListenV1ProfanityFilter(Value.FALSE, "false"); - - public static final ListenV1ProfanityFilter TRUE = - new ListenV1ProfanityFilter(Value.TRUE, "true"); - - private final Value value; - - private final String string; - - ListenV1ProfanityFilter(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof ListenV1ProfanityFilter - && this.string.equals(((ListenV1ProfanityFilter) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case FALSE: - return visitor.visitFalse(); - case TRUE: - return visitor.visitTrue(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListenV1ProfanityFilter valueOf(String value) { - switch (value) { - case "false": - return FALSE; - case "true": - return TRUE; - default: - return new ListenV1ProfanityFilter(Value.UNKNOWN, value); - } - } - - public enum Value { - TRUE, - - FALSE, - - UNKNOWN - } - - public interface Visitor { - T visitTrue(); - - T visitFalse(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/types/ListenV1Punctuate.java b/src/main/java/types/ListenV1Punctuate.java deleted file mode 100644 index b91b942..0000000 --- a/src/main/java/types/ListenV1Punctuate.java +++ /dev/null @@ -1,82 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class ListenV1Punctuate { - public static final ListenV1Punctuate FALSE = new ListenV1Punctuate(Value.FALSE, "false"); - - public static final ListenV1Punctuate TRUE = new ListenV1Punctuate(Value.TRUE, "true"); - - private final Value value; - - private final String string; - - ListenV1Punctuate(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof ListenV1Punctuate - && this.string.equals(((ListenV1Punctuate) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case FALSE: - return visitor.visitFalse(); - case TRUE: - return visitor.visitTrue(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListenV1Punctuate valueOf(String value) { - switch (value) { - case "false": - return FALSE; - case "true": - return TRUE; - default: - return new ListenV1Punctuate(Value.UNKNOWN, value); - } - } - - public enum Value { - TRUE, - - FALSE, - - UNKNOWN - } - - public interface Visitor { - T visitTrue(); - - T visitFalse(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/types/ListenV1Redact.java b/src/main/java/types/ListenV1Redact.java deleted file mode 100644 index 3eaca51..0000000 --- a/src/main/java/types/ListenV1Redact.java +++ /dev/null @@ -1,122 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class ListenV1Redact { - public static final ListenV1Redact FALSE = new ListenV1Redact(Value.FALSE, "false"); - - public static final ListenV1Redact SSN = new ListenV1Redact(Value.SSN, "ssn"); - - public static final ListenV1Redact TRUE = new ListenV1Redact(Value.TRUE, "true"); - - public static final ListenV1Redact NUMBERS = new ListenV1Redact(Value.NUMBERS, "numbers"); - - public static final ListenV1Redact AGGRESSIVE_NUMBERS = - new ListenV1Redact(Value.AGGRESSIVE_NUMBERS, "aggressive_numbers"); - - public static final ListenV1Redact PCI = new ListenV1Redact(Value.PCI, "pci"); - - private final Value value; - - private final String string; - - ListenV1Redact(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof ListenV1Redact && this.string.equals(((ListenV1Redact) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case FALSE: - return visitor.visitFalse(); - case SSN: - return visitor.visitSsn(); - case TRUE: - return visitor.visitTrue(); - case NUMBERS: - return visitor.visitNumbers(); - case AGGRESSIVE_NUMBERS: - return visitor.visitAggressiveNumbers(); - case PCI: - return visitor.visitPci(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListenV1Redact valueOf(String value) { - switch (value) { - case "false": - return FALSE; - case "ssn": - return SSN; - case "true": - return TRUE; - case "numbers": - return NUMBERS; - case "aggressive_numbers": - return AGGRESSIVE_NUMBERS; - case "pci": - return PCI; - default: - return new ListenV1Redact(Value.UNKNOWN, value); - } - } - - public enum Value { - TRUE, - - FALSE, - - PCI, - - NUMBERS, - - AGGRESSIVE_NUMBERS, - - SSN, - - UNKNOWN - } - - public interface Visitor { - T visitTrue(); - - T visitFalse(); - - T visitPci(); - - T visitNumbers(); - - T visitAggressiveNumbers(); - - T visitSsn(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/types/ListenV1Replace.java b/src/main/java/types/ListenV1Replace.java deleted file mode 100644 index 8017b7d..0000000 --- a/src/main/java/types/ListenV1Replace.java +++ /dev/null @@ -1,40 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import core.WrappedAlias; - -public final class ListenV1Replace implements WrappedAlias { - private final Object value; - - private ListenV1Replace(Object value) { - this.value = value; - } - - @JsonValue - public Object get() { - return this.value; - } - - @java.lang.Override - public boolean equals(Object other) { - return this == other - || (other instanceof ListenV1Replace && this.value.equals(((ListenV1Replace) other).value)); - } - - @java.lang.Override - public int hashCode() { - return value.hashCode(); - } - - @java.lang.Override - public String toString() { - return value.toString(); - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListenV1Replace of(Object value) { - return new ListenV1Replace(value); - } -} diff --git a/src/main/java/types/ListenV1Response.java b/src/main/java/types/ListenV1Response.java deleted file mode 100644 index 23452bf..0000000 --- a/src/main/java/types/ListenV1Response.java +++ /dev/null @@ -1,140 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListenV1Response.Builder.class) -public final class ListenV1Response { - private final ListenV1ResponseMetadata metadata; - - private final ListenV1ResponseResults results; - - private final Map additionalProperties; - - private ListenV1Response( - ListenV1ResponseMetadata metadata, - ListenV1ResponseResults results, - Map additionalProperties) { - this.metadata = metadata; - this.results = results; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("metadata") - public ListenV1ResponseMetadata getMetadata() { - return metadata; - } - - @JsonProperty("results") - public ListenV1ResponseResults getResults() { - return results; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListenV1Response && equalTo((ListenV1Response) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListenV1Response other) { - return metadata.equals(other.metadata) && results.equals(other.results); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.metadata, this.results); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static MetadataStage builder() { - return new Builder(); - } - - public interface MetadataStage { - ResultsStage metadata(@NotNull ListenV1ResponseMetadata metadata); - - Builder from(ListenV1Response other); - } - - public interface ResultsStage { - _FinalStage results(@NotNull ListenV1ResponseResults results); - } - - public interface _FinalStage { - ListenV1Response build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements MetadataStage, ResultsStage, _FinalStage { - private ListenV1ResponseMetadata metadata; - - private ListenV1ResponseResults results; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(ListenV1Response other) { - metadata(other.getMetadata()); - results(other.getResults()); - return this; - } - - @java.lang.Override - @JsonSetter("metadata") - public ResultsStage metadata(@NotNull ListenV1ResponseMetadata metadata) { - this.metadata = Objects.requireNonNull(metadata, "metadata must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("results") - public _FinalStage results(@NotNull ListenV1ResponseResults results) { - this.results = Objects.requireNonNull(results, "results must not be null"); - return this; - } - - @java.lang.Override - public ListenV1Response build() { - return new ListenV1Response(metadata, results, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListenV1ResponseMetadata.java b/src/main/java/types/ListenV1ResponseMetadata.java deleted file mode 100644 index a85fe68..0000000 --- a/src/main/java/types/ListenV1ResponseMetadata.java +++ /dev/null @@ -1,519 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 core.ObjectMappers; -import java.time.OffsetDateTime; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedHashMap; -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 = ListenV1ResponseMetadata.Builder.class) -public final class ListenV1ResponseMetadata { - private final Optional transactionKey; - - private final String requestId; - - private final String sha256; - - private final OffsetDateTime created; - - private final double duration; - - private final double channels; - - private final List models; - - private final Map modelInfo; - - private final Optional summaryInfo; - - private final Optional sentimentInfo; - - private final Optional topicsInfo; - - private final Optional intentsInfo; - - private final Optional> tags; - - private final Map additionalProperties; - - private ListenV1ResponseMetadata( - Optional transactionKey, - String requestId, - String sha256, - OffsetDateTime created, - double duration, - double channels, - List models, - Map modelInfo, - Optional summaryInfo, - Optional sentimentInfo, - Optional topicsInfo, - Optional intentsInfo, - Optional> tags, - Map additionalProperties) { - this.transactionKey = transactionKey; - this.requestId = requestId; - this.sha256 = sha256; - this.created = created; - this.duration = duration; - this.channels = channels; - this.models = models; - this.modelInfo = modelInfo; - this.summaryInfo = summaryInfo; - this.sentimentInfo = sentimentInfo; - this.topicsInfo = topicsInfo; - this.intentsInfo = intentsInfo; - this.tags = tags; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("transaction_key") - public Optional getTransactionKey() { - return transactionKey; - } - - @JsonProperty("request_id") - public String getRequestId() { - return requestId; - } - - @JsonProperty("sha256") - public String getSha256() { - return sha256; - } - - @JsonProperty("created") - public OffsetDateTime getCreated() { - return created; - } - - @JsonProperty("duration") - public double getDuration() { - return duration; - } - - @JsonProperty("channels") - public double getChannels() { - return channels; - } - - @JsonProperty("models") - public List getModels() { - return models; - } - - @JsonProperty("model_info") - public Map getModelInfo() { - return modelInfo; - } - - @JsonProperty("summary_info") - public Optional getSummaryInfo() { - return summaryInfo; - } - - @JsonProperty("sentiment_info") - public Optional getSentimentInfo() { - return sentimentInfo; - } - - @JsonProperty("topics_info") - public Optional getTopicsInfo() { - return topicsInfo; - } - - @JsonProperty("intents_info") - public Optional getIntentsInfo() { - return intentsInfo; - } - - @JsonProperty("tags") - public Optional> getTags() { - return tags; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListenV1ResponseMetadata && equalTo((ListenV1ResponseMetadata) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListenV1ResponseMetadata other) { - return transactionKey.equals(other.transactionKey) - && requestId.equals(other.requestId) - && sha256.equals(other.sha256) - && created.equals(other.created) - && duration == other.duration - && channels == other.channels - && models.equals(other.models) - && modelInfo.equals(other.modelInfo) - && summaryInfo.equals(other.summaryInfo) - && sentimentInfo.equals(other.sentimentInfo) - && topicsInfo.equals(other.topicsInfo) - && intentsInfo.equals(other.intentsInfo) - && tags.equals(other.tags); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.transactionKey, - this.requestId, - this.sha256, - this.created, - this.duration, - this.channels, - this.models, - this.modelInfo, - this.summaryInfo, - this.sentimentInfo, - this.topicsInfo, - this.intentsInfo, - this.tags); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static RequestIdStage builder() { - return new Builder(); - } - - public interface RequestIdStage { - Sha256Stage requestId(@NotNull String requestId); - - Builder from(ListenV1ResponseMetadata other); - } - - public interface Sha256Stage { - CreatedStage sha256(@NotNull String sha256); - } - - public interface CreatedStage { - DurationStage created(@NotNull OffsetDateTime created); - } - - public interface DurationStage { - ChannelsStage duration(double duration); - } - - public interface ChannelsStage { - _FinalStage channels(double channels); - } - - public interface _FinalStage { - ListenV1ResponseMetadata build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - _FinalStage transactionKey(Optional transactionKey); - - _FinalStage transactionKey(String transactionKey); - - _FinalStage models(List models); - - _FinalStage addModels(String models); - - _FinalStage addAllModels(List models); - - _FinalStage modelInfo(Map modelInfo); - - _FinalStage putAllModelInfo(Map modelInfo); - - _FinalStage modelInfo(String key, Object value); - - _FinalStage summaryInfo(Optional summaryInfo); - - _FinalStage summaryInfo(ListenV1ResponseMetadataSummaryInfo summaryInfo); - - _FinalStage sentimentInfo(Optional sentimentInfo); - - _FinalStage sentimentInfo(ListenV1ResponseMetadataSentimentInfo sentimentInfo); - - _FinalStage topicsInfo(Optional topicsInfo); - - _FinalStage topicsInfo(ListenV1ResponseMetadataTopicsInfo topicsInfo); - - _FinalStage intentsInfo(Optional intentsInfo); - - _FinalStage intentsInfo(ListenV1ResponseMetadataIntentsInfo intentsInfo); - - _FinalStage tags(Optional> tags); - - _FinalStage tags(List tags); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements RequestIdStage, - Sha256Stage, - CreatedStage, - DurationStage, - ChannelsStage, - _FinalStage { - private String requestId; - - private String sha256; - - private OffsetDateTime created; - - private double duration; - - private double channels; - - private Optional> tags = Optional.empty(); - - private Optional intentsInfo = Optional.empty(); - - private Optional topicsInfo = Optional.empty(); - - private Optional sentimentInfo = Optional.empty(); - - private Optional summaryInfo = Optional.empty(); - - private Map modelInfo = new LinkedHashMap<>(); - - private List models = new ArrayList<>(); - - private Optional transactionKey = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(ListenV1ResponseMetadata other) { - transactionKey(other.getTransactionKey()); - requestId(other.getRequestId()); - sha256(other.getSha256()); - created(other.getCreated()); - duration(other.getDuration()); - channels(other.getChannels()); - models(other.getModels()); - modelInfo(other.getModelInfo()); - summaryInfo(other.getSummaryInfo()); - sentimentInfo(other.getSentimentInfo()); - topicsInfo(other.getTopicsInfo()); - intentsInfo(other.getIntentsInfo()); - tags(other.getTags()); - return this; - } - - @java.lang.Override - @JsonSetter("request_id") - public Sha256Stage requestId(@NotNull String requestId) { - this.requestId = Objects.requireNonNull(requestId, "requestId must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("sha256") - public CreatedStage sha256(@NotNull String sha256) { - this.sha256 = Objects.requireNonNull(sha256, "sha256 must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("created") - public DurationStage created(@NotNull OffsetDateTime created) { - this.created = Objects.requireNonNull(created, "created must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("duration") - public ChannelsStage duration(double duration) { - this.duration = duration; - return this; - } - - @java.lang.Override - @JsonSetter("channels") - public _FinalStage channels(double channels) { - this.channels = channels; - return this; - } - - @java.lang.Override - public _FinalStage tags(List tags) { - this.tags = Optional.ofNullable(tags); - return this; - } - - @java.lang.Override - @JsonSetter(value = "tags", nulls = Nulls.SKIP) - public _FinalStage tags(Optional> tags) { - this.tags = tags; - return this; - } - - @java.lang.Override - public _FinalStage intentsInfo(ListenV1ResponseMetadataIntentsInfo intentsInfo) { - this.intentsInfo = Optional.ofNullable(intentsInfo); - return this; - } - - @java.lang.Override - @JsonSetter(value = "intents_info", nulls = Nulls.SKIP) - public _FinalStage intentsInfo(Optional intentsInfo) { - this.intentsInfo = intentsInfo; - return this; - } - - @java.lang.Override - public _FinalStage topicsInfo(ListenV1ResponseMetadataTopicsInfo topicsInfo) { - this.topicsInfo = Optional.ofNullable(topicsInfo); - return this; - } - - @java.lang.Override - @JsonSetter(value = "topics_info", nulls = Nulls.SKIP) - public _FinalStage topicsInfo(Optional topicsInfo) { - this.topicsInfo = topicsInfo; - return this; - } - - @java.lang.Override - public _FinalStage sentimentInfo(ListenV1ResponseMetadataSentimentInfo sentimentInfo) { - this.sentimentInfo = Optional.ofNullable(sentimentInfo); - return this; - } - - @java.lang.Override - @JsonSetter(value = "sentiment_info", nulls = Nulls.SKIP) - public _FinalStage sentimentInfo( - Optional sentimentInfo) { - this.sentimentInfo = sentimentInfo; - return this; - } - - @java.lang.Override - public _FinalStage summaryInfo(ListenV1ResponseMetadataSummaryInfo summaryInfo) { - this.summaryInfo = Optional.ofNullable(summaryInfo); - return this; - } - - @java.lang.Override - @JsonSetter(value = "summary_info", nulls = Nulls.SKIP) - public _FinalStage summaryInfo(Optional summaryInfo) { - this.summaryInfo = summaryInfo; - return this; - } - - @java.lang.Override - public _FinalStage modelInfo(String key, Object value) { - this.modelInfo.put(key, value); - return this; - } - - @java.lang.Override - public _FinalStage putAllModelInfo(Map modelInfo) { - if (modelInfo != null) { - this.modelInfo.putAll(modelInfo); - } - return this; - } - - @java.lang.Override - @JsonSetter(value = "model_info", nulls = Nulls.SKIP) - public _FinalStage modelInfo(Map modelInfo) { - this.modelInfo.clear(); - if (modelInfo != null) { - this.modelInfo.putAll(modelInfo); - } - return this; - } - - @java.lang.Override - public _FinalStage addAllModels(List models) { - if (models != null) { - this.models.addAll(models); - } - return this; - } - - @java.lang.Override - public _FinalStage addModels(String models) { - this.models.add(models); - return this; - } - - @java.lang.Override - @JsonSetter(value = "models", nulls = Nulls.SKIP) - public _FinalStage models(List models) { - this.models.clear(); - if (models != null) { - this.models.addAll(models); - } - return this; - } - - @java.lang.Override - public _FinalStage transactionKey(String transactionKey) { - this.transactionKey = Optional.ofNullable(transactionKey); - return this; - } - - @java.lang.Override - @JsonSetter(value = "transaction_key", nulls = Nulls.SKIP) - public _FinalStage transactionKey(Optional transactionKey) { - this.transactionKey = transactionKey; - return this; - } - - @java.lang.Override - public ListenV1ResponseMetadata build() { - return new ListenV1ResponseMetadata( - transactionKey, - requestId, - sha256, - created, - duration, - channels, - models, - modelInfo, - summaryInfo, - sentimentInfo, - topicsInfo, - intentsInfo, - tags, - additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListenV1ResponseMetadataIntentsInfo.java b/src/main/java/types/ListenV1ResponseMetadataIntentsInfo.java deleted file mode 100644 index 2e72b12..0000000 --- a/src/main/java/types/ListenV1ResponseMetadataIntentsInfo.java +++ /dev/null @@ -1,154 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListenV1ResponseMetadataIntentsInfo.Builder.class) -public final class ListenV1ResponseMetadataIntentsInfo { - private final Optional modelUuid; - - private final Optional inputTokens; - - private final Optional outputTokens; - - private final Map additionalProperties; - - private ListenV1ResponseMetadataIntentsInfo( - Optional modelUuid, - Optional inputTokens, - Optional outputTokens, - Map additionalProperties) { - this.modelUuid = modelUuid; - this.inputTokens = inputTokens; - this.outputTokens = outputTokens; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("model_uuid") - public Optional getModelUuid() { - return modelUuid; - } - - @JsonProperty("input_tokens") - public Optional getInputTokens() { - return inputTokens; - } - - @JsonProperty("output_tokens") - public Optional getOutputTokens() { - return outputTokens; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListenV1ResponseMetadataIntentsInfo - && equalTo((ListenV1ResponseMetadataIntentsInfo) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListenV1ResponseMetadataIntentsInfo other) { - return modelUuid.equals(other.modelUuid) - && inputTokens.equals(other.inputTokens) - && outputTokens.equals(other.outputTokens); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.modelUuid, this.inputTokens, this.outputTokens); - } - - @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 modelUuid = Optional.empty(); - - private Optional inputTokens = Optional.empty(); - - private Optional outputTokens = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListenV1ResponseMetadataIntentsInfo other) { - modelUuid(other.getModelUuid()); - inputTokens(other.getInputTokens()); - outputTokens(other.getOutputTokens()); - return this; - } - - @JsonSetter(value = "model_uuid", nulls = Nulls.SKIP) - public Builder modelUuid(Optional modelUuid) { - this.modelUuid = modelUuid; - return this; - } - - public Builder modelUuid(String modelUuid) { - this.modelUuid = Optional.ofNullable(modelUuid); - return this; - } - - @JsonSetter(value = "input_tokens", nulls = Nulls.SKIP) - public Builder inputTokens(Optional inputTokens) { - this.inputTokens = inputTokens; - return this; - } - - public Builder inputTokens(Double inputTokens) { - this.inputTokens = Optional.ofNullable(inputTokens); - return this; - } - - @JsonSetter(value = "output_tokens", nulls = Nulls.SKIP) - public Builder outputTokens(Optional outputTokens) { - this.outputTokens = outputTokens; - return this; - } - - public Builder outputTokens(Double outputTokens) { - this.outputTokens = Optional.ofNullable(outputTokens); - return this; - } - - public ListenV1ResponseMetadataIntentsInfo build() { - return new ListenV1ResponseMetadataIntentsInfo( - modelUuid, inputTokens, outputTokens, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListenV1ResponseMetadataSentimentInfo.java b/src/main/java/types/ListenV1ResponseMetadataSentimentInfo.java deleted file mode 100644 index 49d85ee..0000000 --- a/src/main/java/types/ListenV1ResponseMetadataSentimentInfo.java +++ /dev/null @@ -1,154 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListenV1ResponseMetadataSentimentInfo.Builder.class) -public final class ListenV1ResponseMetadataSentimentInfo { - private final Optional modelUuid; - - private final Optional inputTokens; - - private final Optional outputTokens; - - private final Map additionalProperties; - - private ListenV1ResponseMetadataSentimentInfo( - Optional modelUuid, - Optional inputTokens, - Optional outputTokens, - Map additionalProperties) { - this.modelUuid = modelUuid; - this.inputTokens = inputTokens; - this.outputTokens = outputTokens; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("model_uuid") - public Optional getModelUuid() { - return modelUuid; - } - - @JsonProperty("input_tokens") - public Optional getInputTokens() { - return inputTokens; - } - - @JsonProperty("output_tokens") - public Optional getOutputTokens() { - return outputTokens; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListenV1ResponseMetadataSentimentInfo - && equalTo((ListenV1ResponseMetadataSentimentInfo) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListenV1ResponseMetadataSentimentInfo other) { - return modelUuid.equals(other.modelUuid) - && inputTokens.equals(other.inputTokens) - && outputTokens.equals(other.outputTokens); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.modelUuid, this.inputTokens, this.outputTokens); - } - - @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 modelUuid = Optional.empty(); - - private Optional inputTokens = Optional.empty(); - - private Optional outputTokens = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListenV1ResponseMetadataSentimentInfo other) { - modelUuid(other.getModelUuid()); - inputTokens(other.getInputTokens()); - outputTokens(other.getOutputTokens()); - return this; - } - - @JsonSetter(value = "model_uuid", nulls = Nulls.SKIP) - public Builder modelUuid(Optional modelUuid) { - this.modelUuid = modelUuid; - return this; - } - - public Builder modelUuid(String modelUuid) { - this.modelUuid = Optional.ofNullable(modelUuid); - return this; - } - - @JsonSetter(value = "input_tokens", nulls = Nulls.SKIP) - public Builder inputTokens(Optional inputTokens) { - this.inputTokens = inputTokens; - return this; - } - - public Builder inputTokens(Double inputTokens) { - this.inputTokens = Optional.ofNullable(inputTokens); - return this; - } - - @JsonSetter(value = "output_tokens", nulls = Nulls.SKIP) - public Builder outputTokens(Optional outputTokens) { - this.outputTokens = outputTokens; - return this; - } - - public Builder outputTokens(Double outputTokens) { - this.outputTokens = Optional.ofNullable(outputTokens); - return this; - } - - public ListenV1ResponseMetadataSentimentInfo build() { - return new ListenV1ResponseMetadataSentimentInfo( - modelUuid, inputTokens, outputTokens, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListenV1ResponseMetadataSummaryInfo.java b/src/main/java/types/ListenV1ResponseMetadataSummaryInfo.java deleted file mode 100644 index 5096f7d..0000000 --- a/src/main/java/types/ListenV1ResponseMetadataSummaryInfo.java +++ /dev/null @@ -1,154 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListenV1ResponseMetadataSummaryInfo.Builder.class) -public final class ListenV1ResponseMetadataSummaryInfo { - private final Optional modelUuid; - - private final Optional inputTokens; - - private final Optional outputTokens; - - private final Map additionalProperties; - - private ListenV1ResponseMetadataSummaryInfo( - Optional modelUuid, - Optional inputTokens, - Optional outputTokens, - Map additionalProperties) { - this.modelUuid = modelUuid; - this.inputTokens = inputTokens; - this.outputTokens = outputTokens; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("model_uuid") - public Optional getModelUuid() { - return modelUuid; - } - - @JsonProperty("input_tokens") - public Optional getInputTokens() { - return inputTokens; - } - - @JsonProperty("output_tokens") - public Optional getOutputTokens() { - return outputTokens; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListenV1ResponseMetadataSummaryInfo - && equalTo((ListenV1ResponseMetadataSummaryInfo) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListenV1ResponseMetadataSummaryInfo other) { - return modelUuid.equals(other.modelUuid) - && inputTokens.equals(other.inputTokens) - && outputTokens.equals(other.outputTokens); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.modelUuid, this.inputTokens, this.outputTokens); - } - - @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 modelUuid = Optional.empty(); - - private Optional inputTokens = Optional.empty(); - - private Optional outputTokens = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListenV1ResponseMetadataSummaryInfo other) { - modelUuid(other.getModelUuid()); - inputTokens(other.getInputTokens()); - outputTokens(other.getOutputTokens()); - return this; - } - - @JsonSetter(value = "model_uuid", nulls = Nulls.SKIP) - public Builder modelUuid(Optional modelUuid) { - this.modelUuid = modelUuid; - return this; - } - - public Builder modelUuid(String modelUuid) { - this.modelUuid = Optional.ofNullable(modelUuid); - return this; - } - - @JsonSetter(value = "input_tokens", nulls = Nulls.SKIP) - public Builder inputTokens(Optional inputTokens) { - this.inputTokens = inputTokens; - return this; - } - - public Builder inputTokens(Double inputTokens) { - this.inputTokens = Optional.ofNullable(inputTokens); - return this; - } - - @JsonSetter(value = "output_tokens", nulls = Nulls.SKIP) - public Builder outputTokens(Optional outputTokens) { - this.outputTokens = outputTokens; - return this; - } - - public Builder outputTokens(Double outputTokens) { - this.outputTokens = Optional.ofNullable(outputTokens); - return this; - } - - public ListenV1ResponseMetadataSummaryInfo build() { - return new ListenV1ResponseMetadataSummaryInfo( - modelUuid, inputTokens, outputTokens, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListenV1ResponseMetadataTopicsInfo.java b/src/main/java/types/ListenV1ResponseMetadataTopicsInfo.java deleted file mode 100644 index 1e52bc2..0000000 --- a/src/main/java/types/ListenV1ResponseMetadataTopicsInfo.java +++ /dev/null @@ -1,154 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListenV1ResponseMetadataTopicsInfo.Builder.class) -public final class ListenV1ResponseMetadataTopicsInfo { - private final Optional modelUuid; - - private final Optional inputTokens; - - private final Optional outputTokens; - - private final Map additionalProperties; - - private ListenV1ResponseMetadataTopicsInfo( - Optional modelUuid, - Optional inputTokens, - Optional outputTokens, - Map additionalProperties) { - this.modelUuid = modelUuid; - this.inputTokens = inputTokens; - this.outputTokens = outputTokens; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("model_uuid") - public Optional getModelUuid() { - return modelUuid; - } - - @JsonProperty("input_tokens") - public Optional getInputTokens() { - return inputTokens; - } - - @JsonProperty("output_tokens") - public Optional getOutputTokens() { - return outputTokens; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListenV1ResponseMetadataTopicsInfo - && equalTo((ListenV1ResponseMetadataTopicsInfo) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListenV1ResponseMetadataTopicsInfo other) { - return modelUuid.equals(other.modelUuid) - && inputTokens.equals(other.inputTokens) - && outputTokens.equals(other.outputTokens); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.modelUuid, this.inputTokens, this.outputTokens); - } - - @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 modelUuid = Optional.empty(); - - private Optional inputTokens = Optional.empty(); - - private Optional outputTokens = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListenV1ResponseMetadataTopicsInfo other) { - modelUuid(other.getModelUuid()); - inputTokens(other.getInputTokens()); - outputTokens(other.getOutputTokens()); - return this; - } - - @JsonSetter(value = "model_uuid", nulls = Nulls.SKIP) - public Builder modelUuid(Optional modelUuid) { - this.modelUuid = modelUuid; - return this; - } - - public Builder modelUuid(String modelUuid) { - this.modelUuid = Optional.ofNullable(modelUuid); - return this; - } - - @JsonSetter(value = "input_tokens", nulls = Nulls.SKIP) - public Builder inputTokens(Optional inputTokens) { - this.inputTokens = inputTokens; - return this; - } - - public Builder inputTokens(Double inputTokens) { - this.inputTokens = Optional.ofNullable(inputTokens); - return this; - } - - @JsonSetter(value = "output_tokens", nulls = Nulls.SKIP) - public Builder outputTokens(Optional outputTokens) { - this.outputTokens = outputTokens; - return this; - } - - public Builder outputTokens(Double outputTokens) { - this.outputTokens = Optional.ofNullable(outputTokens); - return this; - } - - public ListenV1ResponseMetadataTopicsInfo build() { - return new ListenV1ResponseMetadataTopicsInfo( - modelUuid, inputTokens, outputTokens, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListenV1ResponseResults.java b/src/main/java/types/ListenV1ResponseResults.java deleted file mode 100644 index 203b0bd..0000000 --- a/src/main/java/types/ListenV1ResponseResults.java +++ /dev/null @@ -1,238 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListenV1ResponseResults.Builder.class) -public final class ListenV1ResponseResults { - private final List channels; - - private final Optional> utterances; - - private final Optional summary; - - private final Optional topics; - - private final Optional intents; - - private final Optional sentiments; - - private final Map additionalProperties; - - private ListenV1ResponseResults( - List channels, - Optional> utterances, - Optional summary, - Optional topics, - Optional intents, - Optional sentiments, - Map additionalProperties) { - this.channels = channels; - this.utterances = utterances; - this.summary = summary; - this.topics = topics; - this.intents = intents; - this.sentiments = sentiments; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("channels") - public List getChannels() { - return channels; - } - - @JsonProperty("utterances") - public Optional> getUtterances() { - return utterances; - } - - @JsonProperty("summary") - public Optional getSummary() { - return summary; - } - - @JsonProperty("topics") - public Optional getTopics() { - return topics; - } - - @JsonProperty("intents") - public Optional getIntents() { - return intents; - } - - @JsonProperty("sentiments") - public Optional getSentiments() { - return sentiments; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListenV1ResponseResults && equalTo((ListenV1ResponseResults) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListenV1ResponseResults other) { - return channels.equals(other.channels) - && utterances.equals(other.utterances) - && summary.equals(other.summary) - && topics.equals(other.topics) - && intents.equals(other.intents) - && sentiments.equals(other.sentiments); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.channels, this.utterances, this.summary, this.topics, this.intents, this.sentiments); - } - - @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 channels = new ArrayList<>(); - - private Optional> utterances = Optional.empty(); - - private Optional summary = Optional.empty(); - - private Optional topics = Optional.empty(); - - private Optional intents = Optional.empty(); - - private Optional sentiments = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListenV1ResponseResults other) { - channels(other.getChannels()); - utterances(other.getUtterances()); - summary(other.getSummary()); - topics(other.getTopics()); - intents(other.getIntents()); - sentiments(other.getSentiments()); - return this; - } - - @JsonSetter(value = "channels", nulls = Nulls.SKIP) - public Builder channels(List channels) { - this.channels.clear(); - if (channels != null) { - this.channels.addAll(channels); - } - return this; - } - - public Builder addChannels(ListenV1ResponseResultsChannelsItem channels) { - this.channels.add(channels); - return this; - } - - public Builder addAllChannels(List channels) { - if (channels != null) { - this.channels.addAll(channels); - } - return this; - } - - @JsonSetter(value = "utterances", nulls = Nulls.SKIP) - public Builder utterances(Optional> utterances) { - this.utterances = utterances; - return this; - } - - public Builder utterances(List utterances) { - this.utterances = Optional.ofNullable(utterances); - return this; - } - - @JsonSetter(value = "summary", nulls = Nulls.SKIP) - public Builder summary(Optional summary) { - this.summary = summary; - return this; - } - - public Builder summary(ListenV1ResponseResultsSummary summary) { - this.summary = Optional.ofNullable(summary); - return this; - } - - @JsonSetter(value = "topics", nulls = Nulls.SKIP) - public Builder topics(Optional topics) { - this.topics = topics; - return this; - } - - public Builder topics(SharedTopics topics) { - this.topics = Optional.ofNullable(topics); - return this; - } - - @JsonSetter(value = "intents", nulls = Nulls.SKIP) - public Builder intents(Optional intents) { - this.intents = intents; - return this; - } - - public Builder intents(SharedIntents intents) { - this.intents = Optional.ofNullable(intents); - return this; - } - - @JsonSetter(value = "sentiments", nulls = Nulls.SKIP) - public Builder sentiments(Optional sentiments) { - this.sentiments = sentiments; - return this; - } - - public Builder sentiments(SharedSentiments sentiments) { - this.sentiments = Optional.ofNullable(sentiments); - return this; - } - - public ListenV1ResponseResults build() { - return new ListenV1ResponseResults( - channels, utterances, summary, topics, intents, sentiments, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListenV1ResponseResultsChannelsItem.java b/src/main/java/types/ListenV1ResponseResultsChannelsItem.java deleted file mode 100644 index 6d6c3e3..0000000 --- a/src/main/java/types/ListenV1ResponseResultsChannelsItem.java +++ /dev/null @@ -1,158 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListenV1ResponseResultsChannelsItem.Builder.class) -public final class ListenV1ResponseResultsChannelsItem { - private final Optional> search; - - private final Optional> alternatives; - - private final Optional detectedLanguage; - - private final Map additionalProperties; - - private ListenV1ResponseResultsChannelsItem( - Optional> search, - Optional> alternatives, - Optional detectedLanguage, - Map additionalProperties) { - this.search = search; - this.alternatives = alternatives; - this.detectedLanguage = detectedLanguage; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("search") - public Optional> getSearch() { - return search; - } - - @JsonProperty("alternatives") - public Optional> getAlternatives() { - return alternatives; - } - - @JsonProperty("detected_language") - public Optional getDetectedLanguage() { - return detectedLanguage; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListenV1ResponseResultsChannelsItem - && equalTo((ListenV1ResponseResultsChannelsItem) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListenV1ResponseResultsChannelsItem other) { - return search.equals(other.search) - && alternatives.equals(other.alternatives) - && detectedLanguage.equals(other.detectedLanguage); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.search, this.alternatives, this.detectedLanguage); - } - - @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> search = Optional.empty(); - - private Optional> alternatives = - Optional.empty(); - - private Optional detectedLanguage = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListenV1ResponseResultsChannelsItem other) { - search(other.getSearch()); - alternatives(other.getAlternatives()); - detectedLanguage(other.getDetectedLanguage()); - return this; - } - - @JsonSetter(value = "search", nulls = Nulls.SKIP) - public Builder search(Optional> search) { - this.search = search; - return this; - } - - public Builder search(List search) { - this.search = Optional.ofNullable(search); - return this; - } - - @JsonSetter(value = "alternatives", nulls = Nulls.SKIP) - public Builder alternatives( - Optional> alternatives) { - this.alternatives = alternatives; - return this; - } - - public Builder alternatives( - List alternatives) { - this.alternatives = Optional.ofNullable(alternatives); - return this; - } - - @JsonSetter(value = "detected_language", nulls = Nulls.SKIP) - public Builder detectedLanguage(Optional detectedLanguage) { - this.detectedLanguage = detectedLanguage; - return this; - } - - public Builder detectedLanguage(String detectedLanguage) { - this.detectedLanguage = Optional.ofNullable(detectedLanguage); - return this; - } - - public ListenV1ResponseResultsChannelsItem build() { - return new ListenV1ResponseResultsChannelsItem( - search, alternatives, detectedLanguage, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListenV1ResponseResultsChannelsItemAlternativesItem.java b/src/main/java/types/ListenV1ResponseResultsChannelsItemAlternativesItem.java deleted file mode 100644 index e2334d3..0000000 --- a/src/main/java/types/ListenV1ResponseResultsChannelsItemAlternativesItem.java +++ /dev/null @@ -1,285 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListenV1ResponseResultsChannelsItemAlternativesItem.Builder.class) -public final class ListenV1ResponseResultsChannelsItemAlternativesItem { - private final Optional transcript; - - private final Optional confidence; - - private final Optional> words; - - private final Optional paragraphs; - - private final Optional> - entities; - - private final Optional> - summaries; - - private final Optional> - topics; - - private final Map additionalProperties; - - private ListenV1ResponseResultsChannelsItemAlternativesItem( - Optional transcript, - Optional confidence, - Optional> words, - Optional paragraphs, - Optional> entities, - Optional> summaries, - Optional> topics, - Map additionalProperties) { - this.transcript = transcript; - this.confidence = confidence; - this.words = words; - this.paragraphs = paragraphs; - this.entities = entities; - this.summaries = summaries; - this.topics = topics; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("transcript") - public Optional getTranscript() { - return transcript; - } - - @JsonProperty("confidence") - public Optional getConfidence() { - return confidence; - } - - @JsonProperty("words") - public Optional> getWords() { - return words; - } - - @JsonProperty("paragraphs") - public Optional getParagraphs() { - return paragraphs; - } - - @JsonProperty("entities") - public Optional> - getEntities() { - return entities; - } - - @JsonProperty("summaries") - public Optional> - getSummaries() { - return summaries; - } - - @JsonProperty("topics") - public Optional> getTopics() { - return topics; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListenV1ResponseResultsChannelsItemAlternativesItem - && equalTo((ListenV1ResponseResultsChannelsItemAlternativesItem) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListenV1ResponseResultsChannelsItemAlternativesItem other) { - return transcript.equals(other.transcript) - && confidence.equals(other.confidence) - && words.equals(other.words) - && paragraphs.equals(other.paragraphs) - && entities.equals(other.entities) - && summaries.equals(other.summaries) - && topics.equals(other.topics); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.transcript, - this.confidence, - this.words, - this.paragraphs, - this.entities, - this.summaries, - this.topics); - } - - @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 transcript = Optional.empty(); - - private Optional confidence = Optional.empty(); - - private Optional> words = - Optional.empty(); - - private Optional paragraphs = - Optional.empty(); - - private Optional> - entities = Optional.empty(); - - private Optional> - summaries = Optional.empty(); - - private Optional> topics = - Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListenV1ResponseResultsChannelsItemAlternativesItem other) { - transcript(other.getTranscript()); - confidence(other.getConfidence()); - words(other.getWords()); - paragraphs(other.getParagraphs()); - entities(other.getEntities()); - summaries(other.getSummaries()); - topics(other.getTopics()); - 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; - } - - @JsonSetter(value = "confidence", nulls = Nulls.SKIP) - public Builder confidence(Optional confidence) { - this.confidence = confidence; - return this; - } - - public Builder confidence(Float confidence) { - this.confidence = Optional.ofNullable(confidence); - return this; - } - - @JsonSetter(value = "words", nulls = Nulls.SKIP) - public Builder words( - Optional> words) { - this.words = words; - return this; - } - - public Builder words(List words) { - this.words = Optional.ofNullable(words); - return this; - } - - @JsonSetter(value = "paragraphs", nulls = Nulls.SKIP) - public Builder paragraphs( - Optional paragraphs) { - this.paragraphs = paragraphs; - return this; - } - - public Builder paragraphs( - ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs paragraphs) { - this.paragraphs = Optional.ofNullable(paragraphs); - return this; - } - - @JsonSetter(value = "entities", nulls = Nulls.SKIP) - public Builder entities( - Optional> entities) { - this.entities = entities; - return this; - } - - public Builder entities( - List entities) { - this.entities = Optional.ofNullable(entities); - return this; - } - - @JsonSetter(value = "summaries", nulls = Nulls.SKIP) - public Builder summaries( - Optional> - summaries) { - this.summaries = summaries; - return this; - } - - public Builder summaries( - List summaries) { - this.summaries = Optional.ofNullable(summaries); - return this; - } - - @JsonSetter(value = "topics", nulls = Nulls.SKIP) - public Builder topics( - Optional> topics) { - this.topics = topics; - return this; - } - - public Builder topics( - List topics) { - this.topics = Optional.ofNullable(topics); - return this; - } - - public ListenV1ResponseResultsChannelsItemAlternativesItem build() { - return new ListenV1ResponseResultsChannelsItemAlternativesItem( - transcript, - confidence, - words, - paragraphs, - entities, - summaries, - topics, - additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItem.java b/src/main/java/types/ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItem.java deleted file mode 100644 index 8f7021b..0000000 --- a/src/main/java/types/ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItem.java +++ /dev/null @@ -1,228 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItem.Builder.class) -public final class ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItem { - private final Optional label; - - private final Optional value; - - private final Optional rawValue; - - private final Optional confidence; - - private final Optional startWord; - - private final Optional endWord; - - private final Map additionalProperties; - - private ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItem( - Optional label, - Optional value, - Optional rawValue, - Optional confidence, - Optional startWord, - Optional endWord, - Map additionalProperties) { - this.label = label; - this.value = value; - this.rawValue = rawValue; - this.confidence = confidence; - this.startWord = startWord; - this.endWord = endWord; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("label") - public Optional getLabel() { - return label; - } - - @JsonProperty("value") - public Optional getValue() { - return value; - } - - @JsonProperty("raw_value") - public Optional getRawValue() { - return rawValue; - } - - @JsonProperty("confidence") - public Optional getConfidence() { - return confidence; - } - - @JsonProperty("start_word") - public Optional getStartWord() { - return startWord; - } - - @JsonProperty("end_word") - public Optional getEndWord() { - return endWord; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItem - && equalTo((ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItem) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItem other) { - return label.equals(other.label) - && value.equals(other.value) - && rawValue.equals(other.rawValue) - && confidence.equals(other.confidence) - && startWord.equals(other.startWord) - && endWord.equals(other.endWord); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.label, this.value, this.rawValue, this.confidence, this.startWord, this.endWord); - } - - @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 label = Optional.empty(); - - private Optional value = Optional.empty(); - - private Optional rawValue = Optional.empty(); - - private Optional confidence = Optional.empty(); - - private Optional startWord = Optional.empty(); - - private Optional endWord = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItem other) { - label(other.getLabel()); - value(other.getValue()); - rawValue(other.getRawValue()); - confidence(other.getConfidence()); - startWord(other.getStartWord()); - endWord(other.getEndWord()); - return this; - } - - @JsonSetter(value = "label", nulls = Nulls.SKIP) - public Builder label(Optional label) { - this.label = label; - return this; - } - - public Builder label(String label) { - this.label = Optional.ofNullable(label); - return this; - } - - @JsonSetter(value = "value", nulls = Nulls.SKIP) - public Builder value(Optional value) { - this.value = value; - return this; - } - - public Builder value(String value) { - this.value = Optional.ofNullable(value); - return this; - } - - @JsonSetter(value = "raw_value", nulls = Nulls.SKIP) - public Builder rawValue(Optional rawValue) { - this.rawValue = rawValue; - return this; - } - - public Builder rawValue(String rawValue) { - this.rawValue = Optional.ofNullable(rawValue); - return this; - } - - @JsonSetter(value = "confidence", nulls = Nulls.SKIP) - public Builder confidence(Optional confidence) { - this.confidence = confidence; - return this; - } - - public Builder confidence(Float confidence) { - this.confidence = Optional.ofNullable(confidence); - return this; - } - - @JsonSetter(value = "start_word", nulls = Nulls.SKIP) - public Builder startWord(Optional startWord) { - this.startWord = startWord; - return this; - } - - public Builder startWord(Float startWord) { - this.startWord = Optional.ofNullable(startWord); - return this; - } - - @JsonSetter(value = "end_word", nulls = Nulls.SKIP) - public Builder endWord(Optional endWord) { - this.endWord = endWord; - return this; - } - - public Builder endWord(Float endWord) { - this.endWord = Optional.ofNullable(endWord); - return this; - } - - public ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItem build() { - return new ListenV1ResponseResultsChannelsItemAlternativesItemEntitiesItem( - label, value, rawValue, confidence, startWord, endWord, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs.java b/src/main/java/types/ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs.java deleted file mode 100644 index 42d7e42..0000000 --- a/src/main/java/types/ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs.java +++ /dev/null @@ -1,141 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs.Builder.class) -public final class ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs { - private final Optional transcript; - - private final Optional< - List> - paragraphs; - - private final Map additionalProperties; - - private ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs( - Optional transcript, - Optional> - paragraphs, - Map additionalProperties) { - this.transcript = transcript; - this.paragraphs = paragraphs; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("transcript") - public Optional getTranscript() { - return transcript; - } - - @JsonProperty("paragraphs") - public Optional> - getParagraphs() { - return paragraphs; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs - && equalTo((ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs other) { - return transcript.equals(other.transcript) && paragraphs.equals(other.paragraphs); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.transcript, this.paragraphs); - } - - @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 transcript = Optional.empty(); - - private Optional< - List> - paragraphs = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs other) { - transcript(other.getTranscript()); - paragraphs(other.getParagraphs()); - 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; - } - - @JsonSetter(value = "paragraphs", nulls = Nulls.SKIP) - public Builder paragraphs( - Optional> - paragraphs) { - this.paragraphs = paragraphs; - return this; - } - - public Builder paragraphs( - List - paragraphs) { - this.paragraphs = Optional.ofNullable(paragraphs); - return this; - } - - public ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs build() { - return new ListenV1ResponseResultsChannelsItemAlternativesItemParagraphs( - transcript, paragraphs, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItem.java b/src/main/java/types/ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItem.java deleted file mode 100644 index 7254e2c..0000000 --- a/src/main/java/types/ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItem.java +++ /dev/null @@ -1,228 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = - ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItem.Builder.class) -public final class ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItem { - private final Optional< - List< - ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem>> - sentences; - - private final Optional speaker; - - private final Optional numWords; - - private final Optional start; - - private final Optional end; - - private final Map additionalProperties; - - private ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItem( - Optional< - List< - ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem>> - sentences, - Optional speaker, - Optional numWords, - Optional start, - Optional end, - Map additionalProperties) { - this.sentences = sentences; - this.speaker = speaker; - this.numWords = numWords; - this.start = start; - this.end = end; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("sentences") - public Optional< - List< - ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem>> - getSentences() { - return sentences; - } - - @JsonProperty("speaker") - public Optional getSpeaker() { - return speaker; - } - - @JsonProperty("num_words") - public Optional getNumWords() { - return numWords; - } - - @JsonProperty("start") - public Optional getStart() { - return start; - } - - @JsonProperty("end") - public Optional getEnd() { - return end; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other - instanceof ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItem - && equalTo( - (ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItem) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo( - ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItem other) { - return sentences.equals(other.sentences) - && speaker.equals(other.speaker) - && numWords.equals(other.numWords) - && start.equals(other.start) - && end.equals(other.end); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.sentences, this.speaker, this.numWords, this.start, this.end); - } - - @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< - List< - ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem>> - sentences = Optional.empty(); - - private Optional speaker = Optional.empty(); - - private Optional numWords = Optional.empty(); - - private Optional start = Optional.empty(); - - private Optional end = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from( - ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItem other) { - sentences(other.getSentences()); - speaker(other.getSpeaker()); - numWords(other.getNumWords()); - start(other.getStart()); - end(other.getEnd()); - return this; - } - - @JsonSetter(value = "sentences", nulls = Nulls.SKIP) - public Builder sentences( - Optional< - List< - ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem>> - sentences) { - this.sentences = sentences; - return this; - } - - public Builder sentences( - List< - ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem> - sentences) { - this.sentences = Optional.ofNullable(sentences); - return this; - } - - @JsonSetter(value = "speaker", nulls = Nulls.SKIP) - public Builder speaker(Optional speaker) { - this.speaker = speaker; - return this; - } - - public Builder speaker(Float speaker) { - this.speaker = Optional.ofNullable(speaker); - return this; - } - - @JsonSetter(value = "num_words", nulls = Nulls.SKIP) - public Builder numWords(Optional numWords) { - this.numWords = numWords; - return this; - } - - public Builder numWords(Float numWords) { - this.numWords = Optional.ofNullable(numWords); - return this; - } - - @JsonSetter(value = "start", nulls = Nulls.SKIP) - public Builder start(Optional start) { - this.start = start; - return this; - } - - public Builder start(Float 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(Float end) { - this.end = Optional.ofNullable(end); - return this; - } - - public ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItem build() { - return new ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItem( - sentences, speaker, numWords, start, end, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem.java b/src/main/java/types/ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem.java deleted file mode 100644 index bd10e3b..0000000 --- a/src/main/java/types/ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem.java +++ /dev/null @@ -1,165 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = - ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem - .Builder.class) -public final -class ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem { - private final Optional text; - - private final Optional start; - - private final Optional end; - - private final Map additionalProperties; - - private ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem( - Optional text, - Optional start, - Optional end, - Map additionalProperties) { - this.text = text; - this.start = start; - this.end = end; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("text") - public Optional getText() { - return text; - } - - @JsonProperty("start") - public Optional getStart() { - return start; - } - - @JsonProperty("end") - public Optional getEnd() { - return end; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other - instanceof - ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem - && equalTo( - (ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem) - other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo( - ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem - other) { - return text.equals(other.text) && start.equals(other.start) && end.equals(other.end); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.text, this.start, this.end); - } - - @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 text = Optional.empty(); - - private Optional start = Optional.empty(); - - private Optional end = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from( - ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem - other) { - text(other.getText()); - start(other.getStart()); - end(other.getEnd()); - return this; - } - - @JsonSetter(value = "text", nulls = Nulls.SKIP) - public Builder text(Optional text) { - this.text = text; - return this; - } - - public Builder text(String text) { - this.text = Optional.ofNullable(text); - return this; - } - - @JsonSetter(value = "start", nulls = Nulls.SKIP) - public Builder start(Optional start) { - this.start = start; - return this; - } - - public Builder start(Float 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(Float end) { - this.end = Optional.ofNullable(end); - return this; - } - - public ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem - build() { - return new ListenV1ResponseResultsChannelsItemAlternativesItemParagraphsParagraphsItemSentencesItem( - text, start, end, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItem.java b/src/main/java/types/ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItem.java deleted file mode 100644 index 0cab785..0000000 --- a/src/main/java/types/ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItem.java +++ /dev/null @@ -1,155 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItem.Builder.class) -public final class ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItem { - private final Optional summary; - - private final Optional startWord; - - private final Optional endWord; - - private final Map additionalProperties; - - private ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItem( - Optional summary, - Optional startWord, - Optional endWord, - Map additionalProperties) { - this.summary = summary; - this.startWord = startWord; - this.endWord = endWord; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("summary") - public Optional getSummary() { - return summary; - } - - @JsonProperty("start_word") - public Optional getStartWord() { - return startWord; - } - - @JsonProperty("end_word") - public Optional getEndWord() { - return endWord; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItem - && equalTo((ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItem) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItem other) { - return summary.equals(other.summary) - && startWord.equals(other.startWord) - && endWord.equals(other.endWord); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.summary, this.startWord, this.endWord); - } - - @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 startWord = Optional.empty(); - - private Optional endWord = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItem other) { - summary(other.getSummary()); - startWord(other.getStartWord()); - endWord(other.getEndWord()); - 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 = "start_word", nulls = Nulls.SKIP) - public Builder startWord(Optional startWord) { - this.startWord = startWord; - return this; - } - - public Builder startWord(Float startWord) { - this.startWord = Optional.ofNullable(startWord); - return this; - } - - @JsonSetter(value = "end_word", nulls = Nulls.SKIP) - public Builder endWord(Optional endWord) { - this.endWord = endWord; - return this; - } - - public Builder endWord(Float endWord) { - this.endWord = Optional.ofNullable(endWord); - return this; - } - - public ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItem build() { - return new ListenV1ResponseResultsChannelsItemAlternativesItemSummariesItem( - summary, startWord, endWord, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItem.java b/src/main/java/types/ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItem.java deleted file mode 100644 index 8861d5c..0000000 --- a/src/main/java/types/ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItem.java +++ /dev/null @@ -1,180 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItem.Builder.class) -public final class ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItem { - private final Optional text; - - private final Optional startWord; - - private final Optional endWord; - - private final Optional> topics; - - private final Map additionalProperties; - - private ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItem( - Optional text, - Optional startWord, - Optional endWord, - Optional> topics, - Map additionalProperties) { - this.text = text; - this.startWord = startWord; - this.endWord = endWord; - this.topics = topics; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("text") - public Optional getText() { - return text; - } - - @JsonProperty("start_word") - public Optional getStartWord() { - return startWord; - } - - @JsonProperty("end_word") - public Optional getEndWord() { - return endWord; - } - - @JsonProperty("topics") - public Optional> getTopics() { - return topics; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItem - && equalTo((ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItem) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItem other) { - return text.equals(other.text) - && startWord.equals(other.startWord) - && endWord.equals(other.endWord) - && topics.equals(other.topics); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.text, this.startWord, this.endWord, this.topics); - } - - @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 text = Optional.empty(); - - private Optional startWord = Optional.empty(); - - private Optional endWord = Optional.empty(); - - private Optional> topics = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItem other) { - text(other.getText()); - startWord(other.getStartWord()); - endWord(other.getEndWord()); - topics(other.getTopics()); - return this; - } - - @JsonSetter(value = "text", nulls = Nulls.SKIP) - public Builder text(Optional text) { - this.text = text; - return this; - } - - public Builder text(String text) { - this.text = Optional.ofNullable(text); - return this; - } - - @JsonSetter(value = "start_word", nulls = Nulls.SKIP) - public Builder startWord(Optional startWord) { - this.startWord = startWord; - return this; - } - - public Builder startWord(Float startWord) { - this.startWord = Optional.ofNullable(startWord); - return this; - } - - @JsonSetter(value = "end_word", nulls = Nulls.SKIP) - public Builder endWord(Optional endWord) { - this.endWord = endWord; - return this; - } - - public Builder endWord(Float endWord) { - this.endWord = Optional.ofNullable(endWord); - return this; - } - - @JsonSetter(value = "topics", nulls = Nulls.SKIP) - public Builder topics(Optional> topics) { - this.topics = topics; - return this; - } - - public Builder topics(List topics) { - this.topics = Optional.ofNullable(topics); - return this; - } - - public ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItem build() { - return new ListenV1ResponseResultsChannelsItemAlternativesItemTopicsItem( - text, startWord, endWord, topics, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem.java b/src/main/java/types/ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem.java deleted file mode 100644 index 680d4ab..0000000 --- a/src/main/java/types/ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem.java +++ /dev/null @@ -1,179 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem.Builder.class) -public final class ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem { - private final Optional word; - - private final Optional start; - - private final Optional end; - - private final Optional confidence; - - private final Map additionalProperties; - - private ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem( - Optional word, - Optional start, - Optional end, - Optional confidence, - Map additionalProperties) { - this.word = word; - this.start = start; - this.end = end; - this.confidence = confidence; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("word") - public Optional getWord() { - return word; - } - - @JsonProperty("start") - public Optional getStart() { - return start; - } - - @JsonProperty("end") - public Optional getEnd() { - return end; - } - - @JsonProperty("confidence") - public Optional getConfidence() { - return confidence; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem - && equalTo((ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem other) { - return word.equals(other.word) - && start.equals(other.start) - && end.equals(other.end) - && confidence.equals(other.confidence); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.word, this.start, this.end, this.confidence); - } - - @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 word = Optional.empty(); - - private Optional start = Optional.empty(); - - private Optional end = Optional.empty(); - - private Optional confidence = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem other) { - word(other.getWord()); - start(other.getStart()); - end(other.getEnd()); - confidence(other.getConfidence()); - return this; - } - - @JsonSetter(value = "word", nulls = Nulls.SKIP) - public Builder word(Optional word) { - this.word = word; - return this; - } - - public Builder word(String word) { - this.word = Optional.ofNullable(word); - return this; - } - - @JsonSetter(value = "start", nulls = Nulls.SKIP) - public Builder start(Optional start) { - this.start = start; - return this; - } - - public Builder start(Float 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(Float end) { - this.end = Optional.ofNullable(end); - return this; - } - - @JsonSetter(value = "confidence", nulls = Nulls.SKIP) - public Builder confidence(Optional confidence) { - this.confidence = confidence; - return this; - } - - public Builder confidence(Float confidence) { - this.confidence = Optional.ofNullable(confidence); - return this; - } - - public ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem build() { - return new ListenV1ResponseResultsChannelsItemAlternativesItemWordsItem( - word, start, end, confidence, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListenV1ResponseResultsChannelsItemSearchItem.java b/src/main/java/types/ListenV1ResponseResultsChannelsItemSearchItem.java deleted file mode 100644 index 29255ed..0000000 --- a/src/main/java/types/ListenV1ResponseResultsChannelsItemSearchItem.java +++ /dev/null @@ -1,131 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListenV1ResponseResultsChannelsItemSearchItem.Builder.class) -public final class ListenV1ResponseResultsChannelsItemSearchItem { - private final Optional query; - - private final Optional> hits; - - private final Map additionalProperties; - - private ListenV1ResponseResultsChannelsItemSearchItem( - Optional query, - Optional> hits, - Map additionalProperties) { - this.query = query; - this.hits = hits; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("query") - public Optional getQuery() { - return query; - } - - @JsonProperty("hits") - public Optional> getHits() { - return hits; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListenV1ResponseResultsChannelsItemSearchItem - && equalTo((ListenV1ResponseResultsChannelsItemSearchItem) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListenV1ResponseResultsChannelsItemSearchItem other) { - return query.equals(other.query) && hits.equals(other.hits); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.query, this.hits); - } - - @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 query = Optional.empty(); - - private Optional> hits = - Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListenV1ResponseResultsChannelsItemSearchItem other) { - query(other.getQuery()); - hits(other.getHits()); - return this; - } - - @JsonSetter(value = "query", nulls = Nulls.SKIP) - public Builder query(Optional query) { - this.query = query; - return this; - } - - public Builder query(String query) { - this.query = Optional.ofNullable(query); - return this; - } - - @JsonSetter(value = "hits", nulls = Nulls.SKIP) - public Builder hits( - Optional> hits) { - this.hits = hits; - return this; - } - - public Builder hits(List hits) { - this.hits = Optional.ofNullable(hits); - return this; - } - - public ListenV1ResponseResultsChannelsItemSearchItem build() { - return new ListenV1ResponseResultsChannelsItemSearchItem(query, hits, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListenV1ResponseResultsChannelsItemSearchItemHitsItem.java b/src/main/java/types/ListenV1ResponseResultsChannelsItemSearchItemHitsItem.java deleted file mode 100644 index 78c935c..0000000 --- a/src/main/java/types/ListenV1ResponseResultsChannelsItemSearchItemHitsItem.java +++ /dev/null @@ -1,178 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListenV1ResponseResultsChannelsItemSearchItemHitsItem.Builder.class) -public final class ListenV1ResponseResultsChannelsItemSearchItemHitsItem { - private final Optional confidence; - - private final Optional start; - - private final Optional end; - - private final Optional snippet; - - private final Map additionalProperties; - - private ListenV1ResponseResultsChannelsItemSearchItemHitsItem( - Optional confidence, - Optional start, - Optional end, - Optional snippet, - Map additionalProperties) { - this.confidence = confidence; - this.start = start; - this.end = end; - this.snippet = snippet; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("confidence") - public Optional getConfidence() { - return confidence; - } - - @JsonProperty("start") - public Optional getStart() { - return start; - } - - @JsonProperty("end") - public Optional getEnd() { - return end; - } - - @JsonProperty("snippet") - public Optional getSnippet() { - return snippet; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListenV1ResponseResultsChannelsItemSearchItemHitsItem - && equalTo((ListenV1ResponseResultsChannelsItemSearchItemHitsItem) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListenV1ResponseResultsChannelsItemSearchItemHitsItem other) { - return confidence.equals(other.confidence) - && start.equals(other.start) - && end.equals(other.end) - && snippet.equals(other.snippet); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.confidence, this.start, this.end, this.snippet); - } - - @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 confidence = Optional.empty(); - - private Optional start = Optional.empty(); - - private Optional end = Optional.empty(); - - private Optional snippet = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListenV1ResponseResultsChannelsItemSearchItemHitsItem other) { - confidence(other.getConfidence()); - start(other.getStart()); - end(other.getEnd()); - snippet(other.getSnippet()); - return this; - } - - @JsonSetter(value = "confidence", nulls = Nulls.SKIP) - public Builder confidence(Optional confidence) { - this.confidence = confidence; - return this; - } - - public Builder confidence(Float confidence) { - this.confidence = Optional.ofNullable(confidence); - return this; - } - - @JsonSetter(value = "start", nulls = Nulls.SKIP) - public Builder start(Optional start) { - this.start = start; - return this; - } - - public Builder start(Float 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(Float end) { - this.end = Optional.ofNullable(end); - return this; - } - - @JsonSetter(value = "snippet", nulls = Nulls.SKIP) - public Builder snippet(Optional snippet) { - this.snippet = snippet; - return this; - } - - public Builder snippet(String snippet) { - this.snippet = Optional.ofNullable(snippet); - return this; - } - - public ListenV1ResponseResultsChannelsItemSearchItemHitsItem build() { - return new ListenV1ResponseResultsChannelsItemSearchItemHitsItem( - confidence, start, end, snippet, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListenV1ResponseResultsSummary.java b/src/main/java/types/ListenV1ResponseResultsSummary.java deleted file mode 100644 index 4fe5ede..0000000 --- a/src/main/java/types/ListenV1ResponseResultsSummary.java +++ /dev/null @@ -1,126 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListenV1ResponseResultsSummary.Builder.class) -public final class ListenV1ResponseResultsSummary { - private final Optional result; - - private final Optional short_; - - private final Map additionalProperties; - - private ListenV1ResponseResultsSummary( - Optional result, Optional short_, Map additionalProperties) { - this.result = result; - this.short_ = short_; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("result") - public Optional getResult() { - return result; - } - - @JsonProperty("short") - public Optional getShort() { - return short_; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListenV1ResponseResultsSummary - && equalTo((ListenV1ResponseResultsSummary) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListenV1ResponseResultsSummary other) { - return result.equals(other.result) && short_.equals(other.short_); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.result, this.short_); - } - - @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 result = Optional.empty(); - - private Optional short_ = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListenV1ResponseResultsSummary other) { - result(other.getResult()); - short_(other.getShort()); - return this; - } - - @JsonSetter(value = "result", nulls = Nulls.SKIP) - public Builder result(Optional result) { - this.result = result; - return this; - } - - public Builder result(String result) { - this.result = Optional.ofNullable(result); - return this; - } - - @JsonSetter(value = "short", nulls = Nulls.SKIP) - public Builder short_(Optional short_) { - this.short_ = short_; - return this; - } - - public Builder short_(String short_) { - this.short_ = Optional.ofNullable(short_); - return this; - } - - public ListenV1ResponseResultsSummary build() { - return new ListenV1ResponseResultsSummary(result, short_, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListenV1ResponseResultsUtterancesItem.java b/src/main/java/types/ListenV1ResponseResultsUtterancesItem.java deleted file mode 100644 index 0a7288c..0000000 --- a/src/main/java/types/ListenV1ResponseResultsUtterancesItem.java +++ /dev/null @@ -1,283 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListenV1ResponseResultsUtterancesItem.Builder.class) -public final class ListenV1ResponseResultsUtterancesItem { - private final Optional start; - - private final Optional end; - - private final Optional confidence; - - private final Optional channel; - - private final Optional transcript; - - private final Optional> words; - - private final Optional speaker; - - private final Optional id; - - private final Map additionalProperties; - - private ListenV1ResponseResultsUtterancesItem( - Optional start, - Optional end, - Optional confidence, - Optional channel, - Optional transcript, - Optional> words, - Optional speaker, - Optional id, - Map additionalProperties) { - this.start = start; - this.end = end; - this.confidence = confidence; - this.channel = channel; - this.transcript = transcript; - this.words = words; - this.speaker = speaker; - this.id = id; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("start") - public Optional getStart() { - return start; - } - - @JsonProperty("end") - public Optional getEnd() { - return end; - } - - @JsonProperty("confidence") - public Optional getConfidence() { - return confidence; - } - - @JsonProperty("channel") - public Optional getChannel() { - return channel; - } - - @JsonProperty("transcript") - public Optional getTranscript() { - return transcript; - } - - @JsonProperty("words") - public Optional> getWords() { - return words; - } - - @JsonProperty("speaker") - public Optional getSpeaker() { - return speaker; - } - - @JsonProperty("id") - public Optional getId() { - return id; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListenV1ResponseResultsUtterancesItem - && equalTo((ListenV1ResponseResultsUtterancesItem) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListenV1ResponseResultsUtterancesItem other) { - return start.equals(other.start) - && end.equals(other.end) - && confidence.equals(other.confidence) - && channel.equals(other.channel) - && transcript.equals(other.transcript) - && words.equals(other.words) - && speaker.equals(other.speaker) - && id.equals(other.id); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.start, - this.end, - this.confidence, - this.channel, - this.transcript, - this.words, - this.speaker, - this.id); - } - - @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 start = Optional.empty(); - - private Optional end = Optional.empty(); - - private Optional confidence = Optional.empty(); - - private Optional channel = Optional.empty(); - - private Optional transcript = Optional.empty(); - - private Optional> words = Optional.empty(); - - private Optional speaker = Optional.empty(); - - private Optional id = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListenV1ResponseResultsUtterancesItem other) { - start(other.getStart()); - end(other.getEnd()); - confidence(other.getConfidence()); - channel(other.getChannel()); - transcript(other.getTranscript()); - words(other.getWords()); - speaker(other.getSpeaker()); - id(other.getId()); - return this; - } - - @JsonSetter(value = "start", nulls = Nulls.SKIP) - public Builder start(Optional start) { - this.start = start; - return this; - } - - public Builder start(Float 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(Float end) { - this.end = Optional.ofNullable(end); - return this; - } - - @JsonSetter(value = "confidence", nulls = Nulls.SKIP) - public Builder confidence(Optional confidence) { - this.confidence = confidence; - return this; - } - - public Builder confidence(Float confidence) { - this.confidence = Optional.ofNullable(confidence); - return this; - } - - @JsonSetter(value = "channel", nulls = Nulls.SKIP) - public Builder channel(Optional channel) { - this.channel = channel; - return this; - } - - public Builder channel(Float channel) { - this.channel = Optional.ofNullable(channel); - 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; - } - - @JsonSetter(value = "words", nulls = Nulls.SKIP) - public Builder words(Optional> words) { - this.words = words; - return this; - } - - public Builder words(List words) { - this.words = Optional.ofNullable(words); - return this; - } - - @JsonSetter(value = "speaker", nulls = Nulls.SKIP) - public Builder speaker(Optional speaker) { - this.speaker = speaker; - return this; - } - - public Builder speaker(Float speaker) { - this.speaker = Optional.ofNullable(speaker); - return this; - } - - @JsonSetter(value = "id", nulls = Nulls.SKIP) - public Builder id(Optional id) { - this.id = id; - return this; - } - - public Builder id(String id) { - this.id = Optional.ofNullable(id); - return this; - } - - public ListenV1ResponseResultsUtterancesItem build() { - return new ListenV1ResponseResultsUtterancesItem( - start, end, confidence, channel, transcript, words, speaker, id, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListenV1ResponseResultsUtterancesItemWordsItem.java b/src/main/java/types/ListenV1ResponseResultsUtterancesItemWordsItem.java deleted file mode 100644 index ac7c056..0000000 --- a/src/main/java/types/ListenV1ResponseResultsUtterancesItemWordsItem.java +++ /dev/null @@ -1,264 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ListenV1ResponseResultsUtterancesItemWordsItem.Builder.class) -public final class ListenV1ResponseResultsUtterancesItemWordsItem { - private final Optional word; - - private final Optional start; - - private final Optional end; - - private final Optional confidence; - - private final Optional speaker; - - private final Optional speakerConfidence; - - private final Optional punctuatedWord; - - private final Map additionalProperties; - - private ListenV1ResponseResultsUtterancesItemWordsItem( - Optional word, - Optional start, - Optional end, - Optional confidence, - Optional speaker, - Optional speakerConfidence, - Optional punctuatedWord, - Map additionalProperties) { - this.word = word; - this.start = start; - this.end = end; - this.confidence = confidence; - this.speaker = speaker; - this.speakerConfidence = speakerConfidence; - this.punctuatedWord = punctuatedWord; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("word") - public Optional getWord() { - return word; - } - - @JsonProperty("start") - public Optional getStart() { - return start; - } - - @JsonProperty("end") - public Optional getEnd() { - return end; - } - - @JsonProperty("confidence") - public Optional getConfidence() { - return confidence; - } - - @JsonProperty("speaker") - public Optional getSpeaker() { - return speaker; - } - - @JsonProperty("speaker_confidence") - public Optional getSpeakerConfidence() { - return speakerConfidence; - } - - @JsonProperty("punctuated_word") - public Optional getPunctuatedWord() { - return punctuatedWord; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListenV1ResponseResultsUtterancesItemWordsItem - && equalTo((ListenV1ResponseResultsUtterancesItemWordsItem) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListenV1ResponseResultsUtterancesItemWordsItem other) { - return word.equals(other.word) - && start.equals(other.start) - && end.equals(other.end) - && confidence.equals(other.confidence) - && speaker.equals(other.speaker) - && speakerConfidence.equals(other.speakerConfidence) - && punctuatedWord.equals(other.punctuatedWord); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.word, - this.start, - this.end, - this.confidence, - this.speaker, - this.speakerConfidence, - this.punctuatedWord); - } - - @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 word = Optional.empty(); - - private Optional start = Optional.empty(); - - private Optional end = Optional.empty(); - - private Optional confidence = Optional.empty(); - - private Optional speaker = Optional.empty(); - - private Optional speakerConfidence = Optional.empty(); - - private Optional punctuatedWord = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ListenV1ResponseResultsUtterancesItemWordsItem other) { - word(other.getWord()); - start(other.getStart()); - end(other.getEnd()); - confidence(other.getConfidence()); - speaker(other.getSpeaker()); - speakerConfidence(other.getSpeakerConfidence()); - punctuatedWord(other.getPunctuatedWord()); - return this; - } - - @JsonSetter(value = "word", nulls = Nulls.SKIP) - public Builder word(Optional word) { - this.word = word; - return this; - } - - public Builder word(String word) { - this.word = Optional.ofNullable(word); - return this; - } - - @JsonSetter(value = "start", nulls = Nulls.SKIP) - public Builder start(Optional start) { - this.start = start; - return this; - } - - public Builder start(Float 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(Float end) { - this.end = Optional.ofNullable(end); - return this; - } - - @JsonSetter(value = "confidence", nulls = Nulls.SKIP) - public Builder confidence(Optional confidence) { - this.confidence = confidence; - return this; - } - - public Builder confidence(Float confidence) { - this.confidence = Optional.ofNullable(confidence); - return this; - } - - @JsonSetter(value = "speaker", nulls = Nulls.SKIP) - public Builder speaker(Optional speaker) { - this.speaker = speaker; - return this; - } - - public Builder speaker(Float speaker) { - this.speaker = Optional.ofNullable(speaker); - return this; - } - - @JsonSetter(value = "speaker_confidence", nulls = Nulls.SKIP) - public Builder speakerConfidence(Optional speakerConfidence) { - this.speakerConfidence = speakerConfidence; - return this; - } - - public Builder speakerConfidence(Float speakerConfidence) { - this.speakerConfidence = Optional.ofNullable(speakerConfidence); - return this; - } - - @JsonSetter(value = "punctuated_word", nulls = Nulls.SKIP) - public Builder punctuatedWord(Optional punctuatedWord) { - this.punctuatedWord = punctuatedWord; - return this; - } - - public Builder punctuatedWord(String punctuatedWord) { - this.punctuatedWord = Optional.ofNullable(punctuatedWord); - return this; - } - - public ListenV1ResponseResultsUtterancesItemWordsItem build() { - return new ListenV1ResponseResultsUtterancesItemWordsItem( - word, - start, - end, - confidence, - speaker, - speakerConfidence, - punctuatedWord, - additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ListenV1SampleRate.java b/src/main/java/types/ListenV1SampleRate.java deleted file mode 100644 index 569bfa2..0000000 --- a/src/main/java/types/ListenV1SampleRate.java +++ /dev/null @@ -1,41 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import core.WrappedAlias; - -public final class ListenV1SampleRate implements WrappedAlias { - private final Object value; - - private ListenV1SampleRate(Object value) { - this.value = value; - } - - @JsonValue - public Object get() { - return this.value; - } - - @java.lang.Override - public boolean equals(Object other) { - return this == other - || (other instanceof ListenV1SampleRate - && this.value.equals(((ListenV1SampleRate) other).value)); - } - - @java.lang.Override - public int hashCode() { - return value.hashCode(); - } - - @java.lang.Override - public String toString() { - return value.toString(); - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListenV1SampleRate of(Object value) { - return new ListenV1SampleRate(value); - } -} diff --git a/src/main/java/types/ListenV1Search.java b/src/main/java/types/ListenV1Search.java deleted file mode 100644 index a5df8f5..0000000 --- a/src/main/java/types/ListenV1Search.java +++ /dev/null @@ -1,40 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import core.WrappedAlias; - -public final class ListenV1Search implements WrappedAlias { - private final Object value; - - private ListenV1Search(Object value) { - this.value = value; - } - - @JsonValue - public Object get() { - return this.value; - } - - @java.lang.Override - public boolean equals(Object other) { - return this == other - || (other instanceof ListenV1Search && this.value.equals(((ListenV1Search) other).value)); - } - - @java.lang.Override - public int hashCode() { - return value.hashCode(); - } - - @java.lang.Override - public String toString() { - return value.toString(); - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListenV1Search of(Object value) { - return new ListenV1Search(value); - } -} diff --git a/src/main/java/types/ListenV1SmartFormat.java b/src/main/java/types/ListenV1SmartFormat.java deleted file mode 100644 index 8fcc994..0000000 --- a/src/main/java/types/ListenV1SmartFormat.java +++ /dev/null @@ -1,82 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class ListenV1SmartFormat { - public static final ListenV1SmartFormat FALSE = new ListenV1SmartFormat(Value.FALSE, "false"); - - public static final ListenV1SmartFormat TRUE = new ListenV1SmartFormat(Value.TRUE, "true"); - - private final Value value; - - private final String string; - - ListenV1SmartFormat(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof ListenV1SmartFormat - && this.string.equals(((ListenV1SmartFormat) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case FALSE: - return visitor.visitFalse(); - case TRUE: - return visitor.visitTrue(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListenV1SmartFormat valueOf(String value) { - switch (value) { - case "false": - return FALSE; - case "true": - return TRUE; - default: - return new ListenV1SmartFormat(Value.UNKNOWN, value); - } - } - - public enum Value { - TRUE, - - FALSE, - - UNKNOWN - } - - public interface Visitor { - T visitTrue(); - - T visitFalse(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/types/ListenV1Tag.java b/src/main/java/types/ListenV1Tag.java deleted file mode 100644 index 2b27bb4..0000000 --- a/src/main/java/types/ListenV1Tag.java +++ /dev/null @@ -1,40 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import core.WrappedAlias; - -public final class ListenV1Tag implements WrappedAlias { - private final Object value; - - private ListenV1Tag(Object value) { - this.value = value; - } - - @JsonValue - public Object get() { - return this.value; - } - - @java.lang.Override - public boolean equals(Object other) { - return this == other - || (other instanceof ListenV1Tag && this.value.equals(((ListenV1Tag) other).value)); - } - - @java.lang.Override - public int hashCode() { - return value.hashCode(); - } - - @java.lang.Override - public String toString() { - return value.toString(); - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListenV1Tag of(Object value) { - return new ListenV1Tag(value); - } -} diff --git a/src/main/java/types/ListenV1UtteranceEndMs.java b/src/main/java/types/ListenV1UtteranceEndMs.java deleted file mode 100644 index 4748615..0000000 --- a/src/main/java/types/ListenV1UtteranceEndMs.java +++ /dev/null @@ -1,41 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import core.WrappedAlias; - -public final class ListenV1UtteranceEndMs implements WrappedAlias { - private final Object value; - - private ListenV1UtteranceEndMs(Object value) { - this.value = value; - } - - @JsonValue - public Object get() { - return this.value; - } - - @java.lang.Override - public boolean equals(Object other) { - return this == other - || (other instanceof ListenV1UtteranceEndMs - && this.value.equals(((ListenV1UtteranceEndMs) other).value)); - } - - @java.lang.Override - public int hashCode() { - return value.hashCode(); - } - - @java.lang.Override - public String toString() { - return value.toString(); - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListenV1UtteranceEndMs of(Object value) { - return new ListenV1UtteranceEndMs(value); - } -} diff --git a/src/main/java/types/ListenV1VadEvents.java b/src/main/java/types/ListenV1VadEvents.java deleted file mode 100644 index fbceb4e..0000000 --- a/src/main/java/types/ListenV1VadEvents.java +++ /dev/null @@ -1,82 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class ListenV1VadEvents { - public static final ListenV1VadEvents FALSE = new ListenV1VadEvents(Value.FALSE, "false"); - - public static final ListenV1VadEvents TRUE = new ListenV1VadEvents(Value.TRUE, "true"); - - private final Value value; - - private final String string; - - ListenV1VadEvents(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof ListenV1VadEvents - && this.string.equals(((ListenV1VadEvents) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case FALSE: - return visitor.visitFalse(); - case TRUE: - return visitor.visitTrue(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListenV1VadEvents valueOf(String value) { - switch (value) { - case "false": - return FALSE; - case "true": - return TRUE; - default: - return new ListenV1VadEvents(Value.UNKNOWN, value); - } - } - - public enum Value { - TRUE, - - FALSE, - - UNKNOWN - } - - public interface Visitor { - T visitTrue(); - - T visitFalse(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/types/ListenV1Version.java b/src/main/java/types/ListenV1Version.java deleted file mode 100644 index d640774..0000000 --- a/src/main/java/types/ListenV1Version.java +++ /dev/null @@ -1,40 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import core.WrappedAlias; - -public final class ListenV1Version implements WrappedAlias { - private final Object value; - - private ListenV1Version(Object value) { - this.value = value; - } - - @JsonValue - public Object get() { - return this.value; - } - - @java.lang.Override - public boolean equals(Object other) { - return this == other - || (other instanceof ListenV1Version && this.value.equals(((ListenV1Version) other).value)); - } - - @java.lang.Override - public int hashCode() { - return value.hashCode(); - } - - @java.lang.Override - public String toString() { - return value.toString(); - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListenV1Version of(Object value) { - return new ListenV1Version(value); - } -} diff --git a/src/main/java/types/ListenV2EagerEotThreshold.java b/src/main/java/types/ListenV2EagerEotThreshold.java deleted file mode 100644 index 82134b4..0000000 --- a/src/main/java/types/ListenV2EagerEotThreshold.java +++ /dev/null @@ -1,41 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import core.WrappedAlias; - -public final class ListenV2EagerEotThreshold implements WrappedAlias { - private final Object value; - - private ListenV2EagerEotThreshold(Object value) { - this.value = value; - } - - @JsonValue - public Object get() { - return this.value; - } - - @java.lang.Override - public boolean equals(Object other) { - return this == other - || (other instanceof ListenV2EagerEotThreshold - && this.value.equals(((ListenV2EagerEotThreshold) other).value)); - } - - @java.lang.Override - public int hashCode() { - return value.hashCode(); - } - - @java.lang.Override - public String toString() { - return value.toString(); - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListenV2EagerEotThreshold of(Object value) { - return new ListenV2EagerEotThreshold(value); - } -} diff --git a/src/main/java/types/ListenV2Encoding.java b/src/main/java/types/ListenV2Encoding.java deleted file mode 100644 index 71a440c..0000000 --- a/src/main/java/types/ListenV2Encoding.java +++ /dev/null @@ -1,122 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class ListenV2Encoding { - public static final ListenV2Encoding MULAW = new ListenV2Encoding(Value.MULAW, "mulaw"); - - public static final ListenV2Encoding LINEAR32 = new ListenV2Encoding(Value.LINEAR32, "linear32"); - - public static final ListenV2Encoding OGG_OPUS = new ListenV2Encoding(Value.OGG_OPUS, "ogg-opus"); - - public static final ListenV2Encoding LINEAR16 = new ListenV2Encoding(Value.LINEAR16, "linear16"); - - public static final ListenV2Encoding OPUS = new ListenV2Encoding(Value.OPUS, "opus"); - - public static final ListenV2Encoding ALAW = new ListenV2Encoding(Value.ALAW, "alaw"); - - private final Value value; - - private final String string; - - ListenV2Encoding(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof ListenV2Encoding - && this.string.equals(((ListenV2Encoding) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case MULAW: - return visitor.visitMulaw(); - case LINEAR32: - return visitor.visitLinear32(); - case OGG_OPUS: - return visitor.visitOggOpus(); - case LINEAR16: - return visitor.visitLinear16(); - case OPUS: - return visitor.visitOpus(); - case ALAW: - return visitor.visitAlaw(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListenV2Encoding valueOf(String value) { - switch (value) { - case "mulaw": - return MULAW; - case "linear32": - return LINEAR32; - case "ogg-opus": - return OGG_OPUS; - case "linear16": - return LINEAR16; - case "opus": - return OPUS; - case "alaw": - return ALAW; - default: - return new ListenV2Encoding(Value.UNKNOWN, value); - } - } - - public enum Value { - LINEAR16, - - LINEAR32, - - MULAW, - - ALAW, - - OPUS, - - OGG_OPUS, - - UNKNOWN - } - - public interface Visitor { - T visitLinear16(); - - T visitLinear32(); - - T visitMulaw(); - - T visitAlaw(); - - T visitOpus(); - - T visitOggOpus(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/types/ListenV2EotThreshold.java b/src/main/java/types/ListenV2EotThreshold.java deleted file mode 100644 index 3f60145..0000000 --- a/src/main/java/types/ListenV2EotThreshold.java +++ /dev/null @@ -1,41 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import core.WrappedAlias; - -public final class ListenV2EotThreshold implements WrappedAlias { - private final Object value; - - private ListenV2EotThreshold(Object value) { - this.value = value; - } - - @JsonValue - public Object get() { - return this.value; - } - - @java.lang.Override - public boolean equals(Object other) { - return this == other - || (other instanceof ListenV2EotThreshold - && this.value.equals(((ListenV2EotThreshold) other).value)); - } - - @java.lang.Override - public int hashCode() { - return value.hashCode(); - } - - @java.lang.Override - public String toString() { - return value.toString(); - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListenV2EotThreshold of(Object value) { - return new ListenV2EotThreshold(value); - } -} diff --git a/src/main/java/types/ListenV2EotTimeoutMs.java b/src/main/java/types/ListenV2EotTimeoutMs.java deleted file mode 100644 index 410172d..0000000 --- a/src/main/java/types/ListenV2EotTimeoutMs.java +++ /dev/null @@ -1,41 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import core.WrappedAlias; - -public final class ListenV2EotTimeoutMs implements WrappedAlias { - private final Object value; - - private ListenV2EotTimeoutMs(Object value) { - this.value = value; - } - - @JsonValue - public Object get() { - return this.value; - } - - @java.lang.Override - public boolean equals(Object other) { - return this == other - || (other instanceof ListenV2EotTimeoutMs - && this.value.equals(((ListenV2EotTimeoutMs) other).value)); - } - - @java.lang.Override - public int hashCode() { - return value.hashCode(); - } - - @java.lang.Override - public String toString() { - return value.toString(); - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListenV2EotTimeoutMs of(Object value) { - return new ListenV2EotTimeoutMs(value); - } -} diff --git a/src/main/java/types/ListenV2Keyterm.java b/src/main/java/types/ListenV2Keyterm.java deleted file mode 100644 index 1beee70..0000000 --- a/src/main/java/types/ListenV2Keyterm.java +++ /dev/null @@ -1,97 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonValue; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.deser.std.StdDeserializer; -import core.ObjectMappers; -import java.io.IOException; -import java.util.List; -import java.util.Objects; - -@JsonDeserialize(using = ListenV2Keyterm.Deserializer.class) -public final class ListenV2Keyterm { - private final Object value; - - private final int type; - - private ListenV2Keyterm(Object value, int type) { - this.value = value; - this.type = type; - } - - @JsonValue - public Object get() { - return this.value; - } - - @SuppressWarnings("unchecked") - public T visit(Visitor visitor) { - if (this.type == 0) { - return visitor.visit((String) this.value); - } else if (this.type == 1) { - return visitor.visit((List) 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 ListenV2Keyterm && equalTo((ListenV2Keyterm) other); - } - - private boolean equalTo(ListenV2Keyterm 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 ListenV2Keyterm of(String value) { - return new ListenV2Keyterm(value, 0); - } - - public static ListenV2Keyterm of(List value) { - return new ListenV2Keyterm(value, 1); - } - - public interface Visitor { - T visit(String value); - - T visit(List value); - } - - static final class Deserializer extends StdDeserializer { - Deserializer() { - super(ListenV2Keyterm.class); - } - - @java.lang.Override - public ListenV2Keyterm deserialize(JsonParser p, DeserializationContext context) - throws IOException { - Object value = p.readValueAs(Object.class); - try { - return of(ObjectMappers.JSON_MAPPER.convertValue(value, String.class)); - } catch (RuntimeException e) { - } - try { - return of( - ObjectMappers.JSON_MAPPER.convertValue(value, new TypeReference>() {})); - } catch (RuntimeException e) { - } - throw new JsonParseException(p, "Failed to deserialize"); - } - } -} diff --git a/src/main/java/types/ListenV2MipOptOut.java b/src/main/java/types/ListenV2MipOptOut.java deleted file mode 100644 index fb8f064..0000000 --- a/src/main/java/types/ListenV2MipOptOut.java +++ /dev/null @@ -1,41 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import core.WrappedAlias; - -public final class ListenV2MipOptOut implements WrappedAlias { - private final Object value; - - private ListenV2MipOptOut(Object value) { - this.value = value; - } - - @JsonValue - public Object get() { - return this.value; - } - - @java.lang.Override - public boolean equals(Object other) { - return this == other - || (other instanceof ListenV2MipOptOut - && this.value.equals(((ListenV2MipOptOut) other).value)); - } - - @java.lang.Override - public int hashCode() { - return value.hashCode(); - } - - @java.lang.Override - public String toString() { - return value.toString(); - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListenV2MipOptOut of(Object value) { - return new ListenV2MipOptOut(value); - } -} diff --git a/src/main/java/types/ListenV2SampleRate.java b/src/main/java/types/ListenV2SampleRate.java deleted file mode 100644 index 0e788ae..0000000 --- a/src/main/java/types/ListenV2SampleRate.java +++ /dev/null @@ -1,41 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import core.WrappedAlias; - -public final class ListenV2SampleRate implements WrappedAlias { - private final Object value; - - private ListenV2SampleRate(Object value) { - this.value = value; - } - - @JsonValue - public Object get() { - return this.value; - } - - @java.lang.Override - public boolean equals(Object other) { - return this == other - || (other instanceof ListenV2SampleRate - && this.value.equals(((ListenV2SampleRate) other).value)); - } - - @java.lang.Override - public int hashCode() { - return value.hashCode(); - } - - @java.lang.Override - public String toString() { - return value.toString(); - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListenV2SampleRate of(Object value) { - return new ListenV2SampleRate(value); - } -} diff --git a/src/main/java/types/ListenV2Tag.java b/src/main/java/types/ListenV2Tag.java deleted file mode 100644 index df47bca..0000000 --- a/src/main/java/types/ListenV2Tag.java +++ /dev/null @@ -1,40 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import core.WrappedAlias; - -public final class ListenV2Tag implements WrappedAlias { - private final Object value; - - private ListenV2Tag(Object value) { - this.value = value; - } - - @JsonValue - public Object get() { - return this.value; - } - - @java.lang.Override - public boolean equals(Object other) { - return this == other - || (other instanceof ListenV2Tag && this.value.equals(((ListenV2Tag) other).value)); - } - - @java.lang.Override - public int hashCode() { - return value.hashCode(); - } - - @java.lang.Override - public String toString() { - return value.toString(); - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static ListenV2Tag of(Object value) { - return new ListenV2Tag(value); - } -} diff --git a/src/main/java/types/OpenAiSpeakProvider.java b/src/main/java/types/OpenAiSpeakProvider.java deleted file mode 100644 index bee64a8..0000000 --- a/src/main/java/types/OpenAiSpeakProvider.java +++ /dev/null @@ -1,208 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = OpenAiSpeakProvider.Builder.class) -public final class OpenAiSpeakProvider { - private final Optional version; - - private final OpenAiSpeakProviderModel model; - - private final OpenAiSpeakProviderVoice voice; - - private final Map additionalProperties; - - private OpenAiSpeakProvider( - Optional version, - OpenAiSpeakProviderModel model, - OpenAiSpeakProviderVoice voice, - Map additionalProperties) { - this.version = version; - this.model = model; - this.voice = voice; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("type") - public String getType() { - return "open_ai"; - } - - /** - * @return The REST API version for the OpenAI text-to-speech API - */ - @JsonProperty("version") - public Optional getVersion() { - return version; - } - - /** - * @return OpenAI TTS model - */ - @JsonProperty("model") - public OpenAiSpeakProviderModel getModel() { - return model; - } - - /** - * @return OpenAI voice - */ - @JsonProperty("voice") - public OpenAiSpeakProviderVoice getVoice() { - return voice; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof OpenAiSpeakProvider && equalTo((OpenAiSpeakProvider) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(OpenAiSpeakProvider other) { - return version.equals(other.version) && model.equals(other.model) && voice.equals(other.voice); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.version, this.model, this.voice); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static ModelStage builder() { - return new Builder(); - } - - public interface ModelStage { - /** OpenAI TTS model */ - VoiceStage model(@NotNull OpenAiSpeakProviderModel model); - - Builder from(OpenAiSpeakProvider other); - } - - public interface VoiceStage { - /** OpenAI voice */ - _FinalStage voice(@NotNull OpenAiSpeakProviderVoice voice); - } - - public interface _FinalStage { - OpenAiSpeakProvider build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** The REST API version for the OpenAI text-to-speech API */ - _FinalStage version(Optional version); - - _FinalStage version(String version); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements ModelStage, VoiceStage, _FinalStage { - private OpenAiSpeakProviderModel model; - - private OpenAiSpeakProviderVoice voice; - - private Optional version = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(OpenAiSpeakProvider other) { - version(other.getVersion()); - model(other.getModel()); - voice(other.getVoice()); - return this; - } - - /** - * OpenAI TTS model - * - *

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

OpenAI voice - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("voice") - public _FinalStage voice(@NotNull OpenAiSpeakProviderVoice voice) { - this.voice = Objects.requireNonNull(voice, "voice must not be null"); - return this; - } - - /** - * The REST API version for the OpenAI text-to-speech API - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage version(String version) { - this.version = Optional.ofNullable(version); - return this; - } - - /** The REST API version for the OpenAI text-to-speech API */ - @java.lang.Override - @JsonSetter(value = "version", nulls = Nulls.SKIP) - public _FinalStage version(Optional version) { - this.version = version; - return this; - } - - @java.lang.Override - public OpenAiSpeakProvider build() { - return new OpenAiSpeakProvider(version, model, voice, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/OpenAiSpeakProviderModel.java b/src/main/java/types/OpenAiSpeakProviderModel.java deleted file mode 100644 index c3cc8f3..0000000 --- a/src/main/java/types/OpenAiSpeakProviderModel.java +++ /dev/null @@ -1,84 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class OpenAiSpeakProviderModel { - public static final OpenAiSpeakProviderModel TTS1HD = - new OpenAiSpeakProviderModel(Value.TTS1HD, "tts-1-hd"); - - public static final OpenAiSpeakProviderModel TTS1 = - new OpenAiSpeakProviderModel(Value.TTS1, "tts-1"); - - private final Value value; - - private final String string; - - OpenAiSpeakProviderModel(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof OpenAiSpeakProviderModel - && this.string.equals(((OpenAiSpeakProviderModel) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case TTS1HD: - return visitor.visitTts1Hd(); - case TTS1: - return visitor.visitTts1(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static OpenAiSpeakProviderModel valueOf(String value) { - switch (value) { - case "tts-1-hd": - return TTS1HD; - case "tts-1": - return TTS1; - default: - return new OpenAiSpeakProviderModel(Value.UNKNOWN, value); - } - } - - public enum Value { - TTS1, - - TTS1HD, - - UNKNOWN - } - - public interface Visitor { - T visitTts1(); - - T visitTts1Hd(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/types/OpenAiSpeakProviderVoice.java b/src/main/java/types/OpenAiSpeakProviderVoice.java deleted file mode 100644 index 3b16bf7..0000000 --- a/src/main/java/types/OpenAiSpeakProviderVoice.java +++ /dev/null @@ -1,128 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class OpenAiSpeakProviderVoice { - public static final OpenAiSpeakProviderVoice SHIMMER = - new OpenAiSpeakProviderVoice(Value.SHIMMER, "shimmer"); - - public static final OpenAiSpeakProviderVoice FABLE = - new OpenAiSpeakProviderVoice(Value.FABLE, "fable"); - - public static final OpenAiSpeakProviderVoice ALLOY = - new OpenAiSpeakProviderVoice(Value.ALLOY, "alloy"); - - public static final OpenAiSpeakProviderVoice ONYX = - new OpenAiSpeakProviderVoice(Value.ONYX, "onyx"); - - public static final OpenAiSpeakProviderVoice NOVA = - new OpenAiSpeakProviderVoice(Value.NOVA, "nova"); - - public static final OpenAiSpeakProviderVoice ECHO = - new OpenAiSpeakProviderVoice(Value.ECHO, "echo"); - - private final Value value; - - private final String string; - - OpenAiSpeakProviderVoice(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof OpenAiSpeakProviderVoice - && this.string.equals(((OpenAiSpeakProviderVoice) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case SHIMMER: - return visitor.visitShimmer(); - case FABLE: - return visitor.visitFable(); - case ALLOY: - return visitor.visitAlloy(); - case ONYX: - return visitor.visitOnyx(); - case NOVA: - return visitor.visitNova(); - case ECHO: - return visitor.visitEcho(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static OpenAiSpeakProviderVoice valueOf(String value) { - switch (value) { - case "shimmer": - return SHIMMER; - case "fable": - return FABLE; - case "alloy": - return ALLOY; - case "onyx": - return ONYX; - case "nova": - return NOVA; - case "echo": - return ECHO; - default: - return new OpenAiSpeakProviderVoice(Value.UNKNOWN, value); - } - } - - public enum Value { - ALLOY, - - ECHO, - - FABLE, - - ONYX, - - NOVA, - - SHIMMER, - - UNKNOWN - } - - public interface Visitor { - T visitAlloy(); - - T visitEcho(); - - T visitFable(); - - T visitOnyx(); - - T visitNova(); - - T visitShimmer(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/types/OpenAiThinkProvider.java b/src/main/java/types/OpenAiThinkProvider.java deleted file mode 100644 index 127fcfc..0000000 --- a/src/main/java/types/OpenAiThinkProvider.java +++ /dev/null @@ -1,215 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = OpenAiThinkProvider.Builder.class) -public final class OpenAiThinkProvider { - private final Optional version; - - private final OpenAiThinkProviderModel model; - - private final Optional temperature; - - private final Map additionalProperties; - - private OpenAiThinkProvider( - Optional version, - OpenAiThinkProviderModel model, - Optional temperature, - Map additionalProperties) { - this.version = version; - this.model = model; - this.temperature = temperature; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("type") - public String getType() { - return "open_ai"; - } - - /** - * @return The REST API version for the OpenAI chat completions API - */ - @JsonProperty("version") - public Optional getVersion() { - return version; - } - - /** - * @return OpenAI model to use - */ - @JsonProperty("model") - public OpenAiThinkProviderModel getModel() { - return model; - } - - /** - * @return OpenAI temperature (0-2) - */ - @JsonProperty("temperature") - public Optional getTemperature() { - return temperature; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof OpenAiThinkProvider && equalTo((OpenAiThinkProvider) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(OpenAiThinkProvider other) { - return version.equals(other.version) - && model.equals(other.model) - && temperature.equals(other.temperature); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.version, this.model, this.temperature); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static ModelStage builder() { - return new Builder(); - } - - public interface ModelStage { - /** OpenAI model to use */ - _FinalStage model(@NotNull OpenAiThinkProviderModel model); - - Builder from(OpenAiThinkProvider other); - } - - public interface _FinalStage { - OpenAiThinkProvider build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** The REST API version for the OpenAI chat completions API */ - _FinalStage version(Optional version); - - _FinalStage version(String version); - - /** OpenAI temperature (0-2) */ - _FinalStage temperature(Optional temperature); - - _FinalStage temperature(Double temperature); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements ModelStage, _FinalStage { - private OpenAiThinkProviderModel model; - - private Optional temperature = Optional.empty(); - - private Optional version = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(OpenAiThinkProvider other) { - version(other.getVersion()); - model(other.getModel()); - temperature(other.getTemperature()); - return this; - } - - /** - * OpenAI model to use - * - *

OpenAI model to use - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("model") - public _FinalStage model(@NotNull OpenAiThinkProviderModel model) { - this.model = Objects.requireNonNull(model, "model must not be null"); - return this; - } - - /** - * OpenAI temperature (0-2) - * - * @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; - } - - /** OpenAI temperature (0-2) */ - @java.lang.Override - @JsonSetter(value = "temperature", nulls = Nulls.SKIP) - public _FinalStage temperature(Optional temperature) { - this.temperature = temperature; - return this; - } - - /** - * The REST API version for the OpenAI chat completions API - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage version(String version) { - this.version = Optional.ofNullable(version); - return this; - } - - /** The REST API version for the OpenAI chat completions API */ - @java.lang.Override - @JsonSetter(value = "version", nulls = Nulls.SKIP) - public _FinalStage version(Optional version) { - this.version = version; - return this; - } - - @java.lang.Override - public OpenAiThinkProvider build() { - return new OpenAiThinkProvider(version, model, temperature, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/OpenAiThinkProviderModel.java b/src/main/java/types/OpenAiThinkProviderModel.java deleted file mode 100644 index 36601c1..0000000 --- a/src/main/java/types/OpenAiThinkProviderModel.java +++ /dev/null @@ -1,150 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class OpenAiThinkProviderModel { - public static final OpenAiThinkProviderModel GPT5MINI = - new OpenAiThinkProviderModel(Value.GPT5MINI, "gpt-5-mini"); - - public static final OpenAiThinkProviderModel GPT4O_MINI = - new OpenAiThinkProviderModel(Value.GPT4O_MINI, "gpt-4o-mini"); - - public static final OpenAiThinkProviderModel GPT4O = - new OpenAiThinkProviderModel(Value.GPT4O, "gpt-4o"); - - public static final OpenAiThinkProviderModel GPT41NANO = - new OpenAiThinkProviderModel(Value.GPT41NANO, "gpt-4.1-nano"); - - public static final OpenAiThinkProviderModel GPT5 = - new OpenAiThinkProviderModel(Value.GPT5, "gpt-5"); - - public static final OpenAiThinkProviderModel GPT41MINI = - new OpenAiThinkProviderModel(Value.GPT41MINI, "gpt-4.1-mini"); - - public static final OpenAiThinkProviderModel GPT5NANO = - new OpenAiThinkProviderModel(Value.GPT5NANO, "gpt-5-nano"); - - public static final OpenAiThinkProviderModel GPT41 = - new OpenAiThinkProviderModel(Value.GPT41, "gpt-4.1"); - - private final Value value; - - private final String string; - - OpenAiThinkProviderModel(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof OpenAiThinkProviderModel - && this.string.equals(((OpenAiThinkProviderModel) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case GPT5MINI: - return visitor.visitGpt5Mini(); - case GPT4O_MINI: - return visitor.visitGpt4OMini(); - case GPT4O: - return visitor.visitGpt4O(); - case GPT41NANO: - return visitor.visitGpt41Nano(); - case GPT5: - return visitor.visitGpt5(); - case GPT41MINI: - return visitor.visitGpt41Mini(); - case GPT5NANO: - return visitor.visitGpt5Nano(); - case GPT41: - return visitor.visitGpt41(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static OpenAiThinkProviderModel valueOf(String value) { - switch (value) { - case "gpt-5-mini": - return GPT5MINI; - case "gpt-4o-mini": - return GPT4O_MINI; - case "gpt-4o": - return GPT4O; - case "gpt-4.1-nano": - return GPT41NANO; - case "gpt-5": - return GPT5; - case "gpt-4.1-mini": - return GPT41MINI; - case "gpt-5-nano": - return GPT5NANO; - case "gpt-4.1": - return GPT41; - default: - return new OpenAiThinkProviderModel(Value.UNKNOWN, value); - } - } - - public enum Value { - GPT5, - - GPT5MINI, - - GPT5NANO, - - GPT41, - - GPT41MINI, - - GPT41NANO, - - GPT4O, - - GPT4O_MINI, - - UNKNOWN - } - - public interface Visitor { - T visitGpt5(); - - T visitGpt5Mini(); - - T visitGpt5Nano(); - - T visitGpt41(); - - T visitGpt41Mini(); - - T visitGpt41Nano(); - - T visitGpt4O(); - - T visitGpt4OMini(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/types/ProjectRequestResponse.java b/src/main/java/types/ProjectRequestResponse.java deleted file mode 100644 index 2638af8..0000000 --- a/src/main/java/types/ProjectRequestResponse.java +++ /dev/null @@ -1,352 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ProjectRequestResponse.Builder.class) -public final class ProjectRequestResponse { - private final Optional requestId; - - private final Optional projectUuid; - - private final Optional created; - - private final Optional path; - - private final Optional apiKeyId; - - private final Optional> response; - - private final Optional code; - - private final Optional deployment; - - private final Optional callback; - - private final Map additionalProperties; - - private ProjectRequestResponse( - Optional requestId, - Optional projectUuid, - Optional created, - Optional path, - Optional apiKeyId, - Optional> response, - Optional code, - Optional deployment, - Optional callback, - Map additionalProperties) { - this.requestId = requestId; - this.projectUuid = projectUuid; - this.created = created; - this.path = path; - this.apiKeyId = apiKeyId; - this.response = response; - this.code = code; - this.deployment = deployment; - this.callback = callback; - this.additionalProperties = additionalProperties; - } - - /** - * @return The unique identifier of the request - */ - @JsonProperty("request_id") - public Optional getRequestId() { - return requestId; - } - - /** - * @return The unique identifier of the project - */ - @JsonProperty("project_uuid") - public Optional getProjectUuid() { - return projectUuid; - } - - /** - * @return The date and time the request was created - */ - @JsonProperty("created") - public Optional getCreated() { - return created; - } - - /** - * @return The API path of the request - */ - @JsonProperty("path") - public Optional getPath() { - return path; - } - - /** - * @return The unique identifier of the API key - */ - @JsonProperty("api_key_id") - public Optional getApiKeyId() { - return apiKeyId; - } - - /** - * @return The response of the request - */ - @JsonProperty("response") - public Optional> getResponse() { - return response; - } - - /** - * @return The response code of the request - */ - @JsonProperty("code") - public Optional getCode() { - return code; - } - - /** - * @return The deployment type - */ - @JsonProperty("deployment") - public Optional getDeployment() { - return deployment; - } - - /** - * @return The callback URL for the request - */ - @JsonProperty("callback") - public Optional getCallback() { - return callback; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ProjectRequestResponse && equalTo((ProjectRequestResponse) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ProjectRequestResponse other) { - return requestId.equals(other.requestId) - && projectUuid.equals(other.projectUuid) - && created.equals(other.created) - && path.equals(other.path) - && apiKeyId.equals(other.apiKeyId) - && response.equals(other.response) - && code.equals(other.code) - && deployment.equals(other.deployment) - && callback.equals(other.callback); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.requestId, - this.projectUuid, - this.created, - this.path, - this.apiKeyId, - this.response, - this.code, - this.deployment, - this.callback); - } - - @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 requestId = Optional.empty(); - - private Optional projectUuid = Optional.empty(); - - private Optional created = Optional.empty(); - - private Optional path = Optional.empty(); - - private Optional apiKeyId = Optional.empty(); - - private Optional> response = Optional.empty(); - - private Optional code = Optional.empty(); - - private Optional deployment = Optional.empty(); - - private Optional callback = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ProjectRequestResponse other) { - requestId(other.getRequestId()); - projectUuid(other.getProjectUuid()); - created(other.getCreated()); - path(other.getPath()); - apiKeyId(other.getApiKeyId()); - response(other.getResponse()); - code(other.getCode()); - deployment(other.getDeployment()); - callback(other.getCallback()); - return this; - } - - /** The unique identifier of the request */ - @JsonSetter(value = "request_id", nulls = Nulls.SKIP) - public Builder requestId(Optional requestId) { - this.requestId = requestId; - return this; - } - - public Builder requestId(String requestId) { - this.requestId = Optional.ofNullable(requestId); - return this; - } - - /** The unique identifier of the project */ - @JsonSetter(value = "project_uuid", nulls = Nulls.SKIP) - public Builder projectUuid(Optional projectUuid) { - this.projectUuid = projectUuid; - return this; - } - - public Builder projectUuid(String projectUuid) { - this.projectUuid = Optional.ofNullable(projectUuid); - return this; - } - - /** The date and time the request was created */ - @JsonSetter(value = "created", nulls = Nulls.SKIP) - public Builder created(Optional created) { - this.created = created; - return this; - } - - public Builder created(OffsetDateTime created) { - this.created = Optional.ofNullable(created); - return this; - } - - /** The API path of the request */ - @JsonSetter(value = "path", nulls = Nulls.SKIP) - public Builder path(Optional path) { - this.path = path; - return this; - } - - public Builder path(String path) { - this.path = Optional.ofNullable(path); - return this; - } - - /** The unique identifier of the API key */ - @JsonSetter(value = "api_key_id", nulls = Nulls.SKIP) - public Builder apiKeyId(Optional apiKeyId) { - this.apiKeyId = apiKeyId; - return this; - } - - public Builder apiKeyId(String apiKeyId) { - this.apiKeyId = Optional.ofNullable(apiKeyId); - return this; - } - - /** The response of the request */ - @JsonSetter(value = "response", nulls = Nulls.SKIP) - public Builder response(Optional> response) { - this.response = response; - return this; - } - - public Builder response(Map response) { - this.response = Optional.ofNullable(response); - return this; - } - - /** The response code of the request */ - @JsonSetter(value = "code", nulls = Nulls.SKIP) - public Builder code(Optional code) { - this.code = code; - return this; - } - - public Builder code(Double code) { - this.code = Optional.ofNullable(code); - return this; - } - - /** The deployment type */ - @JsonSetter(value = "deployment", nulls = Nulls.SKIP) - public Builder deployment(Optional deployment) { - this.deployment = deployment; - return this; - } - - public Builder deployment(String deployment) { - this.deployment = Optional.ofNullable(deployment); - return this; - } - - /** The callback URL for the request */ - @JsonSetter(value = "callback", nulls = Nulls.SKIP) - public Builder callback(Optional callback) { - this.callback = callback; - return this; - } - - public Builder callback(String callback) { - this.callback = Optional.ofNullable(callback); - return this; - } - - public ProjectRequestResponse build() { - return new ProjectRequestResponse( - requestId, - projectUuid, - created, - path, - apiKeyId, - response, - code, - deployment, - callback, - additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ReadV1Request.java b/src/main/java/types/ReadV1Request.java deleted file mode 100644 index c5d90ea..0000000 --- a/src/main/java/types/ReadV1Request.java +++ /dev/null @@ -1,94 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package 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 core.ObjectMappers; -import java.io.IOException; -import java.util.Objects; - -@JsonDeserialize(using = ReadV1Request.Deserializer.class) -public final class ReadV1Request { - private final Object value; - - private final int type; - - private ReadV1Request(Object value, int type) { - this.value = value; - this.type = type; - } - - @JsonValue - public Object get() { - return this.value; - } - - @SuppressWarnings("unchecked") - public T visit(Visitor visitor) { - if (this.type == 0) { - return visitor.visit((ReadV1RequestUrl) this.value); - } else if (this.type == 1) { - return visitor.visit((ReadV1RequestText) 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 ReadV1Request && equalTo((ReadV1Request) other); - } - - private boolean equalTo(ReadV1Request 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 ReadV1Request of(ReadV1RequestUrl value) { - return new ReadV1Request(value, 0); - } - - public static ReadV1Request of(ReadV1RequestText value) { - return new ReadV1Request(value, 1); - } - - public interface Visitor { - T visit(ReadV1RequestUrl value); - - T visit(ReadV1RequestText value); - } - - static final class Deserializer extends StdDeserializer { - Deserializer() { - super(ReadV1Request.class); - } - - @java.lang.Override - public ReadV1Request deserialize(JsonParser p, DeserializationContext context) - throws IOException { - Object value = p.readValueAs(Object.class); - try { - return of(ObjectMappers.JSON_MAPPER.convertValue(value, ReadV1RequestUrl.class)); - } catch (RuntimeException e) { - } - try { - return of(ObjectMappers.JSON_MAPPER.convertValue(value, ReadV1RequestText.class)); - } catch (RuntimeException e) { - } - throw new JsonParseException(p, "Failed to deserialize"); - } - } -} diff --git a/src/main/java/types/ReadV1RequestText.java b/src/main/java/types/ReadV1RequestText.java deleted file mode 100644 index 27c9889..0000000 --- a/src/main/java/types/ReadV1RequestText.java +++ /dev/null @@ -1,126 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ReadV1RequestText.Builder.class) -public final class ReadV1RequestText { - private final String text; - - private final Map additionalProperties; - - private ReadV1RequestText(String text, Map additionalProperties) { - this.text = text; - this.additionalProperties = additionalProperties; - } - - /** - * @return The plain text to analyze - */ - @JsonProperty("text") - public String getText() { - return text; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ReadV1RequestText && equalTo((ReadV1RequestText) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ReadV1RequestText other) { - return text.equals(other.text); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.text); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static TextStage builder() { - return new Builder(); - } - - public interface TextStage { - /** The plain text to analyze */ - _FinalStage text(@NotNull String text); - - Builder from(ReadV1RequestText other); - } - - public interface _FinalStage { - ReadV1RequestText build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements TextStage, _FinalStage { - private String text; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(ReadV1RequestText other) { - text(other.getText()); - return this; - } - - /** - * The plain text to analyze - * - *

The plain text to analyze - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("text") - public _FinalStage text(@NotNull String text) { - this.text = Objects.requireNonNull(text, "text must not be null"); - return this; - } - - @java.lang.Override - public ReadV1RequestText build() { - return new ReadV1RequestText(text, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ReadV1RequestUrl.java b/src/main/java/types/ReadV1RequestUrl.java deleted file mode 100644 index 82f2c75..0000000 --- a/src/main/java/types/ReadV1RequestUrl.java +++ /dev/null @@ -1,126 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ReadV1RequestUrl.Builder.class) -public final class ReadV1RequestUrl { - private final String url; - - private final Map additionalProperties; - - private ReadV1RequestUrl(String url, Map additionalProperties) { - this.url = url; - this.additionalProperties = additionalProperties; - } - - /** - * @return A URL pointing to the text source - */ - @JsonProperty("url") - public String getUrl() { - return url; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ReadV1RequestUrl && equalTo((ReadV1RequestUrl) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ReadV1RequestUrl other) { - return url.equals(other.url); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.url); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static UrlStage builder() { - return new Builder(); - } - - public interface UrlStage { - /** A URL pointing to the text source */ - _FinalStage url(@NotNull String url); - - Builder from(ReadV1RequestUrl other); - } - - public interface _FinalStage { - ReadV1RequestUrl build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements UrlStage, _FinalStage { - private String url; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(ReadV1RequestUrl other) { - url(other.getUrl()); - return this; - } - - /** - * A URL pointing to the text source - * - *

A URL pointing to the text source - * - * @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; - } - - @java.lang.Override - public ReadV1RequestUrl build() { - return new ReadV1RequestUrl(url, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ReadV1Response.java b/src/main/java/types/ReadV1Response.java deleted file mode 100644 index 61b0ed3..0000000 --- a/src/main/java/types/ReadV1Response.java +++ /dev/null @@ -1,140 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ReadV1Response.Builder.class) -public final class ReadV1Response { - private final ReadV1ResponseMetadata metadata; - - private final ReadV1ResponseResults results; - - private final Map additionalProperties; - - private ReadV1Response( - ReadV1ResponseMetadata metadata, - ReadV1ResponseResults results, - Map additionalProperties) { - this.metadata = metadata; - this.results = results; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("metadata") - public ReadV1ResponseMetadata getMetadata() { - return metadata; - } - - @JsonProperty("results") - public ReadV1ResponseResults getResults() { - return results; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ReadV1Response && equalTo((ReadV1Response) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ReadV1Response other) { - return metadata.equals(other.metadata) && results.equals(other.results); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.metadata, this.results); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static MetadataStage builder() { - return new Builder(); - } - - public interface MetadataStage { - ResultsStage metadata(@NotNull ReadV1ResponseMetadata metadata); - - Builder from(ReadV1Response other); - } - - public interface ResultsStage { - _FinalStage results(@NotNull ReadV1ResponseResults results); - } - - public interface _FinalStage { - ReadV1Response build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements MetadataStage, ResultsStage, _FinalStage { - private ReadV1ResponseMetadata metadata; - - private ReadV1ResponseResults results; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(ReadV1Response other) { - metadata(other.getMetadata()); - results(other.getResults()); - return this; - } - - @java.lang.Override - @JsonSetter("metadata") - public ResultsStage metadata(@NotNull ReadV1ResponseMetadata metadata) { - this.metadata = Objects.requireNonNull(metadata, "metadata must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("results") - public _FinalStage results(@NotNull ReadV1ResponseResults results) { - this.results = Objects.requireNonNull(results, "results must not be null"); - return this; - } - - @java.lang.Override - public ReadV1Response build() { - return new ReadV1Response(metadata, results, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ReadV1ResponseMetadata.java b/src/main/java/types/ReadV1ResponseMetadata.java deleted file mode 100644 index 455fc0a..0000000 --- a/src/main/java/types/ReadV1ResponseMetadata.java +++ /dev/null @@ -1,103 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ReadV1ResponseMetadata.Builder.class) -public final class ReadV1ResponseMetadata { - private final Optional metadata; - - private final Map additionalProperties; - - private ReadV1ResponseMetadata( - Optional metadata, Map additionalProperties) { - this.metadata = metadata; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("metadata") - public Optional getMetadata() { - return metadata; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ReadV1ResponseMetadata && equalTo((ReadV1ResponseMetadata) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ReadV1ResponseMetadata 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 Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional metadata = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ReadV1ResponseMetadata other) { - metadata(other.getMetadata()); - return this; - } - - @JsonSetter(value = "metadata", nulls = Nulls.SKIP) - public Builder metadata(Optional metadata) { - this.metadata = metadata; - return this; - } - - public Builder metadata(ReadV1ResponseMetadataMetadata metadata) { - this.metadata = Optional.ofNullable(metadata); - return this; - } - - public ReadV1ResponseMetadata build() { - return new ReadV1ResponseMetadata(metadata, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ReadV1ResponseMetadataMetadata.java b/src/main/java/types/ReadV1ResponseMetadataMetadata.java deleted file mode 100644 index 926c64f..0000000 --- a/src/main/java/types/ReadV1ResponseMetadataMetadata.java +++ /dev/null @@ -1,266 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ReadV1ResponseMetadataMetadata.Builder.class) -public final class ReadV1ResponseMetadataMetadata { - private final Optional requestId; - - private final Optional created; - - private final Optional language; - - private final Optional summaryInfo; - - private final Optional sentimentInfo; - - private final Optional topicsInfo; - - private final Optional intentsInfo; - - private final Map additionalProperties; - - private ReadV1ResponseMetadataMetadata( - Optional requestId, - Optional created, - Optional language, - Optional summaryInfo, - Optional sentimentInfo, - Optional topicsInfo, - Optional intentsInfo, - Map additionalProperties) { - this.requestId = requestId; - this.created = created; - this.language = language; - this.summaryInfo = summaryInfo; - this.sentimentInfo = sentimentInfo; - this.topicsInfo = topicsInfo; - this.intentsInfo = intentsInfo; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("request_id") - public Optional getRequestId() { - return requestId; - } - - @JsonProperty("created") - public Optional getCreated() { - return created; - } - - @JsonProperty("language") - public Optional getLanguage() { - return language; - } - - @JsonProperty("summary_info") - public Optional getSummaryInfo() { - return summaryInfo; - } - - @JsonProperty("sentiment_info") - public Optional getSentimentInfo() { - return sentimentInfo; - } - - @JsonProperty("topics_info") - public Optional getTopicsInfo() { - return topicsInfo; - } - - @JsonProperty("intents_info") - public Optional getIntentsInfo() { - return intentsInfo; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ReadV1ResponseMetadataMetadata - && equalTo((ReadV1ResponseMetadataMetadata) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ReadV1ResponseMetadataMetadata other) { - return requestId.equals(other.requestId) - && created.equals(other.created) - && language.equals(other.language) - && summaryInfo.equals(other.summaryInfo) - && sentimentInfo.equals(other.sentimentInfo) - && topicsInfo.equals(other.topicsInfo) - && intentsInfo.equals(other.intentsInfo); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.requestId, - this.created, - this.language, - this.summaryInfo, - this.sentimentInfo, - this.topicsInfo, - this.intentsInfo); - } - - @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 requestId = Optional.empty(); - - private Optional created = Optional.empty(); - - private Optional language = Optional.empty(); - - private Optional summaryInfo = Optional.empty(); - - private Optional sentimentInfo = Optional.empty(); - - private Optional topicsInfo = Optional.empty(); - - private Optional intentsInfo = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ReadV1ResponseMetadataMetadata other) { - requestId(other.getRequestId()); - created(other.getCreated()); - language(other.getLanguage()); - summaryInfo(other.getSummaryInfo()); - sentimentInfo(other.getSentimentInfo()); - topicsInfo(other.getTopicsInfo()); - intentsInfo(other.getIntentsInfo()); - return this; - } - - @JsonSetter(value = "request_id", nulls = Nulls.SKIP) - public Builder requestId(Optional requestId) { - this.requestId = requestId; - return this; - } - - public Builder requestId(String requestId) { - this.requestId = Optional.ofNullable(requestId); - return this; - } - - @JsonSetter(value = "created", nulls = Nulls.SKIP) - public Builder created(Optional created) { - this.created = created; - return this; - } - - public Builder created(OffsetDateTime created) { - this.created = Optional.ofNullable(created); - return this; - } - - @JsonSetter(value = "language", nulls = Nulls.SKIP) - public Builder language(Optional language) { - this.language = language; - return this; - } - - public Builder language(String language) { - this.language = Optional.ofNullable(language); - return this; - } - - @JsonSetter(value = "summary_info", nulls = Nulls.SKIP) - public Builder summaryInfo(Optional summaryInfo) { - this.summaryInfo = summaryInfo; - return this; - } - - public Builder summaryInfo(ReadV1ResponseMetadataMetadataSummaryInfo summaryInfo) { - this.summaryInfo = Optional.ofNullable(summaryInfo); - return this; - } - - @JsonSetter(value = "sentiment_info", nulls = Nulls.SKIP) - public Builder sentimentInfo( - Optional sentimentInfo) { - this.sentimentInfo = sentimentInfo; - return this; - } - - public Builder sentimentInfo(ReadV1ResponseMetadataMetadataSentimentInfo sentimentInfo) { - this.sentimentInfo = Optional.ofNullable(sentimentInfo); - return this; - } - - @JsonSetter(value = "topics_info", nulls = Nulls.SKIP) - public Builder topicsInfo(Optional topicsInfo) { - this.topicsInfo = topicsInfo; - return this; - } - - public Builder topicsInfo(ReadV1ResponseMetadataMetadataTopicsInfo topicsInfo) { - this.topicsInfo = Optional.ofNullable(topicsInfo); - return this; - } - - @JsonSetter(value = "intents_info", nulls = Nulls.SKIP) - public Builder intentsInfo(Optional intentsInfo) { - this.intentsInfo = intentsInfo; - return this; - } - - public Builder intentsInfo(ReadV1ResponseMetadataMetadataIntentsInfo intentsInfo) { - this.intentsInfo = Optional.ofNullable(intentsInfo); - return this; - } - - public ReadV1ResponseMetadataMetadata build() { - return new ReadV1ResponseMetadataMetadata( - requestId, - created, - language, - summaryInfo, - sentimentInfo, - topicsInfo, - intentsInfo, - additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ReadV1ResponseMetadataMetadataIntentsInfo.java b/src/main/java/types/ReadV1ResponseMetadataMetadataIntentsInfo.java deleted file mode 100644 index 2cf0739..0000000 --- a/src/main/java/types/ReadV1ResponseMetadataMetadataIntentsInfo.java +++ /dev/null @@ -1,154 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ReadV1ResponseMetadataMetadataIntentsInfo.Builder.class) -public final class ReadV1ResponseMetadataMetadataIntentsInfo { - private final Optional modelUuid; - - private final Optional inputTokens; - - private final Optional outputTokens; - - private final Map additionalProperties; - - private ReadV1ResponseMetadataMetadataIntentsInfo( - Optional modelUuid, - Optional inputTokens, - Optional outputTokens, - Map additionalProperties) { - this.modelUuid = modelUuid; - this.inputTokens = inputTokens; - this.outputTokens = outputTokens; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("model_uuid") - public Optional getModelUuid() { - return modelUuid; - } - - @JsonProperty("input_tokens") - public Optional getInputTokens() { - return inputTokens; - } - - @JsonProperty("output_tokens") - public Optional getOutputTokens() { - return outputTokens; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ReadV1ResponseMetadataMetadataIntentsInfo - && equalTo((ReadV1ResponseMetadataMetadataIntentsInfo) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ReadV1ResponseMetadataMetadataIntentsInfo other) { - return modelUuid.equals(other.modelUuid) - && inputTokens.equals(other.inputTokens) - && outputTokens.equals(other.outputTokens); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.modelUuid, this.inputTokens, this.outputTokens); - } - - @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 modelUuid = Optional.empty(); - - private Optional inputTokens = Optional.empty(); - - private Optional outputTokens = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ReadV1ResponseMetadataMetadataIntentsInfo other) { - modelUuid(other.getModelUuid()); - inputTokens(other.getInputTokens()); - outputTokens(other.getOutputTokens()); - return this; - } - - @JsonSetter(value = "model_uuid", nulls = Nulls.SKIP) - public Builder modelUuid(Optional modelUuid) { - this.modelUuid = modelUuid; - return this; - } - - public Builder modelUuid(String modelUuid) { - this.modelUuid = Optional.ofNullable(modelUuid); - return this; - } - - @JsonSetter(value = "input_tokens", nulls = Nulls.SKIP) - public Builder inputTokens(Optional inputTokens) { - this.inputTokens = inputTokens; - return this; - } - - public Builder inputTokens(Double inputTokens) { - this.inputTokens = Optional.ofNullable(inputTokens); - return this; - } - - @JsonSetter(value = "output_tokens", nulls = Nulls.SKIP) - public Builder outputTokens(Optional outputTokens) { - this.outputTokens = outputTokens; - return this; - } - - public Builder outputTokens(Double outputTokens) { - this.outputTokens = Optional.ofNullable(outputTokens); - return this; - } - - public ReadV1ResponseMetadataMetadataIntentsInfo build() { - return new ReadV1ResponseMetadataMetadataIntentsInfo( - modelUuid, inputTokens, outputTokens, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ReadV1ResponseMetadataMetadataSentimentInfo.java b/src/main/java/types/ReadV1ResponseMetadataMetadataSentimentInfo.java deleted file mode 100644 index 4ee870e..0000000 --- a/src/main/java/types/ReadV1ResponseMetadataMetadataSentimentInfo.java +++ /dev/null @@ -1,154 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ReadV1ResponseMetadataMetadataSentimentInfo.Builder.class) -public final class ReadV1ResponseMetadataMetadataSentimentInfo { - private final Optional modelUuid; - - private final Optional inputTokens; - - private final Optional outputTokens; - - private final Map additionalProperties; - - private ReadV1ResponseMetadataMetadataSentimentInfo( - Optional modelUuid, - Optional inputTokens, - Optional outputTokens, - Map additionalProperties) { - this.modelUuid = modelUuid; - this.inputTokens = inputTokens; - this.outputTokens = outputTokens; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("model_uuid") - public Optional getModelUuid() { - return modelUuid; - } - - @JsonProperty("input_tokens") - public Optional getInputTokens() { - return inputTokens; - } - - @JsonProperty("output_tokens") - public Optional getOutputTokens() { - return outputTokens; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ReadV1ResponseMetadataMetadataSentimentInfo - && equalTo((ReadV1ResponseMetadataMetadataSentimentInfo) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ReadV1ResponseMetadataMetadataSentimentInfo other) { - return modelUuid.equals(other.modelUuid) - && inputTokens.equals(other.inputTokens) - && outputTokens.equals(other.outputTokens); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.modelUuid, this.inputTokens, this.outputTokens); - } - - @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 modelUuid = Optional.empty(); - - private Optional inputTokens = Optional.empty(); - - private Optional outputTokens = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ReadV1ResponseMetadataMetadataSentimentInfo other) { - modelUuid(other.getModelUuid()); - inputTokens(other.getInputTokens()); - outputTokens(other.getOutputTokens()); - return this; - } - - @JsonSetter(value = "model_uuid", nulls = Nulls.SKIP) - public Builder modelUuid(Optional modelUuid) { - this.modelUuid = modelUuid; - return this; - } - - public Builder modelUuid(String modelUuid) { - this.modelUuid = Optional.ofNullable(modelUuid); - return this; - } - - @JsonSetter(value = "input_tokens", nulls = Nulls.SKIP) - public Builder inputTokens(Optional inputTokens) { - this.inputTokens = inputTokens; - return this; - } - - public Builder inputTokens(Double inputTokens) { - this.inputTokens = Optional.ofNullable(inputTokens); - return this; - } - - @JsonSetter(value = "output_tokens", nulls = Nulls.SKIP) - public Builder outputTokens(Optional outputTokens) { - this.outputTokens = outputTokens; - return this; - } - - public Builder outputTokens(Double outputTokens) { - this.outputTokens = Optional.ofNullable(outputTokens); - return this; - } - - public ReadV1ResponseMetadataMetadataSentimentInfo build() { - return new ReadV1ResponseMetadataMetadataSentimentInfo( - modelUuid, inputTokens, outputTokens, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ReadV1ResponseMetadataMetadataSummaryInfo.java b/src/main/java/types/ReadV1ResponseMetadataMetadataSummaryInfo.java deleted file mode 100644 index a44d5b4..0000000 --- a/src/main/java/types/ReadV1ResponseMetadataMetadataSummaryInfo.java +++ /dev/null @@ -1,154 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ReadV1ResponseMetadataMetadataSummaryInfo.Builder.class) -public final class ReadV1ResponseMetadataMetadataSummaryInfo { - private final Optional modelUuid; - - private final Optional inputTokens; - - private final Optional outputTokens; - - private final Map additionalProperties; - - private ReadV1ResponseMetadataMetadataSummaryInfo( - Optional modelUuid, - Optional inputTokens, - Optional outputTokens, - Map additionalProperties) { - this.modelUuid = modelUuid; - this.inputTokens = inputTokens; - this.outputTokens = outputTokens; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("model_uuid") - public Optional getModelUuid() { - return modelUuid; - } - - @JsonProperty("input_tokens") - public Optional getInputTokens() { - return inputTokens; - } - - @JsonProperty("output_tokens") - public Optional getOutputTokens() { - return outputTokens; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ReadV1ResponseMetadataMetadataSummaryInfo - && equalTo((ReadV1ResponseMetadataMetadataSummaryInfo) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ReadV1ResponseMetadataMetadataSummaryInfo other) { - return modelUuid.equals(other.modelUuid) - && inputTokens.equals(other.inputTokens) - && outputTokens.equals(other.outputTokens); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.modelUuid, this.inputTokens, this.outputTokens); - } - - @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 modelUuid = Optional.empty(); - - private Optional inputTokens = Optional.empty(); - - private Optional outputTokens = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ReadV1ResponseMetadataMetadataSummaryInfo other) { - modelUuid(other.getModelUuid()); - inputTokens(other.getInputTokens()); - outputTokens(other.getOutputTokens()); - return this; - } - - @JsonSetter(value = "model_uuid", nulls = Nulls.SKIP) - public Builder modelUuid(Optional modelUuid) { - this.modelUuid = modelUuid; - return this; - } - - public Builder modelUuid(String modelUuid) { - this.modelUuid = Optional.ofNullable(modelUuid); - return this; - } - - @JsonSetter(value = "input_tokens", nulls = Nulls.SKIP) - public Builder inputTokens(Optional inputTokens) { - this.inputTokens = inputTokens; - return this; - } - - public Builder inputTokens(Double inputTokens) { - this.inputTokens = Optional.ofNullable(inputTokens); - return this; - } - - @JsonSetter(value = "output_tokens", nulls = Nulls.SKIP) - public Builder outputTokens(Optional outputTokens) { - this.outputTokens = outputTokens; - return this; - } - - public Builder outputTokens(Double outputTokens) { - this.outputTokens = Optional.ofNullable(outputTokens); - return this; - } - - public ReadV1ResponseMetadataMetadataSummaryInfo build() { - return new ReadV1ResponseMetadataMetadataSummaryInfo( - modelUuid, inputTokens, outputTokens, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ReadV1ResponseMetadataMetadataTopicsInfo.java b/src/main/java/types/ReadV1ResponseMetadataMetadataTopicsInfo.java deleted file mode 100644 index 38497e0..0000000 --- a/src/main/java/types/ReadV1ResponseMetadataMetadataTopicsInfo.java +++ /dev/null @@ -1,154 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ReadV1ResponseMetadataMetadataTopicsInfo.Builder.class) -public final class ReadV1ResponseMetadataMetadataTopicsInfo { - private final Optional modelUuid; - - private final Optional inputTokens; - - private final Optional outputTokens; - - private final Map additionalProperties; - - private ReadV1ResponseMetadataMetadataTopicsInfo( - Optional modelUuid, - Optional inputTokens, - Optional outputTokens, - Map additionalProperties) { - this.modelUuid = modelUuid; - this.inputTokens = inputTokens; - this.outputTokens = outputTokens; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("model_uuid") - public Optional getModelUuid() { - return modelUuid; - } - - @JsonProperty("input_tokens") - public Optional getInputTokens() { - return inputTokens; - } - - @JsonProperty("output_tokens") - public Optional getOutputTokens() { - return outputTokens; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ReadV1ResponseMetadataMetadataTopicsInfo - && equalTo((ReadV1ResponseMetadataMetadataTopicsInfo) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ReadV1ResponseMetadataMetadataTopicsInfo other) { - return modelUuid.equals(other.modelUuid) - && inputTokens.equals(other.inputTokens) - && outputTokens.equals(other.outputTokens); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.modelUuid, this.inputTokens, this.outputTokens); - } - - @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 modelUuid = Optional.empty(); - - private Optional inputTokens = Optional.empty(); - - private Optional outputTokens = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ReadV1ResponseMetadataMetadataTopicsInfo other) { - modelUuid(other.getModelUuid()); - inputTokens(other.getInputTokens()); - outputTokens(other.getOutputTokens()); - return this; - } - - @JsonSetter(value = "model_uuid", nulls = Nulls.SKIP) - public Builder modelUuid(Optional modelUuid) { - this.modelUuid = modelUuid; - return this; - } - - public Builder modelUuid(String modelUuid) { - this.modelUuid = Optional.ofNullable(modelUuid); - return this; - } - - @JsonSetter(value = "input_tokens", nulls = Nulls.SKIP) - public Builder inputTokens(Optional inputTokens) { - this.inputTokens = inputTokens; - return this; - } - - public Builder inputTokens(Double inputTokens) { - this.inputTokens = Optional.ofNullable(inputTokens); - return this; - } - - @JsonSetter(value = "output_tokens", nulls = Nulls.SKIP) - public Builder outputTokens(Optional outputTokens) { - this.outputTokens = outputTokens; - return this; - } - - public Builder outputTokens(Double outputTokens) { - this.outputTokens = Optional.ofNullable(outputTokens); - return this; - } - - public ReadV1ResponseMetadataMetadataTopicsInfo build() { - return new ReadV1ResponseMetadataMetadataTopicsInfo( - modelUuid, inputTokens, outputTokens, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ReadV1ResponseResults.java b/src/main/java/types/ReadV1ResponseResults.java deleted file mode 100644 index e2ec8d1..0000000 --- a/src/main/java/types/ReadV1ResponseResults.java +++ /dev/null @@ -1,176 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ReadV1ResponseResults.Builder.class) -public final class ReadV1ResponseResults { - private final Optional summary; - - private final Optional topics; - - private final Optional intents; - - private final Optional sentiments; - - private final Map additionalProperties; - - private ReadV1ResponseResults( - Optional summary, - Optional topics, - Optional intents, - Optional sentiments, - Map additionalProperties) { - this.summary = summary; - this.topics = topics; - this.intents = intents; - this.sentiments = sentiments; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("summary") - public Optional getSummary() { - return summary; - } - - @JsonProperty("topics") - public Optional getTopics() { - return topics; - } - - @JsonProperty("intents") - public Optional getIntents() { - return intents; - } - - @JsonProperty("sentiments") - public Optional getSentiments() { - return sentiments; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ReadV1ResponseResults && equalTo((ReadV1ResponseResults) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ReadV1ResponseResults other) { - return summary.equals(other.summary) - && topics.equals(other.topics) - && intents.equals(other.intents) - && sentiments.equals(other.sentiments); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.summary, this.topics, this.intents, this.sentiments); - } - - @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 topics = Optional.empty(); - - private Optional intents = Optional.empty(); - - private Optional sentiments = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ReadV1ResponseResults other) { - summary(other.getSummary()); - topics(other.getTopics()); - intents(other.getIntents()); - sentiments(other.getSentiments()); - return this; - } - - @JsonSetter(value = "summary", nulls = Nulls.SKIP) - public Builder summary(Optional summary) { - this.summary = summary; - return this; - } - - public Builder summary(ReadV1ResponseResultsSummary summary) { - this.summary = Optional.ofNullable(summary); - return this; - } - - @JsonSetter(value = "topics", nulls = Nulls.SKIP) - public Builder topics(Optional topics) { - this.topics = topics; - return this; - } - - public Builder topics(SharedTopics topics) { - this.topics = Optional.ofNullable(topics); - return this; - } - - @JsonSetter(value = "intents", nulls = Nulls.SKIP) - public Builder intents(Optional intents) { - this.intents = intents; - return this; - } - - public Builder intents(SharedIntents intents) { - this.intents = Optional.ofNullable(intents); - return this; - } - - @JsonSetter(value = "sentiments", nulls = Nulls.SKIP) - public Builder sentiments(Optional sentiments) { - this.sentiments = sentiments; - return this; - } - - public Builder sentiments(SharedSentiments sentiments) { - this.sentiments = Optional.ofNullable(sentiments); - return this; - } - - public ReadV1ResponseResults build() { - return new ReadV1ResponseResults(summary, topics, intents, sentiments, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ReadV1ResponseResultsSummary.java b/src/main/java/types/ReadV1ResponseResultsSummary.java deleted file mode 100644 index 123dcc1..0000000 --- a/src/main/java/types/ReadV1ResponseResultsSummary.java +++ /dev/null @@ -1,105 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ReadV1ResponseResultsSummary.Builder.class) -public final class ReadV1ResponseResultsSummary { - private final Optional results; - - private final Map additionalProperties; - - private ReadV1ResponseResultsSummary( - Optional results, - Map additionalProperties) { - this.results = results; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("results") - public Optional getResults() { - return results; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ReadV1ResponseResultsSummary - && equalTo((ReadV1ResponseResultsSummary) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ReadV1ResponseResultsSummary other) { - return results.equals(other.results); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.results); - } - - @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(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ReadV1ResponseResultsSummary other) { - results(other.getResults()); - return this; - } - - @JsonSetter(value = "results", nulls = Nulls.SKIP) - public Builder results(Optional results) { - this.results = results; - return this; - } - - public Builder results(ReadV1ResponseResultsSummaryResults results) { - this.results = Optional.ofNullable(results); - return this; - } - - public ReadV1ResponseResultsSummary build() { - return new ReadV1ResponseResultsSummary(results, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ReadV1ResponseResultsSummaryResults.java b/src/main/java/types/ReadV1ResponseResultsSummaryResults.java deleted file mode 100644 index f999085..0000000 --- a/src/main/java/types/ReadV1ResponseResultsSummaryResults.java +++ /dev/null @@ -1,105 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ReadV1ResponseResultsSummaryResults.Builder.class) -public final class ReadV1ResponseResultsSummaryResults { - private final Optional summary; - - private final Map additionalProperties; - - private ReadV1ResponseResultsSummaryResults( - Optional summary, - Map additionalProperties) { - this.summary = summary; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("summary") - public Optional getSummary() { - return summary; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ReadV1ResponseResultsSummaryResults - && equalTo((ReadV1ResponseResultsSummaryResults) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ReadV1ResponseResultsSummaryResults other) { - return summary.equals(other.summary); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.summary); - } - - @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(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ReadV1ResponseResultsSummaryResults other) { - summary(other.getSummary()); - return this; - } - - @JsonSetter(value = "summary", nulls = Nulls.SKIP) - public Builder summary(Optional summary) { - this.summary = summary; - return this; - } - - public Builder summary(ReadV1ResponseResultsSummaryResultsSummary summary) { - this.summary = Optional.ofNullable(summary); - return this; - } - - public ReadV1ResponseResultsSummaryResults build() { - return new ReadV1ResponseResultsSummaryResults(summary, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ReadV1ResponseResultsSummaryResultsSummary.java b/src/main/java/types/ReadV1ResponseResultsSummaryResultsSummary.java deleted file mode 100644 index d7962c5..0000000 --- a/src/main/java/types/ReadV1ResponseResultsSummaryResultsSummary.java +++ /dev/null @@ -1,104 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ReadV1ResponseResultsSummaryResultsSummary.Builder.class) -public final class ReadV1ResponseResultsSummaryResultsSummary { - private final Optional text; - - private final Map additionalProperties; - - private ReadV1ResponseResultsSummaryResultsSummary( - Optional text, Map additionalProperties) { - this.text = text; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("text") - public Optional getText() { - return text; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ReadV1ResponseResultsSummaryResultsSummary - && equalTo((ReadV1ResponseResultsSummaryResultsSummary) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ReadV1ResponseResultsSummaryResultsSummary other) { - return text.equals(other.text); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.text); - } - - @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 text = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ReadV1ResponseResultsSummaryResultsSummary other) { - text(other.getText()); - return this; - } - - @JsonSetter(value = "text", nulls = Nulls.SKIP) - public Builder text(Optional text) { - this.text = text; - return this; - } - - public Builder text(String text) { - this.text = Optional.ofNullable(text); - return this; - } - - public ReadV1ResponseResultsSummaryResultsSummary build() { - return new ReadV1ResponseResultsSummaryResultsSummary(text, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/SharedIntents.java b/src/main/java/types/SharedIntents.java deleted file mode 100644 index 0b566a1..0000000 --- a/src/main/java/types/SharedIntents.java +++ /dev/null @@ -1,103 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = SharedIntents.Builder.class) -public final class SharedIntents { - private final Optional results; - - private final Map additionalProperties; - - private SharedIntents( - Optional results, Map additionalProperties) { - this.results = results; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("results") - public Optional getResults() { - return results; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SharedIntents && equalTo((SharedIntents) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(SharedIntents other) { - return results.equals(other.results); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.results); - } - - @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(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(SharedIntents other) { - results(other.getResults()); - return this; - } - - @JsonSetter(value = "results", nulls = Nulls.SKIP) - public Builder results(Optional results) { - this.results = results; - return this; - } - - public Builder results(SharedIntentsResults results) { - this.results = Optional.ofNullable(results); - return this; - } - - public SharedIntents build() { - return new SharedIntents(results, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/SharedIntentsResults.java b/src/main/java/types/SharedIntentsResults.java deleted file mode 100644 index addf2f8..0000000 --- a/src/main/java/types/SharedIntentsResults.java +++ /dev/null @@ -1,103 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = SharedIntentsResults.Builder.class) -public final class SharedIntentsResults { - private final Optional intents; - - private final Map additionalProperties; - - private SharedIntentsResults( - Optional intents, Map additionalProperties) { - this.intents = intents; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("intents") - public Optional getIntents() { - return intents; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SharedIntentsResults && equalTo((SharedIntentsResults) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(SharedIntentsResults other) { - return intents.equals(other.intents); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.intents); - } - - @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 intents = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(SharedIntentsResults other) { - intents(other.getIntents()); - return this; - } - - @JsonSetter(value = "intents", nulls = Nulls.SKIP) - public Builder intents(Optional intents) { - this.intents = intents; - return this; - } - - public Builder intents(SharedIntentsResultsIntents intents) { - this.intents = Optional.ofNullable(intents); - return this; - } - - public SharedIntentsResults build() { - return new SharedIntentsResults(intents, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/SharedIntentsResultsIntents.java b/src/main/java/types/SharedIntentsResultsIntents.java deleted file mode 100644 index 08629ac..0000000 --- a/src/main/java/types/SharedIntentsResultsIntents.java +++ /dev/null @@ -1,106 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = SharedIntentsResultsIntents.Builder.class) -public final class SharedIntentsResultsIntents { - private final Optional> segments; - - private final Map additionalProperties; - - private SharedIntentsResultsIntents( - Optional> segments, - Map additionalProperties) { - this.segments = segments; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("segments") - public Optional> getSegments() { - return segments; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SharedIntentsResultsIntents - && equalTo((SharedIntentsResultsIntents) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(SharedIntentsResultsIntents other) { - return segments.equals(other.segments); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.segments); - } - - @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> segments = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(SharedIntentsResultsIntents other) { - segments(other.getSegments()); - return this; - } - - @JsonSetter(value = "segments", nulls = Nulls.SKIP) - public Builder segments(Optional> segments) { - this.segments = segments; - return this; - } - - public Builder segments(List segments) { - this.segments = Optional.ofNullable(segments); - return this; - } - - public SharedIntentsResultsIntents build() { - return new SharedIntentsResultsIntents(segments, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/SharedIntentsResultsIntentsSegmentsItem.java b/src/main/java/types/SharedIntentsResultsIntentsSegmentsItem.java deleted file mode 100644 index 5b517bf..0000000 --- a/src/main/java/types/SharedIntentsResultsIntentsSegmentsItem.java +++ /dev/null @@ -1,181 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = SharedIntentsResultsIntentsSegmentsItem.Builder.class) -public final class SharedIntentsResultsIntentsSegmentsItem { - private final Optional text; - - private final Optional startWord; - - private final Optional endWord; - - private final Optional> intents; - - private final Map additionalProperties; - - private SharedIntentsResultsIntentsSegmentsItem( - Optional text, - Optional startWord, - Optional endWord, - Optional> intents, - Map additionalProperties) { - this.text = text; - this.startWord = startWord; - this.endWord = endWord; - this.intents = intents; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("text") - public Optional getText() { - return text; - } - - @JsonProperty("start_word") - public Optional getStartWord() { - return startWord; - } - - @JsonProperty("end_word") - public Optional getEndWord() { - return endWord; - } - - @JsonProperty("intents") - public Optional> getIntents() { - return intents; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SharedIntentsResultsIntentsSegmentsItem - && equalTo((SharedIntentsResultsIntentsSegmentsItem) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(SharedIntentsResultsIntentsSegmentsItem other) { - return text.equals(other.text) - && startWord.equals(other.startWord) - && endWord.equals(other.endWord) - && intents.equals(other.intents); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.text, this.startWord, this.endWord, this.intents); - } - - @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 text = Optional.empty(); - - private Optional startWord = Optional.empty(); - - private Optional endWord = Optional.empty(); - - private Optional> intents = - Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(SharedIntentsResultsIntentsSegmentsItem other) { - text(other.getText()); - startWord(other.getStartWord()); - endWord(other.getEndWord()); - intents(other.getIntents()); - return this; - } - - @JsonSetter(value = "text", nulls = Nulls.SKIP) - public Builder text(Optional text) { - this.text = text; - return this; - } - - public Builder text(String text) { - this.text = Optional.ofNullable(text); - return this; - } - - @JsonSetter(value = "start_word", nulls = Nulls.SKIP) - public Builder startWord(Optional startWord) { - this.startWord = startWord; - return this; - } - - public Builder startWord(Double startWord) { - this.startWord = Optional.ofNullable(startWord); - return this; - } - - @JsonSetter(value = "end_word", nulls = Nulls.SKIP) - public Builder endWord(Optional endWord) { - this.endWord = endWord; - return this; - } - - public Builder endWord(Double endWord) { - this.endWord = Optional.ofNullable(endWord); - return this; - } - - @JsonSetter(value = "intents", nulls = Nulls.SKIP) - public Builder intents( - Optional> intents) { - this.intents = intents; - return this; - } - - public Builder intents(List intents) { - this.intents = Optional.ofNullable(intents); - return this; - } - - public SharedIntentsResultsIntentsSegmentsItem build() { - return new SharedIntentsResultsIntentsSegmentsItem( - text, startWord, endWord, intents, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/SharedIntentsResultsIntentsSegmentsItemIntentsItem.java b/src/main/java/types/SharedIntentsResultsIntentsSegmentsItemIntentsItem.java deleted file mode 100644 index 399f851..0000000 --- a/src/main/java/types/SharedIntentsResultsIntentsSegmentsItemIntentsItem.java +++ /dev/null @@ -1,129 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = SharedIntentsResultsIntentsSegmentsItemIntentsItem.Builder.class) -public final class SharedIntentsResultsIntentsSegmentsItemIntentsItem { - private final Optional intent; - - private final Optional confidenceScore; - - private final Map additionalProperties; - - private SharedIntentsResultsIntentsSegmentsItemIntentsItem( - Optional intent, - Optional confidenceScore, - Map additionalProperties) { - this.intent = intent; - this.confidenceScore = confidenceScore; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("intent") - public Optional getIntent() { - return intent; - } - - @JsonProperty("confidence_score") - public Optional getConfidenceScore() { - return confidenceScore; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SharedIntentsResultsIntentsSegmentsItemIntentsItem - && equalTo((SharedIntentsResultsIntentsSegmentsItemIntentsItem) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(SharedIntentsResultsIntentsSegmentsItemIntentsItem other) { - return intent.equals(other.intent) && confidenceScore.equals(other.confidenceScore); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.intent, this.confidenceScore); - } - - @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 intent = Optional.empty(); - - private Optional confidenceScore = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(SharedIntentsResultsIntentsSegmentsItemIntentsItem other) { - intent(other.getIntent()); - confidenceScore(other.getConfidenceScore()); - return this; - } - - @JsonSetter(value = "intent", nulls = Nulls.SKIP) - public Builder intent(Optional intent) { - this.intent = intent; - return this; - } - - public Builder intent(String intent) { - this.intent = Optional.ofNullable(intent); - return this; - } - - @JsonSetter(value = "confidence_score", nulls = Nulls.SKIP) - public Builder confidenceScore(Optional confidenceScore) { - this.confidenceScore = confidenceScore; - return this; - } - - public Builder confidenceScore(Float confidenceScore) { - this.confidenceScore = Optional.ofNullable(confidenceScore); - return this; - } - - public SharedIntentsResultsIntentsSegmentsItemIntentsItem build() { - return new SharedIntentsResultsIntentsSegmentsItemIntentsItem( - intent, confidenceScore, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/SharedSentiments.java b/src/main/java/types/SharedSentiments.java deleted file mode 100644 index a0ee8e3..0000000 --- a/src/main/java/types/SharedSentiments.java +++ /dev/null @@ -1,128 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = SharedSentiments.Builder.class) -public final class SharedSentiments { - private final Optional> segments; - - private final Optional average; - - private final Map additionalProperties; - - private SharedSentiments( - Optional> segments, - Optional average, - Map additionalProperties) { - this.segments = segments; - this.average = average; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("segments") - public Optional> getSegments() { - return segments; - } - - @JsonProperty("average") - public Optional getAverage() { - return average; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SharedSentiments && equalTo((SharedSentiments) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(SharedSentiments other) { - return segments.equals(other.segments) && average.equals(other.average); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.segments, this.average); - } - - @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> segments = Optional.empty(); - - private Optional average = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(SharedSentiments other) { - segments(other.getSegments()); - average(other.getAverage()); - return this; - } - - @JsonSetter(value = "segments", nulls = Nulls.SKIP) - public Builder segments(Optional> segments) { - this.segments = segments; - return this; - } - - public Builder segments(List segments) { - this.segments = Optional.ofNullable(segments); - return this; - } - - @JsonSetter(value = "average", nulls = Nulls.SKIP) - public Builder average(Optional average) { - this.average = average; - return this; - } - - public Builder average(SharedSentimentsAverage average) { - this.average = Optional.ofNullable(average); - return this; - } - - public SharedSentiments build() { - return new SharedSentiments(segments, average, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/SharedSentimentsAverage.java b/src/main/java/types/SharedSentimentsAverage.java deleted file mode 100644 index afd6a2b..0000000 --- a/src/main/java/types/SharedSentimentsAverage.java +++ /dev/null @@ -1,127 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = SharedSentimentsAverage.Builder.class) -public final class SharedSentimentsAverage { - private final Optional sentiment; - - private final Optional sentimentScore; - - private final Map additionalProperties; - - private SharedSentimentsAverage( - Optional sentiment, - Optional sentimentScore, - Map additionalProperties) { - this.sentiment = sentiment; - this.sentimentScore = sentimentScore; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("sentiment") - public Optional getSentiment() { - return sentiment; - } - - @JsonProperty("sentiment_score") - public Optional getSentimentScore() { - return sentimentScore; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SharedSentimentsAverage && equalTo((SharedSentimentsAverage) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(SharedSentimentsAverage other) { - return sentiment.equals(other.sentiment) && sentimentScore.equals(other.sentimentScore); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.sentiment, this.sentimentScore); - } - - @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 sentiment = Optional.empty(); - - private Optional sentimentScore = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(SharedSentimentsAverage other) { - sentiment(other.getSentiment()); - sentimentScore(other.getSentimentScore()); - return this; - } - - @JsonSetter(value = "sentiment", nulls = Nulls.SKIP) - public Builder sentiment(Optional sentiment) { - this.sentiment = sentiment; - return this; - } - - public Builder sentiment(String sentiment) { - this.sentiment = Optional.ofNullable(sentiment); - return this; - } - - @JsonSetter(value = "sentiment_score", nulls = Nulls.SKIP) - public Builder sentimentScore(Optional sentimentScore) { - this.sentimentScore = sentimentScore; - return this; - } - - public Builder sentimentScore(Double sentimentScore) { - this.sentimentScore = Optional.ofNullable(sentimentScore); - return this; - } - - public SharedSentimentsAverage build() { - return new SharedSentimentsAverage(sentiment, sentimentScore, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/SharedSentimentsSegmentsItem.java b/src/main/java/types/SharedSentimentsSegmentsItem.java deleted file mode 100644 index 72b8e28..0000000 --- a/src/main/java/types/SharedSentimentsSegmentsItem.java +++ /dev/null @@ -1,203 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = SharedSentimentsSegmentsItem.Builder.class) -public final class SharedSentimentsSegmentsItem { - private final Optional text; - - private final Optional startWord; - - private final Optional endWord; - - private final Optional sentiment; - - private final Optional sentimentScore; - - private final Map additionalProperties; - - private SharedSentimentsSegmentsItem( - Optional text, - Optional startWord, - Optional endWord, - Optional sentiment, - Optional sentimentScore, - Map additionalProperties) { - this.text = text; - this.startWord = startWord; - this.endWord = endWord; - this.sentiment = sentiment; - this.sentimentScore = sentimentScore; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("text") - public Optional getText() { - return text; - } - - @JsonProperty("start_word") - public Optional getStartWord() { - return startWord; - } - - @JsonProperty("end_word") - public Optional getEndWord() { - return endWord; - } - - @JsonProperty("sentiment") - public Optional getSentiment() { - return sentiment; - } - - @JsonProperty("sentiment_score") - public Optional getSentimentScore() { - return sentimentScore; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SharedSentimentsSegmentsItem - && equalTo((SharedSentimentsSegmentsItem) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(SharedSentimentsSegmentsItem other) { - return text.equals(other.text) - && startWord.equals(other.startWord) - && endWord.equals(other.endWord) - && sentiment.equals(other.sentiment) - && sentimentScore.equals(other.sentimentScore); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.text, this.startWord, this.endWord, this.sentiment, this.sentimentScore); - } - - @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 text = Optional.empty(); - - private Optional startWord = Optional.empty(); - - private Optional endWord = Optional.empty(); - - private Optional sentiment = Optional.empty(); - - private Optional sentimentScore = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(SharedSentimentsSegmentsItem other) { - text(other.getText()); - startWord(other.getStartWord()); - endWord(other.getEndWord()); - sentiment(other.getSentiment()); - sentimentScore(other.getSentimentScore()); - return this; - } - - @JsonSetter(value = "text", nulls = Nulls.SKIP) - public Builder text(Optional text) { - this.text = text; - return this; - } - - public Builder text(String text) { - this.text = Optional.ofNullable(text); - return this; - } - - @JsonSetter(value = "start_word", nulls = Nulls.SKIP) - public Builder startWord(Optional startWord) { - this.startWord = startWord; - return this; - } - - public Builder startWord(Double startWord) { - this.startWord = Optional.ofNullable(startWord); - return this; - } - - @JsonSetter(value = "end_word", nulls = Nulls.SKIP) - public Builder endWord(Optional endWord) { - this.endWord = endWord; - return this; - } - - public Builder endWord(Double endWord) { - this.endWord = Optional.ofNullable(endWord); - return this; - } - - @JsonSetter(value = "sentiment", nulls = Nulls.SKIP) - public Builder sentiment(Optional sentiment) { - this.sentiment = sentiment; - return this; - } - - public Builder sentiment(String sentiment) { - this.sentiment = Optional.ofNullable(sentiment); - return this; - } - - @JsonSetter(value = "sentiment_score", nulls = Nulls.SKIP) - public Builder sentimentScore(Optional sentimentScore) { - this.sentimentScore = sentimentScore; - return this; - } - - public Builder sentimentScore(Double sentimentScore) { - this.sentimentScore = Optional.ofNullable(sentimentScore); - return this; - } - - public SharedSentimentsSegmentsItem build() { - return new SharedSentimentsSegmentsItem( - text, startWord, endWord, sentiment, sentimentScore, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/SharedTopics.java b/src/main/java/types/SharedTopics.java deleted file mode 100644 index 44c0287..0000000 --- a/src/main/java/types/SharedTopics.java +++ /dev/null @@ -1,103 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = SharedTopics.Builder.class) -public final class SharedTopics { - private final Optional results; - - private final Map additionalProperties; - - private SharedTopics( - Optional results, Map additionalProperties) { - this.results = results; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("results") - public Optional getResults() { - return results; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SharedTopics && equalTo((SharedTopics) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(SharedTopics other) { - return results.equals(other.results); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.results); - } - - @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(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(SharedTopics other) { - results(other.getResults()); - return this; - } - - @JsonSetter(value = "results", nulls = Nulls.SKIP) - public Builder results(Optional results) { - this.results = results; - return this; - } - - public Builder results(SharedTopicsResults results) { - this.results = Optional.ofNullable(results); - return this; - } - - public SharedTopics build() { - return new SharedTopics(results, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/SharedTopicsResults.java b/src/main/java/types/SharedTopicsResults.java deleted file mode 100644 index 8a70a44..0000000 --- a/src/main/java/types/SharedTopicsResults.java +++ /dev/null @@ -1,103 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = SharedTopicsResults.Builder.class) -public final class SharedTopicsResults { - private final Optional topics; - - private final Map additionalProperties; - - private SharedTopicsResults( - Optional topics, Map additionalProperties) { - this.topics = topics; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("topics") - public Optional getTopics() { - return topics; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SharedTopicsResults && equalTo((SharedTopicsResults) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(SharedTopicsResults other) { - return topics.equals(other.topics); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.topics); - } - - @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 topics = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(SharedTopicsResults other) { - topics(other.getTopics()); - return this; - } - - @JsonSetter(value = "topics", nulls = Nulls.SKIP) - public Builder topics(Optional topics) { - this.topics = topics; - return this; - } - - public Builder topics(SharedTopicsResultsTopics topics) { - this.topics = Optional.ofNullable(topics); - return this; - } - - public SharedTopicsResults build() { - return new SharedTopicsResults(topics, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/SharedTopicsResultsTopics.java b/src/main/java/types/SharedTopicsResultsTopics.java deleted file mode 100644 index 58afe92..0000000 --- a/src/main/java/types/SharedTopicsResultsTopics.java +++ /dev/null @@ -1,105 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = SharedTopicsResultsTopics.Builder.class) -public final class SharedTopicsResultsTopics { - private final Optional> segments; - - private final Map additionalProperties; - - private SharedTopicsResultsTopics( - Optional> segments, - Map additionalProperties) { - this.segments = segments; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("segments") - public Optional> getSegments() { - return segments; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SharedTopicsResultsTopics && equalTo((SharedTopicsResultsTopics) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(SharedTopicsResultsTopics other) { - return segments.equals(other.segments); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.segments); - } - - @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> segments = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(SharedTopicsResultsTopics other) { - segments(other.getSegments()); - return this; - } - - @JsonSetter(value = "segments", nulls = Nulls.SKIP) - public Builder segments(Optional> segments) { - this.segments = segments; - return this; - } - - public Builder segments(List segments) { - this.segments = Optional.ofNullable(segments); - return this; - } - - public SharedTopicsResultsTopics build() { - return new SharedTopicsResultsTopics(segments, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/SharedTopicsResultsTopicsSegmentsItem.java b/src/main/java/types/SharedTopicsResultsTopicsSegmentsItem.java deleted file mode 100644 index 33b022d..0000000 --- a/src/main/java/types/SharedTopicsResultsTopicsSegmentsItem.java +++ /dev/null @@ -1,180 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = SharedTopicsResultsTopicsSegmentsItem.Builder.class) -public final class SharedTopicsResultsTopicsSegmentsItem { - private final Optional text; - - private final Optional startWord; - - private final Optional endWord; - - private final Optional> topics; - - private final Map additionalProperties; - - private SharedTopicsResultsTopicsSegmentsItem( - Optional text, - Optional startWord, - Optional endWord, - Optional> topics, - Map additionalProperties) { - this.text = text; - this.startWord = startWord; - this.endWord = endWord; - this.topics = topics; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("text") - public Optional getText() { - return text; - } - - @JsonProperty("start_word") - public Optional getStartWord() { - return startWord; - } - - @JsonProperty("end_word") - public Optional getEndWord() { - return endWord; - } - - @JsonProperty("topics") - public Optional> getTopics() { - return topics; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SharedTopicsResultsTopicsSegmentsItem - && equalTo((SharedTopicsResultsTopicsSegmentsItem) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(SharedTopicsResultsTopicsSegmentsItem other) { - return text.equals(other.text) - && startWord.equals(other.startWord) - && endWord.equals(other.endWord) - && topics.equals(other.topics); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.text, this.startWord, this.endWord, this.topics); - } - - @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 text = Optional.empty(); - - private Optional startWord = Optional.empty(); - - private Optional endWord = Optional.empty(); - - private Optional> topics = - Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(SharedTopicsResultsTopicsSegmentsItem other) { - text(other.getText()); - startWord(other.getStartWord()); - endWord(other.getEndWord()); - topics(other.getTopics()); - return this; - } - - @JsonSetter(value = "text", nulls = Nulls.SKIP) - public Builder text(Optional text) { - this.text = text; - return this; - } - - public Builder text(String text) { - this.text = Optional.ofNullable(text); - return this; - } - - @JsonSetter(value = "start_word", nulls = Nulls.SKIP) - public Builder startWord(Optional startWord) { - this.startWord = startWord; - return this; - } - - public Builder startWord(Double startWord) { - this.startWord = Optional.ofNullable(startWord); - return this; - } - - @JsonSetter(value = "end_word", nulls = Nulls.SKIP) - public Builder endWord(Optional endWord) { - this.endWord = endWord; - return this; - } - - public Builder endWord(Double endWord) { - this.endWord = Optional.ofNullable(endWord); - return this; - } - - @JsonSetter(value = "topics", nulls = Nulls.SKIP) - public Builder topics(Optional> topics) { - this.topics = topics; - return this; - } - - public Builder topics(List topics) { - this.topics = Optional.ofNullable(topics); - return this; - } - - public SharedTopicsResultsTopicsSegmentsItem build() { - return new SharedTopicsResultsTopicsSegmentsItem( - text, startWord, endWord, topics, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/SharedTopicsResultsTopicsSegmentsItemTopicsItem.java b/src/main/java/types/SharedTopicsResultsTopicsSegmentsItemTopicsItem.java deleted file mode 100644 index 04a3d66..0000000 --- a/src/main/java/types/SharedTopicsResultsTopicsSegmentsItemTopicsItem.java +++ /dev/null @@ -1,129 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = SharedTopicsResultsTopicsSegmentsItemTopicsItem.Builder.class) -public final class SharedTopicsResultsTopicsSegmentsItemTopicsItem { - private final Optional topic; - - private final Optional confidenceScore; - - private final Map additionalProperties; - - private SharedTopicsResultsTopicsSegmentsItemTopicsItem( - Optional topic, - Optional confidenceScore, - Map additionalProperties) { - this.topic = topic; - this.confidenceScore = confidenceScore; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("topic") - public Optional getTopic() { - return topic; - } - - @JsonProperty("confidence_score") - public Optional getConfidenceScore() { - return confidenceScore; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SharedTopicsResultsTopicsSegmentsItemTopicsItem - && equalTo((SharedTopicsResultsTopicsSegmentsItemTopicsItem) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(SharedTopicsResultsTopicsSegmentsItemTopicsItem other) { - return topic.equals(other.topic) && confidenceScore.equals(other.confidenceScore); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.topic, this.confidenceScore); - } - - @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 topic = Optional.empty(); - - private Optional confidenceScore = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(SharedTopicsResultsTopicsSegmentsItemTopicsItem other) { - topic(other.getTopic()); - confidenceScore(other.getConfidenceScore()); - return this; - } - - @JsonSetter(value = "topic", nulls = Nulls.SKIP) - public Builder topic(Optional topic) { - this.topic = topic; - return this; - } - - public Builder topic(String topic) { - this.topic = Optional.ofNullable(topic); - return this; - } - - @JsonSetter(value = "confidence_score", nulls = Nulls.SKIP) - public Builder confidenceScore(Optional confidenceScore) { - this.confidenceScore = confidenceScore; - return this; - } - - public Builder confidenceScore(Float confidenceScore) { - this.confidenceScore = Optional.ofNullable(confidenceScore); - return this; - } - - public SharedTopicsResultsTopicsSegmentsItemTopicsItem build() { - return new SharedTopicsResultsTopicsSegmentsItemTopicsItem( - topic, confidenceScore, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/SpeakSettingsV1.java b/src/main/java/types/SpeakSettingsV1.java deleted file mode 100644 index 9b95c70..0000000 --- a/src/main/java/types/SpeakSettingsV1.java +++ /dev/null @@ -1,170 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = SpeakSettingsV1.Builder.class) -public final class SpeakSettingsV1 { - private final SpeakSettingsV1Provider provider; - - private final Optional endpoint; - - private final Map additionalProperties; - - private SpeakSettingsV1( - SpeakSettingsV1Provider provider, - Optional endpoint, - Map additionalProperties) { - this.provider = provider; - this.endpoint = endpoint; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("provider") - public SpeakSettingsV1Provider getProvider() { - return provider; - } - - /** - * @return Optional if provider is Deepgram. Required for non-Deepgram TTS providers. When - * present, must include url field and headers object. Valid schemes are https and wss with - * wss only supported for Eleven Labs. - */ - @JsonProperty("endpoint") - public Optional getEndpoint() { - return endpoint; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SpeakSettingsV1 && equalTo((SpeakSettingsV1) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(SpeakSettingsV1 other) { - return provider.equals(other.provider) && endpoint.equals(other.endpoint); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.provider, this.endpoint); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static ProviderStage builder() { - return new Builder(); - } - - public interface ProviderStage { - _FinalStage provider(@NotNull SpeakSettingsV1Provider provider); - - Builder from(SpeakSettingsV1 other); - } - - public interface _FinalStage { - SpeakSettingsV1 build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** - * Optional if provider is Deepgram. Required for non-Deepgram TTS providers. When present, must - * include url field and headers object. Valid schemes are https and wss with wss only supported - * for Eleven Labs. - */ - _FinalStage endpoint(Optional endpoint); - - _FinalStage endpoint(SpeakSettingsV1Endpoint endpoint); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements ProviderStage, _FinalStage { - private SpeakSettingsV1Provider provider; - - private Optional endpoint = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(SpeakSettingsV1 other) { - provider(other.getProvider()); - endpoint(other.getEndpoint()); - return this; - } - - @java.lang.Override - @JsonSetter("provider") - public _FinalStage provider(@NotNull SpeakSettingsV1Provider provider) { - this.provider = Objects.requireNonNull(provider, "provider must not be null"); - return this; - } - - /** - * Optional if provider is Deepgram. Required for non-Deepgram TTS providers. When present, must - * include url field and headers object. Valid schemes are https and wss with wss only supported - * for Eleven Labs. - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage endpoint(SpeakSettingsV1Endpoint endpoint) { - this.endpoint = Optional.ofNullable(endpoint); - return this; - } - - /** - * Optional if provider is Deepgram. Required for non-Deepgram TTS providers. When present, must - * include url field and headers object. Valid schemes are https and wss with wss only supported - * for Eleven Labs. - */ - @java.lang.Override - @JsonSetter(value = "endpoint", nulls = Nulls.SKIP) - public _FinalStage endpoint(Optional endpoint) { - this.endpoint = endpoint; - return this; - } - - @java.lang.Override - public SpeakSettingsV1 build() { - return new SpeakSettingsV1(provider, endpoint, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/SpeakSettingsV1Endpoint.java b/src/main/java/types/SpeakSettingsV1Endpoint.java deleted file mode 100644 index e971401..0000000 --- a/src/main/java/types/SpeakSettingsV1Endpoint.java +++ /dev/null @@ -1,135 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = SpeakSettingsV1Endpoint.Builder.class) -public final class SpeakSettingsV1Endpoint { - private final Optional url; - - private final Optional> headers; - - private final Map additionalProperties; - - private SpeakSettingsV1Endpoint( - Optional url, - Optional> headers, - Map additionalProperties) { - this.url = url; - this.headers = headers; - this.additionalProperties = additionalProperties; - } - - /** - * @return Custom TTS endpoint URL. Cannot contain output_format or model_id - * query parameters when the provider is Eleven Labs. - */ - @JsonProperty("url") - public Optional getUrl() { - return url; - } - - @JsonProperty("headers") - public Optional> getHeaders() { - return headers; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SpeakSettingsV1Endpoint && equalTo((SpeakSettingsV1Endpoint) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(SpeakSettingsV1Endpoint other) { - return url.equals(other.url) && headers.equals(other.headers); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.url, this.headers); - } - - @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 url = Optional.empty(); - - private Optional> headers = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(SpeakSettingsV1Endpoint other) { - url(other.getUrl()); - headers(other.getHeaders()); - return this; - } - - /** - * Custom TTS endpoint URL. Cannot contain output_format or model_id - * query parameters when the provider is Eleven Labs. - */ - @JsonSetter(value = "url", nulls = Nulls.SKIP) - public Builder url(Optional url) { - this.url = url; - return this; - } - - public Builder url(String url) { - this.url = Optional.ofNullable(url); - return this; - } - - @JsonSetter(value = "headers", nulls = Nulls.SKIP) - public Builder headers(Optional> headers) { - this.headers = headers; - return this; - } - - public Builder headers(Map headers) { - this.headers = Optional.ofNullable(headers); - return this; - } - - public SpeakSettingsV1Endpoint build() { - return new SpeakSettingsV1Endpoint(url, headers, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/SpeakSettingsV1Provider.java b/src/main/java/types/SpeakSettingsV1Provider.java deleted file mode 100644 index 5941bf7..0000000 --- a/src/main/java/types/SpeakSettingsV1Provider.java +++ /dev/null @@ -1,400 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package 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 SpeakSettingsV1Provider { - private final Value value; - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - private SpeakSettingsV1Provider(Value value) { - this.value = value; - } - - public T visit(Visitor visitor) { - return value.visit(visitor); - } - - public static SpeakSettingsV1Provider deepgram(Deepgram value) { - return new SpeakSettingsV1Provider(new DeepgramValue(value)); - } - - public static SpeakSettingsV1Provider elevenLabs(ElevenLabsSpeakProvider value) { - return new SpeakSettingsV1Provider(new ElevenLabsValue(value)); - } - - public static SpeakSettingsV1Provider cartesia(Cartesia value) { - return new SpeakSettingsV1Provider(new CartesiaValue(value)); - } - - public static SpeakSettingsV1Provider openAi(OpenAiSpeakProvider value) { - return new SpeakSettingsV1Provider(new OpenAiValue(value)); - } - - public static SpeakSettingsV1Provider awsPolly(AwsPollySpeakProvider value) { - return new SpeakSettingsV1Provider(new AwsPollyValue(value)); - } - - public boolean isDeepgram() { - return value instanceof DeepgramValue; - } - - public boolean isElevenLabs() { - return value instanceof ElevenLabsValue; - } - - public boolean isCartesia() { - return value instanceof CartesiaValue; - } - - public boolean isOpenAi() { - return value instanceof OpenAiValue; - } - - public boolean isAwsPolly() { - return value instanceof AwsPollyValue; - } - - public boolean _isUnknown() { - return value instanceof _UnknownValue; - } - - public Optional getDeepgram() { - if (isDeepgram()) { - return Optional.of(((DeepgramValue) value).value); - } - return Optional.empty(); - } - - public Optional getElevenLabs() { - if (isElevenLabs()) { - return Optional.of(((ElevenLabsValue) value).value); - } - return Optional.empty(); - } - - public Optional getCartesia() { - if (isCartesia()) { - return Optional.of(((CartesiaValue) value).value); - } - return Optional.empty(); - } - - public Optional getOpenAi() { - if (isOpenAi()) { - return Optional.of(((OpenAiValue) value).value); - } - return Optional.empty(); - } - - public Optional getAwsPolly() { - if (isAwsPolly()) { - return Optional.of(((AwsPollyValue) value).value); - } - return Optional.empty(); - } - - public Optional _getUnknown() { - if (_isUnknown()) { - return Optional.of(((_UnknownValue) value).value); - } - return Optional.empty(); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SpeakSettingsV1Provider - && value.equals(((SpeakSettingsV1Provider) other).value); - } - - @Override - public int hashCode() { - return Objects.hash(value); - } - - @Override - public String toString() { - return value.toString(); - } - - @JsonValue - private Value getValue() { - return this.value; - } - - public interface Visitor { - T visitDeepgram(Deepgram deepgram); - - T visitElevenLabs(ElevenLabsSpeakProvider elevenLabs); - - T visitCartesia(Cartesia cartesia); - - T visitOpenAi(OpenAiSpeakProvider openAi); - - T visitAwsPolly(AwsPollySpeakProvider awsPolly); - - T _visitUnknown(Object unknownType); - } - - @JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "type", - visible = true, - defaultImpl = _UnknownValue.class) - @JsonSubTypes({ - @JsonSubTypes.Type(DeepgramValue.class), - @JsonSubTypes.Type(ElevenLabsValue.class), - @JsonSubTypes.Type(CartesiaValue.class), - @JsonSubTypes.Type(OpenAiValue.class), - @JsonSubTypes.Type(AwsPollyValue.class) - }) - @JsonIgnoreProperties(ignoreUnknown = true) - private interface Value { - T visit(Visitor visitor); - } - - @JsonTypeName("deepgram") - @JsonIgnoreProperties("type") - private static final class DeepgramValue implements Value { - @JsonUnwrapped - @JsonIgnoreProperties(value = "type", allowSetters = true) - private Deepgram value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private DeepgramValue() {} - - private DeepgramValue(Deepgram 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 "SpeakSettingsV1Provider{" + "value: " + value + "}"; - } - } - - @JsonTypeName("eleven_labs") - @JsonIgnoreProperties("type") - private static final class ElevenLabsValue implements Value { - @JsonUnwrapped - @JsonIgnoreProperties(value = "type", allowSetters = true) - private ElevenLabsSpeakProvider value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private ElevenLabsValue() {} - - private ElevenLabsValue(ElevenLabsSpeakProvider value) { - this.value = value; - } - - @java.lang.Override - public T visit(Visitor visitor) { - return visitor.visitElevenLabs(value); - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ElevenLabsValue && equalTo((ElevenLabsValue) other); - } - - private boolean equalTo(ElevenLabsValue other) { - return value.equals(other.value); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.value); - } - - @java.lang.Override - public String toString() { - return "SpeakSettingsV1Provider{" + "value: " + value + "}"; - } - } - - @JsonTypeName("cartesia") - @JsonIgnoreProperties("type") - private static final class CartesiaValue implements Value { - @JsonUnwrapped - @JsonIgnoreProperties(value = "type", allowSetters = true) - private Cartesia value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private CartesiaValue() {} - - private CartesiaValue(Cartesia 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 "SpeakSettingsV1Provider{" + "value: " + value + "}"; - } - } - - @JsonTypeName("open_ai") - @JsonIgnoreProperties("type") - private static final class OpenAiValue implements Value { - @JsonUnwrapped - @JsonIgnoreProperties(value = "type", allowSetters = true) - private OpenAiSpeakProvider value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private OpenAiValue() {} - - private OpenAiValue(OpenAiSpeakProvider 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 "SpeakSettingsV1Provider{" + "value: " + value + "}"; - } - } - - @JsonTypeName("aws_polly") - @JsonIgnoreProperties("type") - private static final class AwsPollyValue implements Value { - @JsonUnwrapped - @JsonIgnoreProperties(value = "type", allowSetters = true) - private AwsPollySpeakProvider value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private AwsPollyValue() {} - - private AwsPollyValue(AwsPollySpeakProvider value) { - this.value = value; - } - - @java.lang.Override - public T visit(Visitor visitor) { - return visitor.visitAwsPolly(value); - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AwsPollyValue && equalTo((AwsPollyValue) other); - } - - private boolean equalTo(AwsPollyValue other) { - return value.equals(other.value); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.value); - } - - @java.lang.Override - public String toString() { - return "SpeakSettingsV1Provider{" + "value: " + value + "}"; - } - } - - @JsonIgnoreProperties("type") - 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 "SpeakSettingsV1Provider{" + "type: " + type + ", value: " + value + "}"; - } - } -} diff --git a/src/main/java/types/SpeakV1Encoding.java b/src/main/java/types/SpeakV1Encoding.java deleted file mode 100644 index 178a3a3..0000000 --- a/src/main/java/types/SpeakV1Encoding.java +++ /dev/null @@ -1,92 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class SpeakV1Encoding { - public static final SpeakV1Encoding MULAW = new SpeakV1Encoding(Value.MULAW, "mulaw"); - - public static final SpeakV1Encoding LINEAR16 = new SpeakV1Encoding(Value.LINEAR16, "linear16"); - - public static final SpeakV1Encoding ALAW = new SpeakV1Encoding(Value.ALAW, "alaw"); - - private final Value value; - - private final String string; - - SpeakV1Encoding(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof SpeakV1Encoding - && this.string.equals(((SpeakV1Encoding) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case MULAW: - return visitor.visitMulaw(); - case LINEAR16: - return visitor.visitLinear16(); - case ALAW: - return visitor.visitAlaw(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static SpeakV1Encoding valueOf(String value) { - switch (value) { - case "mulaw": - return MULAW; - case "linear16": - return LINEAR16; - case "alaw": - return ALAW; - default: - return new SpeakV1Encoding(Value.UNKNOWN, value); - } - } - - public enum Value { - LINEAR16, - - MULAW, - - ALAW, - - UNKNOWN - } - - public interface Visitor { - T visitLinear16(); - - T visitMulaw(); - - T visitAlaw(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/types/SpeakV1MipOptOut.java b/src/main/java/types/SpeakV1MipOptOut.java deleted file mode 100644 index 57c6a6b..0000000 --- a/src/main/java/types/SpeakV1MipOptOut.java +++ /dev/null @@ -1,41 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import core.WrappedAlias; - -public final class SpeakV1MipOptOut implements WrappedAlias { - private final Object value; - - private SpeakV1MipOptOut(Object value) { - this.value = value; - } - - @JsonValue - public Object get() { - return this.value; - } - - @java.lang.Override - public boolean equals(Object other) { - return this == other - || (other instanceof SpeakV1MipOptOut - && this.value.equals(((SpeakV1MipOptOut) other).value)); - } - - @java.lang.Override - public int hashCode() { - return value.hashCode(); - } - - @java.lang.Override - public String toString() { - return value.toString(); - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static SpeakV1MipOptOut of(Object value) { - return new SpeakV1MipOptOut(value); - } -} diff --git a/src/main/java/types/SpeakV1Model.java b/src/main/java/types/SpeakV1Model.java deleted file mode 100644 index 491f1c6..0000000 --- a/src/main/java/types/SpeakV1Model.java +++ /dev/null @@ -1,754 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class SpeakV1Model { - public static final SpeakV1Model AURA_ANGUS_EN = - new SpeakV1Model(Value.AURA_ANGUS_EN, "aura-angus-en"); - - public static final SpeakV1Model AURA2JUPITER_EN = - new SpeakV1Model(Value.AURA2JUPITER_EN, "aura-2-jupiter-en"); - - public static final SpeakV1Model AURA2CORA_EN = - new SpeakV1Model(Value.AURA2CORA_EN, "aura-2-cora-en"); - - public static final SpeakV1Model AURA_STELLA_EN = - new SpeakV1Model(Value.AURA_STELLA_EN, "aura-stella-en"); - - public static final SpeakV1Model AURA2HELENA_EN = - new SpeakV1Model(Value.AURA2HELENA_EN, "aura-2-helena-en"); - - public static final SpeakV1Model AURA2AQUILA_ES = - new SpeakV1Model(Value.AURA2AQUILA_ES, "aura-2-aquila-es"); - - public static final SpeakV1Model AURA2ATLAS_EN = - new SpeakV1Model(Value.AURA2ATLAS_EN, "aura-2-atlas-en"); - - public static final SpeakV1Model AURA2ORION_EN = - new SpeakV1Model(Value.AURA2ORION_EN, "aura-2-orion-en"); - - public static final SpeakV1Model AURA2DRACO_EN = - new SpeakV1Model(Value.AURA2DRACO_EN, "aura-2-draco-en"); - - public static final SpeakV1Model AURA2HYPERION_EN = - new SpeakV1Model(Value.AURA2HYPERION_EN, "aura-2-hyperion-en"); - - public static final SpeakV1Model AURA2JANUS_EN = - new SpeakV1Model(Value.AURA2JANUS_EN, "aura-2-janus-en"); - - public static final SpeakV1Model AURA_HELIOS_EN = - new SpeakV1Model(Value.AURA_HELIOS_EN, "aura-helios-en"); - - public static final SpeakV1Model AURA2PLUTO_EN = - new SpeakV1Model(Value.AURA2PLUTO_EN, "aura-2-pluto-en"); - - public static final SpeakV1Model AURA2ARCAS_EN = - new SpeakV1Model(Value.AURA2ARCAS_EN, "aura-2-arcas-en"); - - public static final SpeakV1Model AURA2NESTOR_ES = - new SpeakV1Model(Value.AURA2NESTOR_ES, "aura-2-nestor-es"); - - public static final SpeakV1Model AURA2NEPTUNE_EN = - new SpeakV1Model(Value.AURA2NEPTUNE_EN, "aura-2-neptune-en"); - - public static final SpeakV1Model AURA2MINERVA_EN = - new SpeakV1Model(Value.AURA2MINERVA_EN, "aura-2-minerva-en"); - - public static final SpeakV1Model AURA2ALVARO_ES = - new SpeakV1Model(Value.AURA2ALVARO_ES, "aura-2-alvaro-es"); - - public static final SpeakV1Model AURA_ATHENA_EN = - new SpeakV1Model(Value.AURA_ATHENA_EN, "aura-athena-en"); - - public static final SpeakV1Model AURA_PERSEUS_EN = - new SpeakV1Model(Value.AURA_PERSEUS_EN, "aura-perseus-en"); - - public static final SpeakV1Model AURA2ODYSSEUS_EN = - new SpeakV1Model(Value.AURA2ODYSSEUS_EN, "aura-2-odysseus-en"); - - public static final SpeakV1Model AURA2PANDORA_EN = - new SpeakV1Model(Value.AURA2PANDORA_EN, "aura-2-pandora-en"); - - public static final SpeakV1Model AURA2ZEUS_EN = - new SpeakV1Model(Value.AURA2ZEUS_EN, "aura-2-zeus-en"); - - public static final SpeakV1Model AURA2ELECTRA_EN = - new SpeakV1Model(Value.AURA2ELECTRA_EN, "aura-2-electra-en"); - - public static final SpeakV1Model AURA2ORPHEUS_EN = - new SpeakV1Model(Value.AURA2ORPHEUS_EN, "aura-2-orpheus-en"); - - public static final SpeakV1Model AURA2THALIA_EN = - new SpeakV1Model(Value.AURA2THALIA_EN, "aura-2-thalia-en"); - - public static final SpeakV1Model AURA2CELESTE_ES = - new SpeakV1Model(Value.AURA2CELESTE_ES, "aura-2-celeste-es"); - - public static final SpeakV1Model AURA_ASTERIA_EN = - new SpeakV1Model(Value.AURA_ASTERIA_EN, "aura-asteria-en"); - - public static final SpeakV1Model AURA2ESTRELLA_ES = - new SpeakV1Model(Value.AURA2ESTRELLA_ES, "aura-2-estrella-es"); - - public static final SpeakV1Model AURA2HERA_EN = - new SpeakV1Model(Value.AURA2HERA_EN, "aura-2-hera-en"); - - public static final SpeakV1Model AURA2MARS_EN = - new SpeakV1Model(Value.AURA2MARS_EN, "aura-2-mars-en"); - - public static final SpeakV1Model AURA2SIRIO_ES = - new SpeakV1Model(Value.AURA2SIRIO_ES, "aura-2-sirio-es"); - - public static final SpeakV1Model AURA2ASTERIA_EN = - new SpeakV1Model(Value.AURA2ASTERIA_EN, "aura-2-asteria-en"); - - public static final SpeakV1Model AURA2HERMES_EN = - new SpeakV1Model(Value.AURA2HERMES_EN, "aura-2-hermes-en"); - - public static final SpeakV1Model AURA2VESTA_EN = - new SpeakV1Model(Value.AURA2VESTA_EN, "aura-2-vesta-en"); - - public static final SpeakV1Model AURA2CARINA_ES = - new SpeakV1Model(Value.AURA2CARINA_ES, "aura-2-carina-es"); - - public static final SpeakV1Model AURA2CALLISTA_EN = - new SpeakV1Model(Value.AURA2CALLISTA_EN, "aura-2-callista-en"); - - public static final SpeakV1Model AURA2HARMONIA_EN = - new SpeakV1Model(Value.AURA2HARMONIA_EN, "aura-2-harmonia-en"); - - public static final SpeakV1Model AURA2SELENA_ES = - new SpeakV1Model(Value.AURA2SELENA_ES, "aura-2-selena-es"); - - public static final SpeakV1Model AURA2AURORA_EN = - new SpeakV1Model(Value.AURA2AURORA_EN, "aura-2-aurora-en"); - - public static final SpeakV1Model AURA_ZEUS_EN = - new SpeakV1Model(Value.AURA_ZEUS_EN, "aura-zeus-en"); - - public static final SpeakV1Model AURA2OPHELIA_EN = - new SpeakV1Model(Value.AURA2OPHELIA_EN, "aura-2-ophelia-en"); - - public static final SpeakV1Model AURA2AMALTHEA_EN = - new SpeakV1Model(Value.AURA2AMALTHEA_EN, "aura-2-amalthea-en"); - - public static final SpeakV1Model AURA_ORPHEUS_EN = - new SpeakV1Model(Value.AURA_ORPHEUS_EN, "aura-orpheus-en"); - - public static final SpeakV1Model AURA2DELIA_EN = - new SpeakV1Model(Value.AURA2DELIA_EN, "aura-2-delia-en"); - - public static final SpeakV1Model AURA_LUNA_EN = - new SpeakV1Model(Value.AURA_LUNA_EN, "aura-luna-en"); - - public static final SpeakV1Model AURA2APOLLO_EN = - new SpeakV1Model(Value.AURA2APOLLO_EN, "aura-2-apollo-en"); - - public static final SpeakV1Model AURA2SELENE_EN = - new SpeakV1Model(Value.AURA2SELENE_EN, "aura-2-selene-en"); - - public static final SpeakV1Model AURA2THEIA_EN = - new SpeakV1Model(Value.AURA2THEIA_EN, "aura-2-theia-en"); - - public static final SpeakV1Model AURA_HERA_EN = - new SpeakV1Model(Value.AURA_HERA_EN, "aura-hera-en"); - - public static final SpeakV1Model AURA2CORDELIA_EN = - new SpeakV1Model(Value.AURA2CORDELIA_EN, "aura-2-cordelia-en"); - - public static final SpeakV1Model AURA2ANDROMEDA_EN = - new SpeakV1Model(Value.AURA2ANDROMEDA_EN, "aura-2-andromeda-en"); - - public static final SpeakV1Model AURA2ARIES_EN = - new SpeakV1Model(Value.AURA2ARIES_EN, "aura-2-aries-en"); - - public static final SpeakV1Model AURA2JUNO_EN = - new SpeakV1Model(Value.AURA2JUNO_EN, "aura-2-juno-en"); - - public static final SpeakV1Model AURA2LUNA_EN = - new SpeakV1Model(Value.AURA2LUNA_EN, "aura-2-luna-en"); - - public static final SpeakV1Model AURA2DIANA_ES = - new SpeakV1Model(Value.AURA2DIANA_ES, "aura-2-diana-es"); - - public static final SpeakV1Model AURA2JAVIER_ES = - new SpeakV1Model(Value.AURA2JAVIER_ES, "aura-2-javier-es"); - - public static final SpeakV1Model AURA_ORION_EN = - new SpeakV1Model(Value.AURA_ORION_EN, "aura-orion-en"); - - public static final SpeakV1Model AURA_ARCAS_EN = - new SpeakV1Model(Value.AURA_ARCAS_EN, "aura-arcas-en"); - - public static final SpeakV1Model AURA2IRIS_EN = - new SpeakV1Model(Value.AURA2IRIS_EN, "aura-2-iris-en"); - - public static final SpeakV1Model AURA2ATHENA_EN = - new SpeakV1Model(Value.AURA2ATHENA_EN, "aura-2-athena-en"); - - public static final SpeakV1Model AURA2SATURN_EN = - new SpeakV1Model(Value.AURA2SATURN_EN, "aura-2-saturn-en"); - - public static final SpeakV1Model AURA2PHOEBE_EN = - new SpeakV1Model(Value.AURA2PHOEBE_EN, "aura-2-phoebe-en"); - - private final Value value; - - private final String string; - - SpeakV1Model(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof SpeakV1Model && this.string.equals(((SpeakV1Model) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case AURA_ANGUS_EN: - return visitor.visitAuraAngusEn(); - case AURA2JUPITER_EN: - return visitor.visitAura2JupiterEn(); - case AURA2CORA_EN: - return visitor.visitAura2CoraEn(); - case AURA_STELLA_EN: - return visitor.visitAuraStellaEn(); - case AURA2HELENA_EN: - return visitor.visitAura2HelenaEn(); - case AURA2AQUILA_ES: - return visitor.visitAura2AquilaEs(); - case AURA2ATLAS_EN: - return visitor.visitAura2AtlasEn(); - case AURA2ORION_EN: - return visitor.visitAura2OrionEn(); - case AURA2DRACO_EN: - return visitor.visitAura2DracoEn(); - case AURA2HYPERION_EN: - return visitor.visitAura2HyperionEn(); - case AURA2JANUS_EN: - return visitor.visitAura2JanusEn(); - case AURA_HELIOS_EN: - return visitor.visitAuraHeliosEn(); - case AURA2PLUTO_EN: - return visitor.visitAura2PlutoEn(); - case AURA2ARCAS_EN: - return visitor.visitAura2ArcasEn(); - case AURA2NESTOR_ES: - return visitor.visitAura2NestorEs(); - case AURA2NEPTUNE_EN: - return visitor.visitAura2NeptuneEn(); - case AURA2MINERVA_EN: - return visitor.visitAura2MinervaEn(); - case AURA2ALVARO_ES: - return visitor.visitAura2AlvaroEs(); - case AURA_ATHENA_EN: - return visitor.visitAuraAthenaEn(); - case AURA_PERSEUS_EN: - return visitor.visitAuraPerseusEn(); - case AURA2ODYSSEUS_EN: - return visitor.visitAura2OdysseusEn(); - case AURA2PANDORA_EN: - return visitor.visitAura2PandoraEn(); - case AURA2ZEUS_EN: - return visitor.visitAura2ZeusEn(); - case AURA2ELECTRA_EN: - return visitor.visitAura2ElectraEn(); - case AURA2ORPHEUS_EN: - return visitor.visitAura2OrpheusEn(); - case AURA2THALIA_EN: - return visitor.visitAura2ThaliaEn(); - case AURA2CELESTE_ES: - return visitor.visitAura2CelesteEs(); - case AURA_ASTERIA_EN: - return visitor.visitAuraAsteriaEn(); - case AURA2ESTRELLA_ES: - return visitor.visitAura2EstrellaEs(); - case AURA2HERA_EN: - return visitor.visitAura2HeraEn(); - case AURA2MARS_EN: - return visitor.visitAura2MarsEn(); - case AURA2SIRIO_ES: - return visitor.visitAura2SirioEs(); - case AURA2ASTERIA_EN: - return visitor.visitAura2AsteriaEn(); - case AURA2HERMES_EN: - return visitor.visitAura2HermesEn(); - case AURA2VESTA_EN: - return visitor.visitAura2VestaEn(); - case AURA2CARINA_ES: - return visitor.visitAura2CarinaEs(); - case AURA2CALLISTA_EN: - return visitor.visitAura2CallistaEn(); - case AURA2HARMONIA_EN: - return visitor.visitAura2HarmoniaEn(); - case AURA2SELENA_ES: - return visitor.visitAura2SelenaEs(); - case AURA2AURORA_EN: - return visitor.visitAura2AuroraEn(); - case AURA_ZEUS_EN: - return visitor.visitAuraZeusEn(); - case AURA2OPHELIA_EN: - return visitor.visitAura2OpheliaEn(); - case AURA2AMALTHEA_EN: - return visitor.visitAura2AmaltheaEn(); - case AURA_ORPHEUS_EN: - return visitor.visitAuraOrpheusEn(); - case AURA2DELIA_EN: - return visitor.visitAura2DeliaEn(); - case AURA_LUNA_EN: - return visitor.visitAuraLunaEn(); - case AURA2APOLLO_EN: - return visitor.visitAura2ApolloEn(); - case AURA2SELENE_EN: - return visitor.visitAura2SeleneEn(); - case AURA2THEIA_EN: - return visitor.visitAura2TheiaEn(); - case AURA_HERA_EN: - return visitor.visitAuraHeraEn(); - case AURA2CORDELIA_EN: - return visitor.visitAura2CordeliaEn(); - case AURA2ANDROMEDA_EN: - return visitor.visitAura2AndromedaEn(); - case AURA2ARIES_EN: - return visitor.visitAura2AriesEn(); - case AURA2JUNO_EN: - return visitor.visitAura2JunoEn(); - case AURA2LUNA_EN: - return visitor.visitAura2LunaEn(); - case AURA2DIANA_ES: - return visitor.visitAura2DianaEs(); - case AURA2JAVIER_ES: - return visitor.visitAura2JavierEs(); - case AURA_ORION_EN: - return visitor.visitAuraOrionEn(); - case AURA_ARCAS_EN: - return visitor.visitAuraArcasEn(); - case AURA2IRIS_EN: - return visitor.visitAura2IrisEn(); - case AURA2ATHENA_EN: - return visitor.visitAura2AthenaEn(); - case AURA2SATURN_EN: - return visitor.visitAura2SaturnEn(); - case AURA2PHOEBE_EN: - return visitor.visitAura2PhoebeEn(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static SpeakV1Model valueOf(String value) { - switch (value) { - case "aura-angus-en": - return AURA_ANGUS_EN; - case "aura-2-jupiter-en": - return AURA2JUPITER_EN; - case "aura-2-cora-en": - return AURA2CORA_EN; - case "aura-stella-en": - return AURA_STELLA_EN; - case "aura-2-helena-en": - return AURA2HELENA_EN; - case "aura-2-aquila-es": - return AURA2AQUILA_ES; - case "aura-2-atlas-en": - return AURA2ATLAS_EN; - case "aura-2-orion-en": - return AURA2ORION_EN; - case "aura-2-draco-en": - return AURA2DRACO_EN; - case "aura-2-hyperion-en": - return AURA2HYPERION_EN; - case "aura-2-janus-en": - return AURA2JANUS_EN; - case "aura-helios-en": - return AURA_HELIOS_EN; - case "aura-2-pluto-en": - return AURA2PLUTO_EN; - case "aura-2-arcas-en": - return AURA2ARCAS_EN; - case "aura-2-nestor-es": - return AURA2NESTOR_ES; - case "aura-2-neptune-en": - return AURA2NEPTUNE_EN; - case "aura-2-minerva-en": - return AURA2MINERVA_EN; - case "aura-2-alvaro-es": - return AURA2ALVARO_ES; - case "aura-athena-en": - return AURA_ATHENA_EN; - case "aura-perseus-en": - return AURA_PERSEUS_EN; - case "aura-2-odysseus-en": - return AURA2ODYSSEUS_EN; - case "aura-2-pandora-en": - return AURA2PANDORA_EN; - case "aura-2-zeus-en": - return AURA2ZEUS_EN; - case "aura-2-electra-en": - return AURA2ELECTRA_EN; - case "aura-2-orpheus-en": - return AURA2ORPHEUS_EN; - case "aura-2-thalia-en": - return AURA2THALIA_EN; - case "aura-2-celeste-es": - return AURA2CELESTE_ES; - case "aura-asteria-en": - return AURA_ASTERIA_EN; - case "aura-2-estrella-es": - return AURA2ESTRELLA_ES; - case "aura-2-hera-en": - return AURA2HERA_EN; - case "aura-2-mars-en": - return AURA2MARS_EN; - case "aura-2-sirio-es": - return AURA2SIRIO_ES; - case "aura-2-asteria-en": - return AURA2ASTERIA_EN; - case "aura-2-hermes-en": - return AURA2HERMES_EN; - case "aura-2-vesta-en": - return AURA2VESTA_EN; - case "aura-2-carina-es": - return AURA2CARINA_ES; - case "aura-2-callista-en": - return AURA2CALLISTA_EN; - case "aura-2-harmonia-en": - return AURA2HARMONIA_EN; - case "aura-2-selena-es": - return AURA2SELENA_ES; - case "aura-2-aurora-en": - return AURA2AURORA_EN; - case "aura-zeus-en": - return AURA_ZEUS_EN; - case "aura-2-ophelia-en": - return AURA2OPHELIA_EN; - case "aura-2-amalthea-en": - return AURA2AMALTHEA_EN; - case "aura-orpheus-en": - return AURA_ORPHEUS_EN; - case "aura-2-delia-en": - return AURA2DELIA_EN; - case "aura-luna-en": - return AURA_LUNA_EN; - case "aura-2-apollo-en": - return AURA2APOLLO_EN; - case "aura-2-selene-en": - return AURA2SELENE_EN; - case "aura-2-theia-en": - return AURA2THEIA_EN; - case "aura-hera-en": - return AURA_HERA_EN; - case "aura-2-cordelia-en": - return AURA2CORDELIA_EN; - case "aura-2-andromeda-en": - return AURA2ANDROMEDA_EN; - case "aura-2-aries-en": - return AURA2ARIES_EN; - case "aura-2-juno-en": - return AURA2JUNO_EN; - case "aura-2-luna-en": - return AURA2LUNA_EN; - case "aura-2-diana-es": - return AURA2DIANA_ES; - case "aura-2-javier-es": - return AURA2JAVIER_ES; - case "aura-orion-en": - return AURA_ORION_EN; - case "aura-arcas-en": - return AURA_ARCAS_EN; - case "aura-2-iris-en": - return AURA2IRIS_EN; - case "aura-2-athena-en": - return AURA2ATHENA_EN; - case "aura-2-saturn-en": - return AURA2SATURN_EN; - case "aura-2-phoebe-en": - return AURA2PHOEBE_EN; - default: - return new SpeakV1Model(Value.UNKNOWN, value); - } - } - - public enum Value { - AURA_ASTERIA_EN, - - AURA_LUNA_EN, - - AURA_STELLA_EN, - - AURA_ATHENA_EN, - - AURA_HERA_EN, - - AURA_ORION_EN, - - AURA_ARCAS_EN, - - AURA_PERSEUS_EN, - - AURA_ANGUS_EN, - - AURA_ORPHEUS_EN, - - AURA_HELIOS_EN, - - AURA_ZEUS_EN, - - AURA2AMALTHEA_EN, - - AURA2ANDROMEDA_EN, - - AURA2APOLLO_EN, - - AURA2ARCAS_EN, - - AURA2ARIES_EN, - - AURA2ASTERIA_EN, - - AURA2ATHENA_EN, - - AURA2ATLAS_EN, - - AURA2AURORA_EN, - - AURA2CALLISTA_EN, - - AURA2CORDELIA_EN, - - AURA2CORA_EN, - - AURA2DELIA_EN, - - AURA2DRACO_EN, - - AURA2ELECTRA_EN, - - AURA2HARMONIA_EN, - - AURA2HELENA_EN, - - AURA2HERA_EN, - - AURA2HERMES_EN, - - AURA2HYPERION_EN, - - AURA2IRIS_EN, - - AURA2JANUS_EN, - - AURA2JUNO_EN, - - AURA2JUPITER_EN, - - AURA2LUNA_EN, - - AURA2MARS_EN, - - AURA2MINERVA_EN, - - AURA2NEPTUNE_EN, - - AURA2ODYSSEUS_EN, - - AURA2OPHELIA_EN, - - AURA2ORION_EN, - - AURA2ORPHEUS_EN, - - AURA2PANDORA_EN, - - AURA2PHOEBE_EN, - - AURA2PLUTO_EN, - - AURA2SATURN_EN, - - AURA2SELENE_EN, - - AURA2THALIA_EN, - - AURA2THEIA_EN, - - AURA2VESTA_EN, - - AURA2ZEUS_EN, - - AURA2SIRIO_ES, - - AURA2NESTOR_ES, - - AURA2CARINA_ES, - - AURA2CELESTE_ES, - - AURA2ALVARO_ES, - - AURA2DIANA_ES, - - AURA2AQUILA_ES, - - AURA2SELENA_ES, - - AURA2ESTRELLA_ES, - - AURA2JAVIER_ES, - - UNKNOWN - } - - public interface Visitor { - T visitAuraAsteriaEn(); - - T visitAuraLunaEn(); - - T visitAuraStellaEn(); - - T visitAuraAthenaEn(); - - T visitAuraHeraEn(); - - T visitAuraOrionEn(); - - T visitAuraArcasEn(); - - T visitAuraPerseusEn(); - - T visitAuraAngusEn(); - - T visitAuraOrpheusEn(); - - T visitAuraHeliosEn(); - - T visitAuraZeusEn(); - - T visitAura2AmaltheaEn(); - - T visitAura2AndromedaEn(); - - T visitAura2ApolloEn(); - - T visitAura2ArcasEn(); - - T visitAura2AriesEn(); - - T visitAura2AsteriaEn(); - - T visitAura2AthenaEn(); - - T visitAura2AtlasEn(); - - T visitAura2AuroraEn(); - - T visitAura2CallistaEn(); - - T visitAura2CordeliaEn(); - - T visitAura2CoraEn(); - - T visitAura2DeliaEn(); - - T visitAura2DracoEn(); - - T visitAura2ElectraEn(); - - T visitAura2HarmoniaEn(); - - T visitAura2HelenaEn(); - - T visitAura2HeraEn(); - - T visitAura2HermesEn(); - - T visitAura2HyperionEn(); - - T visitAura2IrisEn(); - - T visitAura2JanusEn(); - - T visitAura2JunoEn(); - - T visitAura2JupiterEn(); - - T visitAura2LunaEn(); - - T visitAura2MarsEn(); - - T visitAura2MinervaEn(); - - T visitAura2NeptuneEn(); - - T visitAura2OdysseusEn(); - - T visitAura2OpheliaEn(); - - T visitAura2OrionEn(); - - T visitAura2OrpheusEn(); - - T visitAura2PandoraEn(); - - T visitAura2PhoebeEn(); - - T visitAura2PlutoEn(); - - T visitAura2SaturnEn(); - - T visitAura2SeleneEn(); - - T visitAura2ThaliaEn(); - - T visitAura2TheiaEn(); - - T visitAura2VestaEn(); - - T visitAura2ZeusEn(); - - T visitAura2SirioEs(); - - T visitAura2NestorEs(); - - T visitAura2CarinaEs(); - - T visitAura2CelesteEs(); - - T visitAura2AlvaroEs(); - - T visitAura2DianaEs(); - - T visitAura2AquilaEs(); - - T visitAura2SelenaEs(); - - T visitAura2EstrellaEs(); - - T visitAura2JavierEs(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/types/SpeakV1SampleRate.java b/src/main/java/types/SpeakV1SampleRate.java deleted file mode 100644 index 2656ddb..0000000 --- a/src/main/java/types/SpeakV1SampleRate.java +++ /dev/null @@ -1,117 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -public final class SpeakV1SampleRate { - public static final SpeakV1SampleRate EIGHT_THOUSAND = - new SpeakV1SampleRate(Value.EIGHT_THOUSAND, "8000"); - - public static final SpeakV1SampleRate SIXTEEN_THOUSAND = - new SpeakV1SampleRate(Value.SIXTEEN_THOUSAND, "16000"); - - public static final SpeakV1SampleRate FORTY_EIGHT_THOUSAND = - new SpeakV1SampleRate(Value.FORTY_EIGHT_THOUSAND, "48000"); - - public static final SpeakV1SampleRate TWENTY_FOUR_THOUSAND = - new SpeakV1SampleRate(Value.TWENTY_FOUR_THOUSAND, "24000"); - - public static final SpeakV1SampleRate THIRTY_TWO_THOUSAND = - new SpeakV1SampleRate(Value.THIRTY_TWO_THOUSAND, "32000"); - - private final Value value; - - private final String string; - - SpeakV1SampleRate(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof SpeakV1SampleRate - && this.string.equals(((SpeakV1SampleRate) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case EIGHT_THOUSAND: - return visitor.visitEightThousand(); - case SIXTEEN_THOUSAND: - return visitor.visitSixteenThousand(); - case FORTY_EIGHT_THOUSAND: - return visitor.visitFortyEightThousand(); - case TWENTY_FOUR_THOUSAND: - return visitor.visitTwentyFourThousand(); - case THIRTY_TWO_THOUSAND: - return visitor.visitThirtyTwoThousand(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - public static SpeakV1SampleRate valueOf(String value) { - switch (value) { - case "8000": - return EIGHT_THOUSAND; - case "16000": - return SIXTEEN_THOUSAND; - case "48000": - return FORTY_EIGHT_THOUSAND; - case "24000": - return TWENTY_FOUR_THOUSAND; - case "32000": - return THIRTY_TWO_THOUSAND; - default: - return new SpeakV1SampleRate(Value.UNKNOWN, value); - } - } - - public enum Value { - EIGHT_THOUSAND, - - SIXTEEN_THOUSAND, - - TWENTY_FOUR_THOUSAND, - - THIRTY_TWO_THOUSAND, - - FORTY_EIGHT_THOUSAND, - - UNKNOWN - } - - public interface Visitor { - T visitEightThousand(); - - T visitSixteenThousand(); - - T visitTwentyFourThousand(); - - T visitThirtyTwoThousand(); - - T visitFortyEightThousand(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/types/ThinkSettingsV1.java b/src/main/java/types/ThinkSettingsV1.java deleted file mode 100644 index 7d90f1a..0000000 --- a/src/main/java/types/ThinkSettingsV1.java +++ /dev/null @@ -1,282 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ThinkSettingsV1.Builder.class) -public final class ThinkSettingsV1 { - private final ThinkSettingsV1Provider provider; - - private final Optional endpoint; - - private final Optional> functions; - - private final Optional prompt; - - private final Optional contextLength; - - private final Map additionalProperties; - - private ThinkSettingsV1( - ThinkSettingsV1Provider provider, - Optional endpoint, - Optional> functions, - Optional prompt, - Optional contextLength, - Map additionalProperties) { - this.provider = provider; - this.endpoint = endpoint; - this.functions = functions; - this.prompt = prompt; - this.contextLength = contextLength; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("provider") - public ThinkSettingsV1Provider getProvider() { - return provider; - } - - /** - * @return Optional for non-Deepgram LLM providers. When present, must include url field and - * headers object - */ - @JsonProperty("endpoint") - public Optional getEndpoint() { - return endpoint; - } - - @JsonProperty("functions") - public Optional> getFunctions() { - return functions; - } - - @JsonProperty("prompt") - public Optional getPrompt() { - return prompt; - } - - /** - * @return Specifies the number of characters retained in context between user messages, agent - * responses, and function calls. This setting is only configurable when a custom think - * endpoint is used - */ - @JsonProperty("context_length") - public Optional getContextLength() { - return contextLength; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ThinkSettingsV1 && equalTo((ThinkSettingsV1) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ThinkSettingsV1 other) { - return provider.equals(other.provider) - && endpoint.equals(other.endpoint) - && functions.equals(other.functions) - && prompt.equals(other.prompt) - && contextLength.equals(other.contextLength); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.provider, this.endpoint, this.functions, this.prompt, this.contextLength); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static ProviderStage builder() { - return new Builder(); - } - - public interface ProviderStage { - _FinalStage provider(@NotNull ThinkSettingsV1Provider provider); - - Builder from(ThinkSettingsV1 other); - } - - public interface _FinalStage { - ThinkSettingsV1 build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** - * Optional for non-Deepgram LLM providers. When present, must include url field and headers - * object - */ - _FinalStage endpoint(Optional endpoint); - - _FinalStage endpoint(ThinkSettingsV1Endpoint endpoint); - - _FinalStage functions(Optional> functions); - - _FinalStage functions(List functions); - - _FinalStage prompt(Optional prompt); - - _FinalStage prompt(String prompt); - - /** - * Specifies the number of characters retained in context between user messages, agent - * responses, and function calls. This setting is only configurable when a custom think endpoint - * is used - */ - _FinalStage contextLength(Optional contextLength); - - _FinalStage contextLength(ThinkSettingsV1ContextLength contextLength); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements ProviderStage, _FinalStage { - private ThinkSettingsV1Provider provider; - - private Optional contextLength = Optional.empty(); - - private Optional prompt = Optional.empty(); - - private Optional> functions = Optional.empty(); - - private Optional endpoint = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(ThinkSettingsV1 other) { - provider(other.getProvider()); - endpoint(other.getEndpoint()); - functions(other.getFunctions()); - prompt(other.getPrompt()); - contextLength(other.getContextLength()); - return this; - } - - @java.lang.Override - @JsonSetter("provider") - public _FinalStage provider(@NotNull ThinkSettingsV1Provider provider) { - this.provider = Objects.requireNonNull(provider, "provider must not be null"); - return this; - } - - /** - * Specifies the number of characters retained in context between user messages, agent - * responses, and function calls. This setting is only configurable when a custom think endpoint - * is used - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage contextLength(ThinkSettingsV1ContextLength contextLength) { - this.contextLength = Optional.ofNullable(contextLength); - return this; - } - - /** - * Specifies the number of characters retained in context between user messages, agent - * responses, and function calls. This setting is only configurable when a custom think endpoint - * is used - */ - @java.lang.Override - @JsonSetter(value = "context_length", nulls = Nulls.SKIP) - public _FinalStage contextLength(Optional contextLength) { - this.contextLength = contextLength; - return this; - } - - @java.lang.Override - public _FinalStage prompt(String prompt) { - this.prompt = Optional.ofNullable(prompt); - return this; - } - - @java.lang.Override - @JsonSetter(value = "prompt", nulls = Nulls.SKIP) - public _FinalStage prompt(Optional prompt) { - this.prompt = prompt; - return this; - } - - @java.lang.Override - public _FinalStage functions(List functions) { - this.functions = Optional.ofNullable(functions); - return this; - } - - @java.lang.Override - @JsonSetter(value = "functions", nulls = Nulls.SKIP) - public _FinalStage functions(Optional> functions) { - this.functions = functions; - return this; - } - - /** - * Optional for non-Deepgram LLM providers. When present, must include url field and headers - * object - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage endpoint(ThinkSettingsV1Endpoint endpoint) { - this.endpoint = Optional.ofNullable(endpoint); - return this; - } - - /** - * Optional for non-Deepgram LLM providers. When present, must include url field and headers - * object - */ - @java.lang.Override - @JsonSetter(value = "endpoint", nulls = Nulls.SKIP) - public _FinalStage endpoint(Optional endpoint) { - this.endpoint = endpoint; - return this; - } - - @java.lang.Override - public ThinkSettingsV1 build() { - return new ThinkSettingsV1( - provider, endpoint, functions, prompt, contextLength, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ThinkSettingsV1ContextLength.java b/src/main/java/types/ThinkSettingsV1ContextLength.java deleted file mode 100644 index a427bd4..0000000 --- a/src/main/java/types/ThinkSettingsV1ContextLength.java +++ /dev/null @@ -1,106 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package 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 core.ObjectMappers; -import java.io.IOException; -import java.util.Objects; - -@JsonDeserialize(using = ThinkSettingsV1ContextLength.Deserializer.class) -public final class ThinkSettingsV1ContextLength { - private final Object value; - - private final int type; - - private ThinkSettingsV1ContextLength(Object value, int type) { - this.value = value; - this.type = type; - } - - @JsonValue - public Object get() { - return this.value; - } - - @SuppressWarnings("unchecked") - public T visit(Visitor visitor) { - if (this.type == 0) { - return visitor.visit((String) this.value); - } else if (this.type == 1) { - return visitor.visit((double) 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 ThinkSettingsV1ContextLength - && equalTo((ThinkSettingsV1ContextLength) other); - } - - private boolean equalTo(ThinkSettingsV1ContextLength 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(); - } - - /** - * @param value must be one of the following: - *
    - *
  • "max" - *
- */ - public static ThinkSettingsV1ContextLength of(String value) { - return new ThinkSettingsV1ContextLength(value, 0); - } - - public static ThinkSettingsV1ContextLength of(double value) { - return new ThinkSettingsV1ContextLength(value, 1); - } - - public interface Visitor { - /** - * @param value must be one of the following: - *
    - *
  • "max" - *
- */ - T visit(String value); - - T visit(double value); - } - - static final class Deserializer extends StdDeserializer { - Deserializer() { - super(ThinkSettingsV1ContextLength.class); - } - - @java.lang.Override - public ThinkSettingsV1ContextLength deserialize(JsonParser p, DeserializationContext context) - throws IOException { - Object value = p.readValueAs(Object.class); - try { - return of(ObjectMappers.JSON_MAPPER.convertValue(value, String.class)); - } catch (RuntimeException e) { - } - if (value instanceof Double) { - return of((Double) value); - } - throw new JsonParseException(p, "Failed to deserialize"); - } - } -} diff --git a/src/main/java/types/ThinkSettingsV1Endpoint.java b/src/main/java/types/ThinkSettingsV1Endpoint.java deleted file mode 100644 index 49af31e..0000000 --- a/src/main/java/types/ThinkSettingsV1Endpoint.java +++ /dev/null @@ -1,135 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ThinkSettingsV1Endpoint.Builder.class) -public final class ThinkSettingsV1Endpoint { - private final Optional url; - - private final Optional> headers; - - private final Map additionalProperties; - - private ThinkSettingsV1Endpoint( - Optional url, - Optional> headers, - Map additionalProperties) { - this.url = url; - this.headers = headers; - this.additionalProperties = additionalProperties; - } - - /** - * @return Custom LLM endpoint URL - */ - @JsonProperty("url") - public Optional getUrl() { - return url; - } - - /** - * @return Custom headers for the endpoint - */ - @JsonProperty("headers") - public Optional> getHeaders() { - return headers; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ThinkSettingsV1Endpoint && equalTo((ThinkSettingsV1Endpoint) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ThinkSettingsV1Endpoint other) { - return url.equals(other.url) && headers.equals(other.headers); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.url, this.headers); - } - - @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 url = Optional.empty(); - - private Optional> headers = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ThinkSettingsV1Endpoint other) { - url(other.getUrl()); - headers(other.getHeaders()); - return this; - } - - /** Custom LLM endpoint URL */ - @JsonSetter(value = "url", nulls = Nulls.SKIP) - public Builder url(Optional url) { - this.url = url; - return this; - } - - public Builder url(String url) { - this.url = Optional.ofNullable(url); - return this; - } - - /** Custom headers for the endpoint */ - @JsonSetter(value = "headers", nulls = Nulls.SKIP) - public Builder headers(Optional> headers) { - this.headers = headers; - return this; - } - - public Builder headers(Map headers) { - this.headers = Optional.ofNullable(headers); - return this; - } - - public ThinkSettingsV1Endpoint build() { - return new ThinkSettingsV1Endpoint(url, headers, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ThinkSettingsV1FunctionsItem.java b/src/main/java/types/ThinkSettingsV1FunctionsItem.java deleted file mode 100644 index dc7c046..0000000 --- a/src/main/java/types/ThinkSettingsV1FunctionsItem.java +++ /dev/null @@ -1,194 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ThinkSettingsV1FunctionsItem.Builder.class) -public final class ThinkSettingsV1FunctionsItem { - private final Optional name; - - private final Optional description; - - private final Optional> parameters; - - private final Optional endpoint; - - private final Map additionalProperties; - - private ThinkSettingsV1FunctionsItem( - Optional name, - Optional description, - Optional> parameters, - Optional endpoint, - Map additionalProperties) { - this.name = name; - this.description = description; - this.parameters = parameters; - this.endpoint = endpoint; - this.additionalProperties = additionalProperties; - } - - /** - * @return Function name - */ - @JsonProperty("name") - public Optional getName() { - return name; - } - - /** - * @return Function description - */ - @JsonProperty("description") - public Optional getDescription() { - return description; - } - - /** - * @return Function parameters - */ - @JsonProperty("parameters") - public Optional> getParameters() { - return parameters; - } - - /** - * @return The Function endpoint to call. if not passed, function is called client-side - */ - @JsonProperty("endpoint") - public Optional getEndpoint() { - return endpoint; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ThinkSettingsV1FunctionsItem - && equalTo((ThinkSettingsV1FunctionsItem) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ThinkSettingsV1FunctionsItem other) { - return name.equals(other.name) - && description.equals(other.description) - && parameters.equals(other.parameters) - && endpoint.equals(other.endpoint); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.name, this.description, this.parameters, this.endpoint); - } - - @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 description = Optional.empty(); - - private Optional> parameters = Optional.empty(); - - private Optional endpoint = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ThinkSettingsV1FunctionsItem other) { - name(other.getName()); - description(other.getDescription()); - parameters(other.getParameters()); - endpoint(other.getEndpoint()); - return this; - } - - /** Function name */ - @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; - } - - /** Function description */ - @JsonSetter(value = "description", nulls = Nulls.SKIP) - public Builder description(Optional description) { - this.description = description; - return this; - } - - public Builder description(String description) { - this.description = Optional.ofNullable(description); - return this; - } - - /** Function parameters */ - @JsonSetter(value = "parameters", nulls = Nulls.SKIP) - public Builder parameters(Optional> parameters) { - this.parameters = parameters; - return this; - } - - public Builder parameters(Map parameters) { - this.parameters = Optional.ofNullable(parameters); - return this; - } - - /** The Function endpoint to call. if not passed, function is called client-side */ - @JsonSetter(value = "endpoint", nulls = Nulls.SKIP) - public Builder endpoint(Optional endpoint) { - this.endpoint = endpoint; - return this; - } - - public Builder endpoint(ThinkSettingsV1FunctionsItemEndpoint endpoint) { - this.endpoint = Optional.ofNullable(endpoint); - return this; - } - - public ThinkSettingsV1FunctionsItem build() { - return new ThinkSettingsV1FunctionsItem( - name, description, parameters, endpoint, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ThinkSettingsV1FunctionsItemEndpoint.java b/src/main/java/types/ThinkSettingsV1FunctionsItemEndpoint.java deleted file mode 100644 index 046717d..0000000 --- a/src/main/java/types/ThinkSettingsV1FunctionsItemEndpoint.java +++ /dev/null @@ -1,159 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = ThinkSettingsV1FunctionsItemEndpoint.Builder.class) -public final class ThinkSettingsV1FunctionsItemEndpoint { - private final Optional url; - - private final Optional method; - - private final Optional> headers; - - private final Map additionalProperties; - - private ThinkSettingsV1FunctionsItemEndpoint( - Optional url, - Optional method, - Optional> headers, - Map additionalProperties) { - this.url = url; - this.method = method; - this.headers = headers; - this.additionalProperties = additionalProperties; - } - - /** - * @return Endpoint URL - */ - @JsonProperty("url") - public Optional getUrl() { - return url; - } - - /** - * @return HTTP method - */ - @JsonProperty("method") - public Optional getMethod() { - return method; - } - - @JsonProperty("headers") - public Optional> getHeaders() { - return headers; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ThinkSettingsV1FunctionsItemEndpoint - && equalTo((ThinkSettingsV1FunctionsItemEndpoint) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ThinkSettingsV1FunctionsItemEndpoint other) { - return url.equals(other.url) && method.equals(other.method) && headers.equals(other.headers); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.url, this.method, this.headers); - } - - @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 url = Optional.empty(); - - private Optional method = Optional.empty(); - - private Optional> headers = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(ThinkSettingsV1FunctionsItemEndpoint other) { - url(other.getUrl()); - method(other.getMethod()); - headers(other.getHeaders()); - return this; - } - - /** Endpoint URL */ - @JsonSetter(value = "url", nulls = Nulls.SKIP) - public Builder url(Optional url) { - this.url = url; - return this; - } - - public Builder url(String url) { - this.url = Optional.ofNullable(url); - return this; - } - - /** HTTP method */ - @JsonSetter(value = "method", nulls = Nulls.SKIP) - public Builder method(Optional method) { - this.method = method; - return this; - } - - public Builder method(String method) { - this.method = Optional.ofNullable(method); - return this; - } - - @JsonSetter(value = "headers", nulls = Nulls.SKIP) - public Builder headers(Optional> headers) { - this.headers = headers; - return this; - } - - public Builder headers(Map headers) { - this.headers = Optional.ofNullable(headers); - return this; - } - - public ThinkSettingsV1FunctionsItemEndpoint build() { - return new ThinkSettingsV1FunctionsItemEndpoint(url, method, headers, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/ThinkSettingsV1Provider.java b/src/main/java/types/ThinkSettingsV1Provider.java deleted file mode 100644 index a976d06..0000000 --- a/src/main/java/types/ThinkSettingsV1Provider.java +++ /dev/null @@ -1,400 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package 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 ThinkSettingsV1Provider { - private final Value value; - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - private ThinkSettingsV1Provider(Value value) { - this.value = value; - } - - public T visit(Visitor visitor) { - return value.visit(visitor); - } - - public static ThinkSettingsV1Provider openAi(OpenAiThinkProvider value) { - return new ThinkSettingsV1Provider(new OpenAiValue(value)); - } - - public static ThinkSettingsV1Provider awsBedrock(AwsBedrockThinkProvider value) { - return new ThinkSettingsV1Provider(new AwsBedrockValue(value)); - } - - public static ThinkSettingsV1Provider anthropic(Anthropic value) { - return new ThinkSettingsV1Provider(new AnthropicValue(value)); - } - - public static ThinkSettingsV1Provider google(Google value) { - return new ThinkSettingsV1Provider(new GoogleValue(value)); - } - - public static ThinkSettingsV1Provider groq(Groq value) { - return new ThinkSettingsV1Provider(new GroqValue(value)); - } - - public boolean isOpenAi() { - return value instanceof OpenAiValue; - } - - public boolean isAwsBedrock() { - return value instanceof AwsBedrockValue; - } - - public boolean isAnthropic() { - return value instanceof AnthropicValue; - } - - public boolean isGoogle() { - return value instanceof GoogleValue; - } - - public boolean isGroq() { - return value instanceof GroqValue; - } - - public boolean _isUnknown() { - return value instanceof _UnknownValue; - } - - public Optional getOpenAi() { - if (isOpenAi()) { - return Optional.of(((OpenAiValue) value).value); - } - return Optional.empty(); - } - - public Optional getAwsBedrock() { - if (isAwsBedrock()) { - return Optional.of(((AwsBedrockValue) value).value); - } - return Optional.empty(); - } - - public Optional getAnthropic() { - if (isAnthropic()) { - return Optional.of(((AnthropicValue) value).value); - } - return Optional.empty(); - } - - public Optional getGoogle() { - if (isGoogle()) { - return Optional.of(((GoogleValue) value).value); - } - return Optional.empty(); - } - - public Optional getGroq() { - if (isGroq()) { - return Optional.of(((GroqValue) value).value); - } - return Optional.empty(); - } - - public Optional _getUnknown() { - if (_isUnknown()) { - return Optional.of(((_UnknownValue) value).value); - } - return Optional.empty(); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ThinkSettingsV1Provider - && value.equals(((ThinkSettingsV1Provider) other).value); - } - - @Override - public int hashCode() { - return Objects.hash(value); - } - - @Override - public String toString() { - return value.toString(); - } - - @JsonValue - private Value getValue() { - return this.value; - } - - public interface Visitor { - T visitOpenAi(OpenAiThinkProvider openAi); - - T visitAwsBedrock(AwsBedrockThinkProvider awsBedrock); - - T visitAnthropic(Anthropic anthropic); - - T visitGoogle(Google google); - - T visitGroq(Groq groq); - - T _visitUnknown(Object unknownType); - } - - @JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "type", - visible = true, - defaultImpl = _UnknownValue.class) - @JsonSubTypes({ - @JsonSubTypes.Type(OpenAiValue.class), - @JsonSubTypes.Type(AwsBedrockValue.class), - @JsonSubTypes.Type(AnthropicValue.class), - @JsonSubTypes.Type(GoogleValue.class), - @JsonSubTypes.Type(GroqValue.class) - }) - @JsonIgnoreProperties(ignoreUnknown = true) - private interface Value { - T visit(Visitor visitor); - } - - @JsonTypeName("open_ai") - @JsonIgnoreProperties("type") - private static final class OpenAiValue implements Value { - @JsonUnwrapped - @JsonIgnoreProperties(value = "type", allowSetters = true) - private OpenAiThinkProvider value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private OpenAiValue() {} - - private OpenAiValue(OpenAiThinkProvider 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 "ThinkSettingsV1Provider{" + "value: " + value + "}"; - } - } - - @JsonTypeName("aws_bedrock") - @JsonIgnoreProperties("type") - private static final class AwsBedrockValue implements Value { - @JsonUnwrapped - @JsonIgnoreProperties(value = "type", allowSetters = true) - private AwsBedrockThinkProvider value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private AwsBedrockValue() {} - - private AwsBedrockValue(AwsBedrockThinkProvider value) { - this.value = value; - } - - @java.lang.Override - public T visit(Visitor visitor) { - return visitor.visitAwsBedrock(value); - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AwsBedrockValue && equalTo((AwsBedrockValue) other); - } - - private boolean equalTo(AwsBedrockValue other) { - return value.equals(other.value); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.value); - } - - @java.lang.Override - public String toString() { - return "ThinkSettingsV1Provider{" + "value: " + value + "}"; - } - } - - @JsonTypeName("anthropic") - @JsonIgnoreProperties("type") - private static final class AnthropicValue implements Value { - @JsonUnwrapped - @JsonIgnoreProperties(value = "type", allowSetters = true) - private Anthropic value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private AnthropicValue() {} - - private AnthropicValue(Anthropic 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 "ThinkSettingsV1Provider{" + "value: " + value + "}"; - } - } - - @JsonTypeName("google") - @JsonIgnoreProperties("type") - private static final class GoogleValue implements Value { - @JsonUnwrapped - @JsonIgnoreProperties(value = "type", allowSetters = true) - private Google value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private GoogleValue() {} - - private GoogleValue(Google value) { - this.value = value; - } - - @java.lang.Override - public T visit(Visitor visitor) { - return visitor.visitGoogle(value); - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof GoogleValue && equalTo((GoogleValue) other); - } - - private boolean equalTo(GoogleValue other) { - return value.equals(other.value); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.value); - } - - @java.lang.Override - public String toString() { - return "ThinkSettingsV1Provider{" + "value: " + value + "}"; - } - } - - @JsonTypeName("groq") - @JsonIgnoreProperties("type") - private static final class GroqValue implements Value { - @JsonUnwrapped - @JsonIgnoreProperties(value = "type", allowSetters = true) - private Groq value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private GroqValue() {} - - private GroqValue(Groq 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 "ThinkSettingsV1Provider{" + "value: " + value + "}"; - } - } - - @JsonIgnoreProperties("type") - 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 "ThinkSettingsV1Provider{" + "type: " + type + ", value: " + value + "}"; - } - } -} diff --git a/src/main/java/types/UpdateProjectMemberScopesV1Response.java b/src/main/java/types/UpdateProjectMemberScopesV1Response.java deleted file mode 100644 index 93c6d74..0000000 --- a/src/main/java/types/UpdateProjectMemberScopesV1Response.java +++ /dev/null @@ -1,108 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = UpdateProjectMemberScopesV1Response.Builder.class) -public final class UpdateProjectMemberScopesV1Response { - private final Optional message; - - private final Map additionalProperties; - - private UpdateProjectMemberScopesV1Response( - Optional message, Map additionalProperties) { - this.message = message; - this.additionalProperties = additionalProperties; - } - - /** - * @return confirmation message - */ - @JsonProperty("message") - public Optional getMessage() { - return message; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpdateProjectMemberScopesV1Response - && equalTo((UpdateProjectMemberScopesV1Response) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(UpdateProjectMemberScopesV1Response 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 Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional message = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(UpdateProjectMemberScopesV1Response other) { - message(other.getMessage()); - return this; - } - - /** confirmation message */ - @JsonSetter(value = "message", nulls = Nulls.SKIP) - public Builder message(Optional message) { - this.message = message; - return this; - } - - public Builder message(String message) { - this.message = Optional.ofNullable(message); - return this; - } - - public UpdateProjectMemberScopesV1Response build() { - return new UpdateProjectMemberScopesV1Response(message, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/UpdateProjectV1Response.java b/src/main/java/types/UpdateProjectV1Response.java deleted file mode 100644 index e9a7ef0..0000000 --- a/src/main/java/types/UpdateProjectV1Response.java +++ /dev/null @@ -1,107 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = UpdateProjectV1Response.Builder.class) -public final class UpdateProjectV1Response { - private final Optional message; - - private final Map additionalProperties; - - private UpdateProjectV1Response( - Optional message, Map additionalProperties) { - this.message = message; - this.additionalProperties = additionalProperties; - } - - /** - * @return confirmation message - */ - @JsonProperty("message") - public Optional getMessage() { - return message; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpdateProjectV1Response && equalTo((UpdateProjectV1Response) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(UpdateProjectV1Response 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 Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional message = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(UpdateProjectV1Response other) { - message(other.getMessage()); - return this; - } - - /** confirmation message */ - @JsonSetter(value = "message", nulls = Nulls.SKIP) - public Builder message(Optional message) { - this.message = message; - return this; - } - - public Builder message(String message) { - this.message = Optional.ofNullable(message); - return this; - } - - public UpdateProjectV1Response build() { - return new UpdateProjectV1Response(message, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/UsageBreakdownV1Response.java b/src/main/java/types/UsageBreakdownV1Response.java deleted file mode 100644 index 257c700..0000000 --- a/src/main/java/types/UsageBreakdownV1Response.java +++ /dev/null @@ -1,233 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = UsageBreakdownV1Response.Builder.class) -public final class UsageBreakdownV1Response { - private final String start; - - private final String end; - - private final UsageBreakdownV1ResponseResolution resolution; - - private final List results; - - private final Map additionalProperties; - - private UsageBreakdownV1Response( - String start, - String end, - UsageBreakdownV1ResponseResolution resolution, - List results, - Map additionalProperties) { - this.start = start; - this.end = end; - this.resolution = resolution; - this.results = results; - this.additionalProperties = additionalProperties; - } - - /** - * @return Start date of the usage period - */ - @JsonProperty("start") - public String getStart() { - return start; - } - - /** - * @return End date of the usage period - */ - @JsonProperty("end") - public String getEnd() { - return end; - } - - @JsonProperty("resolution") - public UsageBreakdownV1ResponseResolution getResolution() { - return resolution; - } - - @JsonProperty("results") - public List getResults() { - return results; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UsageBreakdownV1Response && equalTo((UsageBreakdownV1Response) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(UsageBreakdownV1Response other) { - return start.equals(other.start) - && end.equals(other.end) - && resolution.equals(other.resolution) - && results.equals(other.results); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.start, this.end, this.resolution, this.results); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static StartStage builder() { - return new Builder(); - } - - public interface StartStage { - /** Start date of the usage period */ - EndStage start(@NotNull String start); - - Builder from(UsageBreakdownV1Response other); - } - - public interface EndStage { - /** End date of the usage period */ - ResolutionStage end(@NotNull String end); - } - - public interface ResolutionStage { - _FinalStage resolution(@NotNull UsageBreakdownV1ResponseResolution resolution); - } - - public interface _FinalStage { - UsageBreakdownV1Response build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - _FinalStage results(List results); - - _FinalStage addResults(UsageBreakdownV1ResponseResultsItem results); - - _FinalStage addAllResults(List results); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements StartStage, EndStage, ResolutionStage, _FinalStage { - private String start; - - private String end; - - private UsageBreakdownV1ResponseResolution resolution; - - private List results = new ArrayList<>(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(UsageBreakdownV1Response other) { - start(other.getStart()); - end(other.getEnd()); - resolution(other.getResolution()); - results(other.getResults()); - return this; - } - - /** - * Start date of the usage period - * - *

Start date of the usage period - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("start") - public EndStage start(@NotNull String start) { - this.start = Objects.requireNonNull(start, "start must not be null"); - return this; - } - - /** - * End date of the usage period - * - *

End date of the usage period - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("end") - public ResolutionStage end(@NotNull String end) { - this.end = Objects.requireNonNull(end, "end must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("resolution") - public _FinalStage resolution(@NotNull UsageBreakdownV1ResponseResolution resolution) { - this.resolution = Objects.requireNonNull(resolution, "resolution must not be null"); - return this; - } - - @java.lang.Override - public _FinalStage addAllResults(List results) { - if (results != null) { - this.results.addAll(results); - } - return this; - } - - @java.lang.Override - public _FinalStage addResults(UsageBreakdownV1ResponseResultsItem results) { - this.results.add(results); - return this; - } - - @java.lang.Override - @JsonSetter(value = "results", nulls = Nulls.SKIP) - public _FinalStage results(List results) { - this.results.clear(); - if (results != null) { - this.results.addAll(results); - } - return this; - } - - @java.lang.Override - public UsageBreakdownV1Response build() { - return new UsageBreakdownV1Response(start, end, resolution, results, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/UsageBreakdownV1ResponseResolution.java b/src/main/java/types/UsageBreakdownV1ResponseResolution.java deleted file mode 100644 index 1ab136d..0000000 --- a/src/main/java/types/UsageBreakdownV1ResponseResolution.java +++ /dev/null @@ -1,161 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = UsageBreakdownV1ResponseResolution.Builder.class) -public final class UsageBreakdownV1ResponseResolution { - private final String units; - - private final double amount; - - private final Map additionalProperties; - - private UsageBreakdownV1ResponseResolution( - String units, double amount, Map additionalProperties) { - this.units = units; - this.amount = amount; - this.additionalProperties = additionalProperties; - } - - /** - * @return Time unit for the resolution - */ - @JsonProperty("units") - public String getUnits() { - return units; - } - - /** - * @return Amount of units - */ - @JsonProperty("amount") - public double getAmount() { - return amount; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UsageBreakdownV1ResponseResolution - && equalTo((UsageBreakdownV1ResponseResolution) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(UsageBreakdownV1ResponseResolution other) { - return units.equals(other.units) && amount == other.amount; - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.units, this.amount); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static UnitsStage builder() { - return new Builder(); - } - - public interface UnitsStage { - /** Time unit for the resolution */ - AmountStage units(@NotNull String units); - - Builder from(UsageBreakdownV1ResponseResolution other); - } - - public interface AmountStage { - /** Amount of units */ - _FinalStage amount(double amount); - } - - public interface _FinalStage { - UsageBreakdownV1ResponseResolution build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements UnitsStage, AmountStage, _FinalStage { - private String units; - - private double amount; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(UsageBreakdownV1ResponseResolution other) { - units(other.getUnits()); - amount(other.getAmount()); - return this; - } - - /** - * Time unit for the resolution - * - *

Time unit for the resolution - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("units") - public AmountStage units(@NotNull String units) { - this.units = Objects.requireNonNull(units, "units must not be null"); - return this; - } - - /** - * Amount of units - * - *

Amount of units - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("amount") - public _FinalStage amount(double amount) { - this.amount = amount; - return this; - } - - @java.lang.Override - public UsageBreakdownV1ResponseResolution build() { - return new UsageBreakdownV1ResponseResolution(units, amount, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/UsageBreakdownV1ResponseResultsItem.java b/src/main/java/types/UsageBreakdownV1ResponseResultsItem.java deleted file mode 100644 index 1e9ea13..0000000 --- a/src/main/java/types/UsageBreakdownV1ResponseResultsItem.java +++ /dev/null @@ -1,389 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = UsageBreakdownV1ResponseResultsItem.Builder.class) -public final class UsageBreakdownV1ResponseResultsItem { - private final float hours; - - private final float totalHours; - - private final float agentHours; - - private final double tokensIn; - - private final double tokensOut; - - private final double ttsCharacters; - - private final double requests; - - private final UsageBreakdownV1ResponseResultsItemGrouping grouping; - - private final Map additionalProperties; - - private UsageBreakdownV1ResponseResultsItem( - float hours, - float totalHours, - float agentHours, - double tokensIn, - double tokensOut, - double ttsCharacters, - double requests, - UsageBreakdownV1ResponseResultsItemGrouping grouping, - Map additionalProperties) { - this.hours = hours; - this.totalHours = totalHours; - this.agentHours = agentHours; - this.tokensIn = tokensIn; - this.tokensOut = tokensOut; - this.ttsCharacters = ttsCharacters; - this.requests = requests; - this.grouping = grouping; - this.additionalProperties = additionalProperties; - } - - /** - * @return Audio hours processed - */ - @JsonProperty("hours") - public float getHours() { - return hours; - } - - /** - * @return Total hours including all processing - */ - @JsonProperty("total_hours") - public float getTotalHours() { - return totalHours; - } - - /** - * @return Agent hours used - */ - @JsonProperty("agent_hours") - public float getAgentHours() { - return agentHours; - } - - /** - * @return Number of input tokens - */ - @JsonProperty("tokens_in") - public double getTokensIn() { - return tokensIn; - } - - /** - * @return Number of output tokens - */ - @JsonProperty("tokens_out") - public double getTokensOut() { - return tokensOut; - } - - /** - * @return Number of text-to-speech characters processed - */ - @JsonProperty("tts_characters") - public double getTtsCharacters() { - return ttsCharacters; - } - - /** - * @return Number of requests - */ - @JsonProperty("requests") - public double getRequests() { - return requests; - } - - @JsonProperty("grouping") - public UsageBreakdownV1ResponseResultsItemGrouping getGrouping() { - return grouping; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UsageBreakdownV1ResponseResultsItem - && equalTo((UsageBreakdownV1ResponseResultsItem) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(UsageBreakdownV1ResponseResultsItem other) { - return hours == other.hours - && totalHours == other.totalHours - && agentHours == other.agentHours - && tokensIn == other.tokensIn - && tokensOut == other.tokensOut - && ttsCharacters == other.ttsCharacters - && requests == other.requests - && grouping.equals(other.grouping); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.hours, - this.totalHours, - this.agentHours, - this.tokensIn, - this.tokensOut, - this.ttsCharacters, - this.requests, - this.grouping); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static HoursStage builder() { - return new Builder(); - } - - public interface HoursStage { - /** Audio hours processed */ - TotalHoursStage hours(float hours); - - Builder from(UsageBreakdownV1ResponseResultsItem other); - } - - public interface TotalHoursStage { - /** Total hours including all processing */ - AgentHoursStage totalHours(float totalHours); - } - - public interface AgentHoursStage { - /** Agent hours used */ - TokensInStage agentHours(float agentHours); - } - - public interface TokensInStage { - /** Number of input tokens */ - TokensOutStage tokensIn(double tokensIn); - } - - public interface TokensOutStage { - /** Number of output tokens */ - TtsCharactersStage tokensOut(double tokensOut); - } - - public interface TtsCharactersStage { - /** Number of text-to-speech characters processed */ - RequestsStage ttsCharacters(double ttsCharacters); - } - - public interface RequestsStage { - /** Number of requests */ - GroupingStage requests(double requests); - } - - public interface GroupingStage { - _FinalStage grouping(@NotNull UsageBreakdownV1ResponseResultsItemGrouping grouping); - } - - public interface _FinalStage { - UsageBreakdownV1ResponseResultsItem build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements HoursStage, - TotalHoursStage, - AgentHoursStage, - TokensInStage, - TokensOutStage, - TtsCharactersStage, - RequestsStage, - GroupingStage, - _FinalStage { - private float hours; - - private float totalHours; - - private float agentHours; - - private double tokensIn; - - private double tokensOut; - - private double ttsCharacters; - - private double requests; - - private UsageBreakdownV1ResponseResultsItemGrouping grouping; - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - @java.lang.Override - public Builder from(UsageBreakdownV1ResponseResultsItem other) { - hours(other.getHours()); - totalHours(other.getTotalHours()); - agentHours(other.getAgentHours()); - tokensIn(other.getTokensIn()); - tokensOut(other.getTokensOut()); - ttsCharacters(other.getTtsCharacters()); - requests(other.getRequests()); - grouping(other.getGrouping()); - return this; - } - - /** - * Audio hours processed - * - *

Audio hours processed - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("hours") - public TotalHoursStage hours(float hours) { - this.hours = hours; - return this; - } - - /** - * Total hours including all processing - * - *

Total hours including all processing - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("total_hours") - public AgentHoursStage totalHours(float totalHours) { - this.totalHours = totalHours; - return this; - } - - /** - * Agent hours used - * - *

Agent hours used - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("agent_hours") - public TokensInStage agentHours(float agentHours) { - this.agentHours = agentHours; - return this; - } - - /** - * Number of input tokens - * - *

Number of input tokens - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("tokens_in") - public TokensOutStage tokensIn(double tokensIn) { - this.tokensIn = tokensIn; - return this; - } - - /** - * Number of output tokens - * - *

Number of output tokens - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("tokens_out") - public TtsCharactersStage tokensOut(double tokensOut) { - this.tokensOut = tokensOut; - return this; - } - - /** - * Number of text-to-speech characters processed - * - *

Number of text-to-speech characters processed - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("tts_characters") - public RequestsStage ttsCharacters(double ttsCharacters) { - this.ttsCharacters = ttsCharacters; - return this; - } - - /** - * Number of requests - * - *

Number of requests - * - * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("requests") - public GroupingStage requests(double requests) { - this.requests = requests; - return this; - } - - @java.lang.Override - @JsonSetter("grouping") - public _FinalStage grouping(@NotNull UsageBreakdownV1ResponseResultsItemGrouping grouping) { - this.grouping = Objects.requireNonNull(grouping, "grouping must not be null"); - return this; - } - - @java.lang.Override - public UsageBreakdownV1ResponseResultsItem build() { - return new UsageBreakdownV1ResponseResultsItem( - hours, - totalHours, - agentHours, - tokensIn, - tokensOut, - ttsCharacters, - requests, - grouping, - additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/UsageBreakdownV1ResponseResultsItemGrouping.java b/src/main/java/types/UsageBreakdownV1ResponseResultsItemGrouping.java deleted file mode 100644 index 77041d2..0000000 --- a/src/main/java/types/UsageBreakdownV1ResponseResultsItemGrouping.java +++ /dev/null @@ -1,352 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = UsageBreakdownV1ResponseResultsItemGrouping.Builder.class) -public final class UsageBreakdownV1ResponseResultsItemGrouping { - private final Optional start; - - private final Optional end; - - private final Optional accessor; - - private final Optional endpoint; - - private final Optional featureSet; - - private final Optional models; - - private final Optional method; - - private final Optional tags; - - private final Optional deployment; - - private final Map additionalProperties; - - private UsageBreakdownV1ResponseResultsItemGrouping( - Optional start, - Optional end, - Optional accessor, - Optional endpoint, - Optional featureSet, - Optional models, - Optional method, - Optional tags, - Optional deployment, - Map additionalProperties) { - this.start = start; - this.end = end; - this.accessor = accessor; - this.endpoint = endpoint; - this.featureSet = featureSet; - this.models = models; - this.method = method; - this.tags = tags; - this.deployment = deployment; - this.additionalProperties = additionalProperties; - } - - /** - * @return Start date for this group - */ - @JsonProperty("start") - public Optional getStart() { - return start; - } - - /** - * @return End date for this group - */ - @JsonProperty("end") - public Optional getEnd() { - return end; - } - - /** - * @return Optional accessor identifier - */ - @JsonProperty("accessor") - public Optional getAccessor() { - return accessor; - } - - /** - * @return Optional endpoint identifier - */ - @JsonProperty("endpoint") - public Optional getEndpoint() { - return endpoint; - } - - /** - * @return Optional feature set identifier - */ - @JsonProperty("feature_set") - public Optional getFeatureSet() { - return featureSet; - } - - /** - * @return Optional models identifier - */ - @JsonProperty("models") - public Optional getModels() { - return models; - } - - /** - * @return Optional method identifier - */ - @JsonProperty("method") - public Optional getMethod() { - return method; - } - - /** - * @return Optional tags - */ - @JsonProperty("tags") - public Optional getTags() { - return tags; - } - - /** - * @return Optional deployment identifier - */ - @JsonProperty("deployment") - public Optional getDeployment() { - return deployment; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UsageBreakdownV1ResponseResultsItemGrouping - && equalTo((UsageBreakdownV1ResponseResultsItemGrouping) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(UsageBreakdownV1ResponseResultsItemGrouping other) { - return start.equals(other.start) - && end.equals(other.end) - && accessor.equals(other.accessor) - && endpoint.equals(other.endpoint) - && featureSet.equals(other.featureSet) - && models.equals(other.models) - && method.equals(other.method) - && tags.equals(other.tags) - && deployment.equals(other.deployment); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash( - this.start, - this.end, - this.accessor, - this.endpoint, - this.featureSet, - this.models, - this.method, - this.tags, - this.deployment); - } - - @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 start = Optional.empty(); - - private Optional end = Optional.empty(); - - private Optional accessor = Optional.empty(); - - private Optional endpoint = Optional.empty(); - - private Optional featureSet = Optional.empty(); - - private Optional models = Optional.empty(); - - private Optional method = Optional.empty(); - - private Optional tags = Optional.empty(); - - private Optional deployment = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(UsageBreakdownV1ResponseResultsItemGrouping other) { - start(other.getStart()); - end(other.getEnd()); - accessor(other.getAccessor()); - endpoint(other.getEndpoint()); - featureSet(other.getFeatureSet()); - models(other.getModels()); - method(other.getMethod()); - tags(other.getTags()); - deployment(other.getDeployment()); - return this; - } - - /** Start date for this group */ - @JsonSetter(value = "start", nulls = Nulls.SKIP) - public Builder start(Optional start) { - this.start = start; - return this; - } - - public Builder start(String start) { - this.start = Optional.ofNullable(start); - return this; - } - - /** End date for this group */ - @JsonSetter(value = "end", nulls = Nulls.SKIP) - public Builder end(Optional end) { - this.end = end; - return this; - } - - public Builder end(String end) { - this.end = Optional.ofNullable(end); - return this; - } - - /** Optional accessor identifier */ - @JsonSetter(value = "accessor", nulls = Nulls.SKIP) - public Builder accessor(Optional accessor) { - this.accessor = accessor; - return this; - } - - public Builder accessor(String accessor) { - this.accessor = Optional.ofNullable(accessor); - return this; - } - - /** Optional endpoint identifier */ - @JsonSetter(value = "endpoint", nulls = Nulls.SKIP) - public Builder endpoint(Optional endpoint) { - this.endpoint = endpoint; - return this; - } - - public Builder endpoint(String endpoint) { - this.endpoint = Optional.ofNullable(endpoint); - return this; - } - - /** Optional feature set identifier */ - @JsonSetter(value = "feature_set", nulls = Nulls.SKIP) - public Builder featureSet(Optional featureSet) { - this.featureSet = featureSet; - return this; - } - - public Builder featureSet(String featureSet) { - this.featureSet = Optional.ofNullable(featureSet); - return this; - } - - /** Optional models identifier */ - @JsonSetter(value = "models", nulls = Nulls.SKIP) - public Builder models(Optional models) { - this.models = models; - return this; - } - - public Builder models(String models) { - this.models = Optional.ofNullable(models); - return this; - } - - /** Optional method identifier */ - @JsonSetter(value = "method", nulls = Nulls.SKIP) - public Builder method(Optional method) { - this.method = method; - return this; - } - - public Builder method(String method) { - this.method = Optional.ofNullable(method); - return this; - } - - /** Optional tags */ - @JsonSetter(value = "tags", nulls = Nulls.SKIP) - public Builder tags(Optional tags) { - this.tags = tags; - return this; - } - - public Builder tags(String tags) { - this.tags = Optional.ofNullable(tags); - return this; - } - - /** Optional deployment identifier */ - @JsonSetter(value = "deployment", nulls = Nulls.SKIP) - public Builder deployment(Optional deployment) { - this.deployment = deployment; - return this; - } - - public Builder deployment(String deployment) { - this.deployment = Optional.ofNullable(deployment); - return this; - } - - public UsageBreakdownV1ResponseResultsItemGrouping build() { - return new UsageBreakdownV1ResponseResultsItemGrouping( - start, - end, - accessor, - endpoint, - featureSet, - models, - method, - tags, - deployment, - additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/UsageFieldsV1Response.java b/src/main/java/types/UsageFieldsV1Response.java deleted file mode 100644 index 6748ff5..0000000 --- a/src/main/java/types/UsageFieldsV1Response.java +++ /dev/null @@ -1,194 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = UsageFieldsV1Response.Builder.class) -public final class UsageFieldsV1Response { - private final Optional> tags; - - private final Optional> models; - - private final Optional> processingMethods; - - private final Optional> features; - - private final Map additionalProperties; - - private UsageFieldsV1Response( - Optional> tags, - Optional> models, - Optional> processingMethods, - Optional> features, - Map additionalProperties) { - this.tags = tags; - this.models = models; - this.processingMethods = processingMethods; - this.features = features; - this.additionalProperties = additionalProperties; - } - - /** - * @return List of tags associated with the project - */ - @JsonProperty("tags") - public Optional> getTags() { - return tags; - } - - /** - * @return List of models available for the project. - */ - @JsonProperty("models") - public Optional> getModels() { - return models; - } - - /** - * @return Processing methods supported by the API - */ - @JsonProperty("processing_methods") - public Optional> getProcessingMethods() { - return processingMethods; - } - - /** - * @return API features available to the project - */ - @JsonProperty("features") - public Optional> getFeatures() { - return features; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UsageFieldsV1Response && equalTo((UsageFieldsV1Response) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(UsageFieldsV1Response other) { - return tags.equals(other.tags) - && models.equals(other.models) - && processingMethods.equals(other.processingMethods) - && features.equals(other.features); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.tags, this.models, this.processingMethods, this.features); - } - - @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> tags = Optional.empty(); - - private Optional> models = Optional.empty(); - - private Optional> processingMethods = Optional.empty(); - - private Optional> features = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(UsageFieldsV1Response other) { - tags(other.getTags()); - models(other.getModels()); - processingMethods(other.getProcessingMethods()); - features(other.getFeatures()); - return this; - } - - /** List of tags associated with the project */ - @JsonSetter(value = "tags", nulls = Nulls.SKIP) - public Builder tags(Optional> tags) { - this.tags = tags; - return this; - } - - public Builder tags(List tags) { - this.tags = Optional.ofNullable(tags); - return this; - } - - /** List of models available for the project. */ - @JsonSetter(value = "models", nulls = Nulls.SKIP) - public Builder models(Optional> models) { - this.models = models; - return this; - } - - public Builder models(List models) { - this.models = Optional.ofNullable(models); - return this; - } - - /** Processing methods supported by the API */ - @JsonSetter(value = "processing_methods", nulls = Nulls.SKIP) - public Builder processingMethods(Optional> processingMethods) { - this.processingMethods = processingMethods; - return this; - } - - public Builder processingMethods(List processingMethods) { - this.processingMethods = Optional.ofNullable(processingMethods); - return this; - } - - /** API features available to the project */ - @JsonSetter(value = "features", nulls = Nulls.SKIP) - public Builder features(Optional> features) { - this.features = features; - return this; - } - - public Builder features(List features) { - this.features = Optional.ofNullable(features); - return this; - } - - public UsageFieldsV1Response build() { - return new UsageFieldsV1Response( - tags, models, processingMethods, features, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/UsageFieldsV1ResponseModelsItem.java b/src/main/java/types/UsageFieldsV1ResponseModelsItem.java deleted file mode 100644 index dde1670..0000000 --- a/src/main/java/types/UsageFieldsV1ResponseModelsItem.java +++ /dev/null @@ -1,194 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = UsageFieldsV1ResponseModelsItem.Builder.class) -public final class UsageFieldsV1ResponseModelsItem { - private final Optional name; - - private final Optional language; - - private final Optional version; - - private final Optional modelId; - - private final Map additionalProperties; - - private UsageFieldsV1ResponseModelsItem( - Optional name, - Optional language, - Optional version, - Optional modelId, - Map additionalProperties) { - this.name = name; - this.language = language; - this.version = version; - this.modelId = modelId; - this.additionalProperties = additionalProperties; - } - - /** - * @return Name of the model. - */ - @JsonProperty("name") - public Optional getName() { - return name; - } - - /** - * @return The language supported by the model (IETF language tag). - */ - @JsonProperty("language") - public Optional getLanguage() { - return language; - } - - /** - * @return Version identifier of the model, typically with a date and a revision number. - */ - @JsonProperty("version") - public Optional getVersion() { - return version; - } - - /** - * @return Unique identifier for the model. - */ - @JsonProperty("model_id") - public Optional getModelId() { - return modelId; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UsageFieldsV1ResponseModelsItem - && equalTo((UsageFieldsV1ResponseModelsItem) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(UsageFieldsV1ResponseModelsItem other) { - return name.equals(other.name) - && language.equals(other.language) - && version.equals(other.version) - && modelId.equals(other.modelId); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.name, this.language, this.version, this.modelId); - } - - @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 language = Optional.empty(); - - private Optional version = Optional.empty(); - - private Optional modelId = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(UsageFieldsV1ResponseModelsItem other) { - name(other.getName()); - language(other.getLanguage()); - version(other.getVersion()); - modelId(other.getModelId()); - return this; - } - - /** Name of the model. */ - @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; - } - - /** The language supported by the model (IETF language tag). */ - @JsonSetter(value = "language", nulls = Nulls.SKIP) - public Builder language(Optional language) { - this.language = language; - return this; - } - - public Builder language(String language) { - this.language = Optional.ofNullable(language); - return this; - } - - /** Version identifier of the model, typically with a date and a revision number. */ - @JsonSetter(value = "version", nulls = Nulls.SKIP) - public Builder version(Optional version) { - this.version = version; - return this; - } - - public Builder version(String version) { - this.version = Optional.ofNullable(version); - return this; - } - - /** Unique identifier for the model. */ - @JsonSetter(value = "model_id", nulls = Nulls.SKIP) - public Builder modelId(Optional modelId) { - this.modelId = modelId; - return this; - } - - public Builder modelId(String modelId) { - this.modelId = Optional.ofNullable(modelId); - return this; - } - - public UsageFieldsV1ResponseModelsItem build() { - return new UsageFieldsV1ResponseModelsItem( - name, language, version, modelId, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/UsageV1Response.java b/src/main/java/types/UsageV1Response.java deleted file mode 100644 index 0d3bd81..0000000 --- a/src/main/java/types/UsageV1Response.java +++ /dev/null @@ -1,152 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = UsageV1Response.Builder.class) -public final class UsageV1Response { - private final Optional start; - - private final Optional end; - - private final Optional resolution; - - private final Map additionalProperties; - - private UsageV1Response( - Optional start, - Optional end, - Optional resolution, - Map additionalProperties) { - this.start = start; - this.end = end; - this.resolution = resolution; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("start") - public Optional getStart() { - return start; - } - - @JsonProperty("end") - public Optional getEnd() { - return end; - } - - @JsonProperty("resolution") - public Optional getResolution() { - return resolution; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UsageV1Response && equalTo((UsageV1Response) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(UsageV1Response other) { - return start.equals(other.start) - && end.equals(other.end) - && resolution.equals(other.resolution); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.start, this.end, this.resolution); - } - - @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 start = Optional.empty(); - - private Optional end = Optional.empty(); - - private Optional resolution = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(UsageV1Response other) { - start(other.getStart()); - end(other.getEnd()); - resolution(other.getResolution()); - return this; - } - - @JsonSetter(value = "start", nulls = Nulls.SKIP) - public Builder start(Optional start) { - this.start = start; - return this; - } - - public Builder start(String 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(String end) { - this.end = Optional.ofNullable(end); - return this; - } - - @JsonSetter(value = "resolution", nulls = Nulls.SKIP) - public Builder resolution(Optional resolution) { - this.resolution = resolution; - return this; - } - - public Builder resolution(UsageV1ResponseResolution resolution) { - this.resolution = Optional.ofNullable(resolution); - return this; - } - - public UsageV1Response build() { - return new UsageV1Response(start, end, resolution, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/types/UsageV1ResponseResolution.java b/src/main/java/types/UsageV1ResponseResolution.java deleted file mode 100644 index eba47ef..0000000 --- a/src/main/java/types/UsageV1ResponseResolution.java +++ /dev/null @@ -1,125 +0,0 @@ -/** This file was auto-generated by Fern from our API Definition. */ -package types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.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 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 = UsageV1ResponseResolution.Builder.class) -public final class UsageV1ResponseResolution { - private final Optional units; - - private final Optional amount; - - private final Map additionalProperties; - - private UsageV1ResponseResolution( - Optional units, Optional amount, Map additionalProperties) { - this.units = units; - this.amount = amount; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("units") - public Optional getUnits() { - return units; - } - - @JsonProperty("amount") - public Optional getAmount() { - return amount; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UsageV1ResponseResolution && equalTo((UsageV1ResponseResolution) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(UsageV1ResponseResolution other) { - return units.equals(other.units) && amount.equals(other.amount); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.units, this.amount); - } - - @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 units = Optional.empty(); - - private Optional amount = Optional.empty(); - - @JsonAnySetter private Map additionalProperties = new HashMap<>(); - - private Builder() {} - - public Builder from(UsageV1ResponseResolution other) { - units(other.getUnits()); - amount(other.getAmount()); - return this; - } - - @JsonSetter(value = "units", nulls = Nulls.SKIP) - public Builder units(Optional units) { - this.units = units; - return this; - } - - public Builder units(String units) { - this.units = Optional.ofNullable(units); - return this; - } - - @JsonSetter(value = "amount", nulls = Nulls.SKIP) - public Builder amount(Optional amount) { - this.amount = amount; - return this; - } - - public Builder amount(Double amount) { - this.amount = Optional.ofNullable(amount); - return this; - } - - public UsageV1ResponseResolution build() { - return new UsageV1ResponseResolution(units, amount, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/test/java/ClientBuilderTest.java b/src/test/java/ClientBuilderTest.java deleted file mode 100644 index e315bd5..0000000 --- a/src/test/java/ClientBuilderTest.java +++ /dev/null @@ -1,239 +0,0 @@ -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -import core.Environment; -import okhttp3.OkHttpClient; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Nested; -import org.junit.jupiter.api.Test; - -/** Unit tests for the DeepgramClientBuilder class and related client configuration. */ -class ClientBuilderTest { - - @Nested - @DisplayName("API key configuration") - class ApiKeyConfiguration { - - @Test - @DisplayName("builds client with explicit API key") - void testExplicitApiKey() { - DeepgramClient client = DeepgramClient.builder().apiKey("test-api-key-123").build(); - - assertThat(client).isNotNull(); - } - - @Test - @DisplayName("throws when API key is null and env var not set") - void testNullApiKeyThrows() { - // When API key is explicitly set to null, build() should throw - assertThatThrownBy(() -> DeepgramClient.builder().apiKey(null).build()) - .isInstanceOf(RuntimeException.class); - } - } - - @Nested - @DisplayName("Environment configuration") - class EnvironmentConfiguration { - - @Test - @DisplayName("defaults to PRODUCTION environment") - void testDefaultEnvironment() { - DeepgramClient client = DeepgramClient.builder().apiKey("test-key").build(); - - assertThat(client).isNotNull(); - } - - @Test - @DisplayName("accepts AGENT environment") - void testAgentEnvironment() { - DeepgramClient client = - DeepgramClient.builder().apiKey("test-key").environment(Environment.AGENT).build(); - - assertThat(client).isNotNull(); - } - - @Test - @DisplayName("accepts custom environment") - void testCustomEnvironment() { - Environment custom = - Environment.custom() - .base("https://custom.example.com") - .agent("wss://agent.example.com") - .production("wss://custom.example.com") - .build(); - - DeepgramClient client = - DeepgramClient.builder().apiKey("test-key").environment(custom).build(); - - assertThat(client).isNotNull(); - } - } - - @Nested - @DisplayName("Timeout configuration") - class TimeoutConfiguration { - - @Test - @DisplayName("builds client with custom timeout") - void testCustomTimeout() { - DeepgramClient client = DeepgramClient.builder().apiKey("test-key").timeout(120).build(); - - assertThat(client).isNotNull(); - } - - @Test - @DisplayName("builds client with default timeout when not specified") - void testDefaultTimeout() { - DeepgramClient client = DeepgramClient.builder().apiKey("test-key").build(); - - assertThat(client).isNotNull(); - } - } - - @Nested - @DisplayName("Max retries configuration") - class MaxRetriesConfiguration { - - @Test - @DisplayName("builds client with custom max retries") - void testCustomMaxRetries() { - DeepgramClient client = DeepgramClient.builder().apiKey("test-key").maxRetries(5).build(); - - assertThat(client).isNotNull(); - } - - @Test - @DisplayName("builds client with zero retries") - void testZeroRetries() { - DeepgramClient client = DeepgramClient.builder().apiKey("test-key").maxRetries(0).build(); - - assertThat(client).isNotNull(); - } - } - - @Nested - @DisplayName("HTTP client configuration") - class HttpClientConfiguration { - - @Test - @DisplayName("builds client with custom OkHttpClient") - void testCustomHttpClient() { - OkHttpClient customHttpClient = new OkHttpClient.Builder().build(); - - DeepgramClient client = - DeepgramClient.builder().apiKey("test-key").httpClient(customHttpClient).build(); - - assertThat(client).isNotNull(); - } - } - - @Nested - @DisplayName("Custom headers configuration") - class CustomHeadersConfiguration { - - @Test - @DisplayName("builds client with custom headers") - void testCustomHeaders() { - DeepgramClient client = - DeepgramClient.builder() - .apiKey("test-key") - .addHeader("X-Custom-Header", "custom-value") - .addHeader("X-Request-ID", "test-123") - .build(); - - assertThat(client).isNotNull(); - } - } - - @Nested - @DisplayName("Method chaining") - class MethodChaining { - - @Test - @DisplayName("supports fluent builder pattern with all options") - void testFluentBuilder() { - DeepgramClient client = - DeepgramClient.builder() - .apiKey("test-key") - .environment(Environment.PRODUCTION) - .timeout(30) - .maxRetries(3) - .addHeader("X-Custom", "value") - .build(); - - assertThat(client).isNotNull(); - } - } - - @Nested - @DisplayName("Client sub-resources") - class ClientSubResources { - - @Test - @DisplayName("listen() returns a non-null ListenClient") - void testListenClient() { - DeepgramClient client = DeepgramClient.builder().apiKey("test-key").build(); - - assertThat(client.listen()).isNotNull(); - } - - @Test - @DisplayName("speak() returns a non-null SpeakClient") - void testSpeakClient() { - DeepgramClient client = DeepgramClient.builder().apiKey("test-key").build(); - - assertThat(client.speak()).isNotNull(); - } - - @Test - @DisplayName("read() returns a non-null ReadClient") - void testReadClient() { - DeepgramClient client = DeepgramClient.builder().apiKey("test-key").build(); - - assertThat(client.read()).isNotNull(); - } - - @Test - @DisplayName("manage() returns a non-null ManageClient") - void testManageClient() { - DeepgramClient client = DeepgramClient.builder().apiKey("test-key").build(); - - assertThat(client.manage()).isNotNull(); - } - - @Test - @DisplayName("agent() returns a non-null AgentClient") - void testAgentClient() { - DeepgramClient client = DeepgramClient.builder().apiKey("test-key").build(); - - assertThat(client.agent()).isNotNull(); - } - - @Test - @DisplayName("auth() returns a non-null AuthClient") - void testAuthClient() { - DeepgramClient client = DeepgramClient.builder().apiKey("test-key").build(); - - assertThat(client.auth()).isNotNull(); - } - - @Test - @DisplayName("selfHosted() returns a non-null SelfHostedClient") - void testSelfHostedClient() { - DeepgramClient client = DeepgramClient.builder().apiKey("test-key").build(); - - assertThat(client.selfHosted()).isNotNull(); - } - - @Test - @DisplayName("sub-resources are memoized (same instance returned)") - void testSubResourceMemoization() { - DeepgramClient client = DeepgramClient.builder().apiKey("test-key").build(); - - assertThat(client.listen()).isSameAs(client.listen()); - assertThat(client.speak()).isSameAs(client.speak()); - assertThat(client.read()).isSameAs(client.read()); - assertThat(client.manage()).isSameAs(client.manage()); - } - } -} diff --git a/src/test/java/IntegrationTest.java b/src/test/java/IntegrationTest.java deleted file mode 100644 index d1daf5a..0000000 --- a/src/test/java/IntegrationTest.java +++ /dev/null @@ -1,224 +0,0 @@ -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -import core.DeepgramApiApiException; -import java.io.InputStream; -import java.net.HttpURLConnection; -import java.net.URL; -import java.util.List; -import java.util.Optional; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Nested; -import org.junit.jupiter.api.Test; -import resources.listen.v1.media.requests.ListenV1RequestUrl; -import resources.listen.v1.media.requests.MediaTranscribeRequestOctetStream; -import resources.listen.v1.media.types.MediaTranscribeResponse; -import resources.read.v1.text.requests.TextAnalyzeRequest; -import resources.speak.v1.audio.requests.SpeakV1Request; -import types.ListProjectsV1Response; -import types.ListProjectsV1ResponseProjectsItem; -import types.ListenV1Response; -import types.ListenV1ResponseResults; -import types.ListenV1ResponseResultsChannelsItem; -import types.ReadV1Request; -import types.ReadV1RequestText; -import types.ReadV1Response; - -/** - * Integration tests for the Deepgram Java SDK. These tests require a valid DEEPGRAM_API_KEY - * environment variable and make real API calls to Deepgram services. - * - *

Tests are organized into tiers: Tier 1 tests must pass before release; Tier 2 tests should - * pass but are less critical. - */ -public class IntegrationTest { - - private static final String TEST_AUDIO_URL = "https://dpgr.am/spacewalk.wav"; - - private DeepgramClient client; - private String apiKey; - - @BeforeEach - void setUp() { - apiKey = System.getenv("DEEPGRAM_API_KEY"); - org.junit.jupiter.api.Assumptions.assumeTrue( - apiKey != null && !apiKey.isEmpty(), "DEEPGRAM_API_KEY not set, skipping integration test"); - client = DeepgramClient.builder().apiKey(apiKey).build(); - } - - // --- Tier 1: Must pass before release --- - - @Nested - @DisplayName("Tier 1: Must-pass tests") - class Tier1Tests { - - @Test - @DisplayName("TranscribeURL - transcribe audio from a URL") - void testIntegration_TranscribeURL() { - ListenV1RequestUrl request = ListenV1RequestUrl.builder().url(TEST_AUDIO_URL).build(); - - MediaTranscribeResponse result = client.listen().v1().media().transcribeUrl(request); - - assertThat(result).isNotNull(); - - // Visit the union type to extract ListenV1Response - ListenV1Response response = - result.visit( - new MediaTranscribeResponse.Visitor() { - @Override - public ListenV1Response visit(ListenV1Response value) { - return value; - } - - @Override - public ListenV1Response visit(types.ListenV1AcceptedResponse value) { - return null; - } - }); - - assertThat(response).as("expected ListenV1Response").isNotNull(); - - ListenV1ResponseResults results = response.getResults(); - assertThat(results).isNotNull(); - assertThat(results.getChannels()).isNotEmpty(); - - ListenV1ResponseResultsChannelsItem firstChannel = results.getChannels().get(0); - assertThat(firstChannel.getAlternatives()).isPresent(); - assertThat(firstChannel.getAlternatives().get()).isNotEmpty(); - - Optional transcript = firstChannel.getAlternatives().get().get(0).getTranscript(); - assertThat(transcript).isPresent(); - assertThat(transcript.get()).isNotEmpty(); - System.out.println("Transcript: " + transcript.get()); - } - - @Test - @DisplayName("TranscribeFile - transcribe audio from raw bytes") - void testIntegration_TranscribeFile() throws Exception { - // Download audio file - URL url = new URL(TEST_AUDIO_URL); - HttpURLConnection connection = (HttpURLConnection) url.openConnection(); - connection.setRequestMethod("GET"); - byte[] audioData; - try (InputStream inputStream = connection.getInputStream()) { - audioData = inputStream.readAllBytes(); - } - assertThat(audioData).isNotEmpty(); - - MediaTranscribeRequestOctetStream request = - MediaTranscribeRequestOctetStream.builder().body(audioData).build(); - - MediaTranscribeResponse result = client.listen().v1().media().transcribeFile(request); - - assertThat(result).isNotNull(); - - ListenV1Response response = - result.visit( - new MediaTranscribeResponse.Visitor() { - @Override - public ListenV1Response visit(ListenV1Response value) { - return value; - } - - @Override - public ListenV1Response visit(types.ListenV1AcceptedResponse value) { - return null; - } - }); - - assertThat(response).as("expected ListenV1Response").isNotNull(); - - ListenV1ResponseResults results = response.getResults(); - assertThat(results).isNotNull(); - assertThat(results.getChannels()).isNotEmpty(); - - ListenV1ResponseResultsChannelsItem firstChannel = results.getChannels().get(0); - assertThat(firstChannel.getAlternatives()).isPresent(); - assertThat(firstChannel.getAlternatives().get()).isNotEmpty(); - - Optional transcript = firstChannel.getAlternatives().get().get(0).getTranscript(); - assertThat(transcript).isPresent(); - assertThat(transcript.get()).isNotEmpty(); - System.out.println("File transcript: " + transcript.get()); - } - - @Test - @DisplayName("SpeakREST - generate speech from text") - void testIntegration_SpeakREST() throws Exception { - SpeakV1Request request = - SpeakV1Request.builder() - .text("Hello, this is a test of the Deepgram text to speech API.") - .build(); - - InputStream audioStream = client.speak().v1().audio().generate(request); - - assertThat(audioStream).isNotNull(); - byte[] audioData = audioStream.readAllBytes(); - assertThat(audioData.length).as("expected audio bytes").isGreaterThan(0); - System.out.println("Speak REST returned " + audioData.length + " bytes of audio"); - } - - @Test - @DisplayName("InvalidAPIKey_REST - verify error handling for invalid key") - void testIntegration_InvalidAPIKey_REST() { - DeepgramClient invalidClient = DeepgramClient.builder().apiKey("invalid-key-12345").build(); - - ListenV1RequestUrl request = ListenV1RequestUrl.builder().url(TEST_AUDIO_URL).build(); - - assertThatThrownBy(() -> invalidClient.listen().v1().media().transcribeUrl(request)) - .isInstanceOf(DeepgramApiApiException.class) - .satisfies( - thrown -> { - DeepgramApiApiException apiException = (DeepgramApiApiException) thrown; - System.out.println("Got API error: status=" + apiException.statusCode()); - assertThat(apiException.statusCode()) - .as("expected 401 or 403 for invalid API key") - .isIn(401, 403); - }); - } - } - - // --- Tier 2: Should pass, less critical --- - - @Nested - @DisplayName("Tier 2: Should-pass tests") - class Tier2Tests { - - @Test - @DisplayName("ReadAnalyze - analyze text content") - void testIntegration_ReadAnalyze() { - TextAnalyzeRequest request = - TextAnalyzeRequest.builder() - .body( - ReadV1Request.of( - ReadV1RequestText.builder() - .text( - "The Java SDK is working great. I love using Deepgram for speech to text.") - .build())) - .sentiment(true) - .topics(true) - .language("en") - .build(); - - ReadV1Response result = client.read().v1().text().analyze(request); - - assertThat(result).isNotNull(); - assertThat(result.getResults()).isNotNull(); - System.out.println("Read analysis completed successfully"); - } - - @Test - @DisplayName("ManageProjects - list projects for the API key") - void testIntegration_ManageProjects() { - ListProjectsV1Response result = client.manage().v1().projects().list(); - - assertThat(result).isNotNull(); - assertThat(result.getProjects()).isPresent(); - - List projects = result.getProjects().get(); - assertThat(projects).as("expected at least one project").isNotEmpty(); - System.out.println("Found " + projects.size() + " projects"); - } - } -} diff --git a/src/test/java/com/deepgram/ClientBuilderTest.java b/src/test/java/com/deepgram/ClientBuilderTest.java new file mode 100644 index 0000000..5d829a5 --- /dev/null +++ b/src/test/java/com/deepgram/ClientBuilderTest.java @@ -0,0 +1,248 @@ +package com.deepgram; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +import com.deepgram.core.Environment; +import okhttp3.OkHttpClient; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; + +/** Unit tests for the DeepgramClientBuilder class and related client configuration. */ +class ClientBuilderTest { + + @Nested + @DisplayName("API key configuration") + class ApiKeyConfiguration { + + @Test + @DisplayName("builds client with explicit API key") + void testExplicitApiKey() { + DeepgramClient client = + DeepgramClient.builder().apiKey("test-api-key-123").build(); + + assertThat(client).isNotNull(); + } + + @Test + @DisplayName("throws when API key is null and env var not set") + void testNullApiKeyThrows() { + // When API key is explicitly set to null, build() should throw + assertThatThrownBy(() -> DeepgramClient.builder().apiKey(null).build()) + .isInstanceOf(RuntimeException.class); + } + } + + @Nested + @DisplayName("Environment configuration") + class EnvironmentConfiguration { + + @Test + @DisplayName("defaults to PRODUCTION environment") + void testDefaultEnvironment() { + DeepgramClient client = DeepgramClient.builder().apiKey("test-key").build(); + + assertThat(client).isNotNull(); + } + + @Test + @DisplayName("accepts AGENT environment") + void testAgentEnvironment() { + DeepgramClient client = DeepgramClient.builder() + .apiKey("test-key") + .environment(Environment.AGENT) + .build(); + + assertThat(client).isNotNull(); + } + + @Test + @DisplayName("accepts custom environment") + void testCustomEnvironment() { + Environment custom = Environment.custom() + .base("https://custom.example.com") + .agent("wss://agent.example.com") + .production("wss://custom.example.com") + .build(); + + DeepgramClient client = DeepgramClient.builder() + .apiKey("test-key") + .environment(custom) + .build(); + + assertThat(client).isNotNull(); + } + } + + @Nested + @DisplayName("Timeout configuration") + class TimeoutConfiguration { + + @Test + @DisplayName("builds client with custom timeout") + void testCustomTimeout() { + DeepgramClient client = + DeepgramClient.builder().apiKey("test-key").timeout(120).build(); + + assertThat(client).isNotNull(); + } + + @Test + @DisplayName("builds client with default timeout when not specified") + void testDefaultTimeout() { + DeepgramClient client = DeepgramClient.builder().apiKey("test-key").build(); + + assertThat(client).isNotNull(); + } + } + + @Nested + @DisplayName("Max retries configuration") + class MaxRetriesConfiguration { + + @Test + @DisplayName("builds client with custom max retries") + void testCustomMaxRetries() { + DeepgramClient client = + DeepgramClient.builder().apiKey("test-key").maxRetries(5).build(); + + assertThat(client).isNotNull(); + } + + @Test + @DisplayName("builds client with zero retries") + void testZeroRetries() { + DeepgramClient client = + DeepgramClient.builder().apiKey("test-key").maxRetries(0).build(); + + assertThat(client).isNotNull(); + } + } + + @Nested + @DisplayName("HTTP client configuration") + class HttpClientConfiguration { + + @Test + @DisplayName("builds client with custom OkHttpClient") + void testCustomHttpClient() { + OkHttpClient customHttpClient = new OkHttpClient.Builder().build(); + + DeepgramClient client = DeepgramClient.builder() + .apiKey("test-key") + .httpClient(customHttpClient) + .build(); + + assertThat(client).isNotNull(); + } + } + + @Nested + @DisplayName("Custom headers configuration") + class CustomHeadersConfiguration { + + @Test + @DisplayName("builds client with custom headers") + void testCustomHeaders() { + DeepgramClient client = DeepgramClient.builder() + .apiKey("test-key") + .addHeader("X-Custom-Header", "custom-value") + .addHeader("X-Request-ID", "test-123") + .build(); + + assertThat(client).isNotNull(); + } + } + + @Nested + @DisplayName("Method chaining") + class MethodChaining { + + @Test + @DisplayName("supports fluent builder pattern with all options") + void testFluentBuilder() { + DeepgramClient client = DeepgramClient.builder() + .apiKey("test-key") + .environment(Environment.PRODUCTION) + .timeout(30) + .maxRetries(3) + .addHeader("X-Custom", "value") + .build(); + + assertThat(client).isNotNull(); + } + } + + @Nested + @DisplayName("Client sub-resources") + class ClientSubResources { + + @Test + @DisplayName("listen() returns a non-null ListenClient") + void testListenClient() { + DeepgramClient client = DeepgramClient.builder().apiKey("test-key").build(); + + assertThat(client.listen()).isNotNull(); + } + + @Test + @DisplayName("speak() returns a non-null SpeakClient") + void testSpeakClient() { + DeepgramClient client = DeepgramClient.builder().apiKey("test-key").build(); + + assertThat(client.speak()).isNotNull(); + } + + @Test + @DisplayName("read() returns a non-null ReadClient") + void testReadClient() { + DeepgramClient client = DeepgramClient.builder().apiKey("test-key").build(); + + assertThat(client.read()).isNotNull(); + } + + @Test + @DisplayName("manage() returns a non-null ManageClient") + void testManageClient() { + DeepgramClient client = DeepgramClient.builder().apiKey("test-key").build(); + + assertThat(client.manage()).isNotNull(); + } + + @Test + @DisplayName("agent() returns a non-null AgentClient") + void testAgentClient() { + DeepgramClient client = DeepgramClient.builder().apiKey("test-key").build(); + + assertThat(client.agent()).isNotNull(); + } + + @Test + @DisplayName("auth() returns a non-null AuthClient") + void testAuthClient() { + DeepgramClient client = DeepgramClient.builder().apiKey("test-key").build(); + + assertThat(client.auth()).isNotNull(); + } + + @Test + @DisplayName("selfHosted() returns a non-null SelfHostedClient") + void testSelfHostedClient() { + DeepgramClient client = DeepgramClient.builder().apiKey("test-key").build(); + + assertThat(client.selfHosted()).isNotNull(); + } + + @Test + @DisplayName("sub-resources are memoized (same instance returned)") + void testSubResourceMemoization() { + DeepgramClient client = DeepgramClient.builder().apiKey("test-key").build(); + + assertThat(client.listen()).isSameAs(client.listen()); + assertThat(client.speak()).isSameAs(client.speak()); + assertThat(client.read()).isSameAs(client.read()); + assertThat(client.manage()).isSameAs(client.manage()); + } + } +} diff --git a/src/test/java/com/deepgram/IntegrationTest.java b/src/test/java/com/deepgram/IntegrationTest.java new file mode 100644 index 0000000..130a162 --- /dev/null +++ b/src/test/java/com/deepgram/IntegrationTest.java @@ -0,0 +1,225 @@ +package com.deepgram; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +import com.deepgram.core.DeepgramApiApiException; +import com.deepgram.resources.listen.v1.media.requests.ListenV1RequestUrl; +import com.deepgram.resources.listen.v1.media.requests.MediaTranscribeRequestOctetStream; +import com.deepgram.resources.listen.v1.media.types.MediaTranscribeResponse; +import com.deepgram.resources.read.v1.text.requests.TextAnalyzeRequest; +import com.deepgram.resources.speak.v1.audio.requests.SpeakV1Request; +import com.deepgram.types.ListProjectsV1Response; +import com.deepgram.types.ListProjectsV1ResponseProjectsItem; +import com.deepgram.types.ListenV1AcceptedResponse; +import com.deepgram.types.ListenV1Response; +import com.deepgram.types.ListenV1ResponseResults; +import com.deepgram.types.ListenV1ResponseResultsChannelsItem; +import com.deepgram.types.ReadV1Request; +import com.deepgram.types.ReadV1RequestText; +import com.deepgram.types.ReadV1Response; +import java.io.InputStream; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.List; +import java.util.Optional; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; + +/** + * Integration tests for the Deepgram Java SDK. These tests require a valid DEEPGRAM_API_KEY environment variable and + * make real API calls to Deepgram services. + * + *

Tests are organized into tiers: Tier 1 tests must pass before release; Tier 2 tests should pass but are less + * critical. + */ +public class IntegrationTest { + + private static final String TEST_AUDIO_URL = "https://dpgr.am/spacewalk.wav"; + + private DeepgramClient client; + private String apiKey; + + @BeforeEach + void setUp() { + apiKey = System.getenv("DEEPGRAM_API_KEY"); + org.junit.jupiter.api.Assumptions.assumeTrue( + apiKey != null && !apiKey.isEmpty(), "DEEPGRAM_API_KEY not set, skipping integration test"); + client = DeepgramClient.builder().apiKey(apiKey).build(); + } + + // --- Tier 1: Must pass before release --- + + @Nested + @DisplayName("Tier 1: Must-pass tests") + class Tier1Tests { + + @Test + @DisplayName("TranscribeURL - transcribe audio from a URL") + void testIntegration_TranscribeURL() { + ListenV1RequestUrl request = + ListenV1RequestUrl.builder().url(TEST_AUDIO_URL).build(); + + MediaTranscribeResponse result = client.listen().v1().media().transcribeUrl(request); + + assertThat(result).isNotNull(); + + // Visit the union type to extract ListenV1Response + ListenV1Response response = result.visit(new MediaTranscribeResponse.Visitor() { + @Override + public ListenV1Response visit(ListenV1Response value) { + return value; + } + + @Override + public ListenV1Response visit(ListenV1AcceptedResponse value) { + return null; + } + }); + + assertThat(response).as("expected ListenV1Response").isNotNull(); + + ListenV1ResponseResults results = response.getResults(); + assertThat(results).isNotNull(); + assertThat(results.getChannels()).isNotEmpty(); + + ListenV1ResponseResultsChannelsItem firstChannel = + results.getChannels().get(0); + assertThat(firstChannel.getAlternatives()).isPresent(); + assertThat(firstChannel.getAlternatives().get()).isNotEmpty(); + + Optional transcript = + firstChannel.getAlternatives().get().get(0).getTranscript(); + assertThat(transcript).isPresent(); + assertThat(transcript.get()).isNotEmpty(); + System.out.println("Transcript: " + transcript.get()); + } + + @Test + @DisplayName("TranscribeFile - transcribe audio from raw bytes") + void testIntegration_TranscribeFile() throws Exception { + // Download audio file + URL url = new URL(TEST_AUDIO_URL); + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + connection.setRequestMethod("GET"); + byte[] audioData; + try (InputStream inputStream = connection.getInputStream()) { + audioData = inputStream.readAllBytes(); + } + assertThat(audioData).isNotEmpty(); + + MediaTranscribeRequestOctetStream request = + MediaTranscribeRequestOctetStream.builder().body(audioData).build(); + + MediaTranscribeResponse result = client.listen().v1().media().transcribeFile(request); + + assertThat(result).isNotNull(); + + ListenV1Response response = result.visit(new MediaTranscribeResponse.Visitor() { + @Override + public ListenV1Response visit(ListenV1Response value) { + return value; + } + + @Override + public ListenV1Response visit(ListenV1AcceptedResponse value) { + return null; + } + }); + + assertThat(response).as("expected ListenV1Response").isNotNull(); + + ListenV1ResponseResults results = response.getResults(); + assertThat(results).isNotNull(); + assertThat(results.getChannels()).isNotEmpty(); + + ListenV1ResponseResultsChannelsItem firstChannel = + results.getChannels().get(0); + assertThat(firstChannel.getAlternatives()).isPresent(); + assertThat(firstChannel.getAlternatives().get()).isNotEmpty(); + + Optional transcript = + firstChannel.getAlternatives().get().get(0).getTranscript(); + assertThat(transcript).isPresent(); + assertThat(transcript.get()).isNotEmpty(); + System.out.println("File transcript: " + transcript.get()); + } + + @Test + @DisplayName("SpeakREST - generate speech from text") + void testIntegration_SpeakREST() throws Exception { + SpeakV1Request request = SpeakV1Request.builder() + .text("Hello, this is a test of the Deepgram text to speech API.") + .build(); + + InputStream audioStream = client.speak().v1().audio().generate(request); + + assertThat(audioStream).isNotNull(); + byte[] audioData = audioStream.readAllBytes(); + assertThat(audioData.length).as("expected audio bytes").isGreaterThan(0); + System.out.println("Speak REST returned " + audioData.length + " bytes of audio"); + } + + @Test + @DisplayName("InvalidAPIKey_REST - verify error handling for invalid key") + void testIntegration_InvalidAPIKey_REST() { + DeepgramClient invalidClient = + DeepgramClient.builder().apiKey("invalid-key-12345").build(); + + ListenV1RequestUrl request = + ListenV1RequestUrl.builder().url(TEST_AUDIO_URL).build(); + + assertThatThrownBy(() -> invalidClient.listen().v1().media().transcribeUrl(request)) + .isInstanceOf(DeepgramApiApiException.class) + .satisfies(thrown -> { + DeepgramApiApiException apiException = (DeepgramApiApiException) thrown; + System.out.println("Got API error: status=" + apiException.statusCode()); + assertThat(apiException.statusCode()) + .as("expected 401 or 403 for invalid API key") + .isIn(401, 403); + }); + } + } + + // --- Tier 2: Should pass, less critical --- + + @Nested + @DisplayName("Tier 2: Should-pass tests") + class Tier2Tests { + + @Test + @DisplayName("ReadAnalyze - analyze text content") + void testIntegration_ReadAnalyze() { + TextAnalyzeRequest request = TextAnalyzeRequest.builder() + .body(ReadV1Request.of(ReadV1RequestText.builder() + .text("The Java SDK is working great. I love using Deepgram for speech to text.") + .build())) + .sentiment(true) + .topics(true) + .language("en") + .build(); + + ReadV1Response result = client.read().v1().text().analyze(request); + + assertThat(result).isNotNull(); + assertThat(result.getResults()).isNotNull(); + System.out.println("Read analysis completed successfully"); + } + + @Test + @DisplayName("ManageProjects - list projects for the API key") + void testIntegration_ManageProjects() { + ListProjectsV1Response result = client.manage().v1().projects().list(); + + assertThat(result).isNotNull(); + assertThat(result.getProjects()).isPresent(); + + List projects = + result.getProjects().get(); + assertThat(projects).as("expected at least one project").isNotEmpty(); + System.out.println("Found " + projects.size() + " projects"); + } + } +} diff --git a/src/test/java/com/deepgram/core/EnvironmentTest.java b/src/test/java/com/deepgram/core/EnvironmentTest.java new file mode 100644 index 0000000..6c67a76 --- /dev/null +++ b/src/test/java/com/deepgram/core/EnvironmentTest.java @@ -0,0 +1,88 @@ +package com.deepgram.core; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; + +/** Unit tests for the {@link Environment} class. */ +class EnvironmentTest { + + @Nested + @DisplayName("PRODUCTION environment") + class ProductionEnvironment { + + @Test + @DisplayName("base URL points to api.deepgram.com") + void testBaseUrl() { + assertThat(Environment.PRODUCTION.getBaseURL()).isEqualTo("https://api.deepgram.com"); + } + + @Test + @DisplayName("agent URL points to wss://agent.deepgram.com") + void testAgentUrl() { + assertThat(Environment.PRODUCTION.getAgentURL()).isEqualTo("wss://agent.deepgram.com"); + } + + @Test + @DisplayName("production URL uses wss://api.deepgram.com") + void testProductionUrl() { + assertThat(Environment.PRODUCTION.getProductionURL()).isEqualTo("wss://api.deepgram.com"); + } + } + + @Nested + @DisplayName("AGENT environment") + class AgentEnvironment { + + @Test + @DisplayName("base URL points to agent.deepgram.com") + void testBaseUrl() { + assertThat(Environment.AGENT.getBaseURL()).isEqualTo("https://agent.deepgram.com"); + } + + @Test + @DisplayName("agent URL points to wss://agent.deepgram.com") + void testAgentUrl() { + assertThat(Environment.AGENT.getAgentURL()).isEqualTo("wss://agent.deepgram.com"); + } + + @Test + @DisplayName("production URL uses wss://api.deepgram.com") + void testProductionUrl() { + assertThat(Environment.AGENT.getProductionURL()).isEqualTo("wss://api.deepgram.com"); + } + } + + @Nested + @DisplayName("Custom environment builder") + class CustomEnvironment { + + @Test + @DisplayName("builds environment with all custom URLs") + void testCustomBuilder() { + Environment custom = Environment.custom() + .base("https://custom-api.example.com") + .agent("wss://custom-agent.example.com") + .production("wss://custom-api.example.com") + .build(); + + assertThat(custom.getBaseURL()).isEqualTo("https://custom-api.example.com"); + assertThat(custom.getAgentURL()).isEqualTo("wss://custom-agent.example.com"); + assertThat(custom.getProductionURL()).isEqualTo("wss://custom-api.example.com"); + } + + @Test + @DisplayName("builds environment with partial custom URLs") + void testPartialCustomBuilder() { + Environment custom = + Environment.custom().base("https://my-proxy.example.com").build(); + + assertThat(custom.getBaseURL()).isEqualTo("https://my-proxy.example.com"); + // Unset fields should be null + assertThat(custom.getAgentURL()).isNull(); + assertThat(custom.getProductionURL()).isNull(); + } + } +} diff --git a/src/test/java/core/QueryStringMapperTest.java b/src/test/java/com/deepgram/core/QueryStringMapperTest.java similarity index 99% rename from src/test/java/core/QueryStringMapperTest.java rename to src/test/java/com/deepgram/core/QueryStringMapperTest.java index c53981a..4c179fb 100644 --- a/src/test/java/core/QueryStringMapperTest.java +++ b/src/test/java/com/deepgram/core/QueryStringMapperTest.java @@ -1,5 +1,5 @@ /** This file was auto-generated by Fern from our API Definition. */ -package core; +package com.deepgram.core; import java.time.Instant; import java.time.OffsetDateTime; diff --git a/src/test/java/com/deepgram/core/RetryInterceptorTest.java b/src/test/java/com/deepgram/core/RetryInterceptorTest.java new file mode 100644 index 0000000..7017321 --- /dev/null +++ b/src/test/java/com/deepgram/core/RetryInterceptorTest.java @@ -0,0 +1,287 @@ +package com.deepgram.core; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.IOException; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; + +/** Unit tests for the {@link RetryInterceptor} class. */ +class RetryInterceptorTest { + + private MockWebServer server; + private OkHttpClient client; + + @BeforeEach + void setUp() throws IOException { + server = new MockWebServer(); + server.start(); + } + + @AfterEach + void tearDown() throws IOException { + server.shutdown(); + } + + private OkHttpClient buildClientWithRetries(int maxRetries) { + return new OkHttpClient.Builder() + .addInterceptor(new RetryInterceptor(maxRetries)) + .build(); + } + + private Request buildRequest() { + return new Request.Builder().url(server.url("/test")).build(); + } + + @Nested + @DisplayName("Status codes that should trigger retries") + class RetriableStatusCodes { + + @Test + @DisplayName("retries on 429 Too Many Requests and eventually succeeds") + void testRetryOn429() throws Exception { + client = buildClientWithRetries(2); + + server.enqueue(new MockResponse().setResponseCode(429).setBody("rate limited")); + server.enqueue(new MockResponse().setResponseCode(200).setBody("success")); + + Response response = client.newCall(buildRequest()).execute(); + + assertThat(response.code()).isEqualTo(200); + assertThat(response.body().string()).isEqualTo("success"); + assertThat(server.getRequestCount()).isEqualTo(2); + } + + @Test + @DisplayName("retries on 500 Internal Server Error and eventually succeeds") + void testRetryOn500() throws Exception { + client = buildClientWithRetries(2); + + server.enqueue(new MockResponse().setResponseCode(500).setBody("server error")); + server.enqueue(new MockResponse().setResponseCode(200).setBody("success")); + + Response response = client.newCall(buildRequest()).execute(); + + assertThat(response.code()).isEqualTo(200); + assertThat(response.body().string()).isEqualTo("success"); + assertThat(server.getRequestCount()).isEqualTo(2); + } + + @Test + @DisplayName("retries on 503 Service Unavailable and eventually succeeds") + void testRetryOn503() throws Exception { + client = buildClientWithRetries(2); + + server.enqueue(new MockResponse().setResponseCode(503).setBody("unavailable")); + server.enqueue(new MockResponse().setResponseCode(200).setBody("success")); + + Response response = client.newCall(buildRequest()).execute(); + + assertThat(response.code()).isEqualTo(200); + assertThat(response.body().string()).isEqualTo("success"); + assertThat(server.getRequestCount()).isEqualTo(2); + } + + @Test + @DisplayName("retries on 408 Request Timeout and eventually succeeds") + void testRetryOn408() throws Exception { + client = buildClientWithRetries(2); + + server.enqueue(new MockResponse().setResponseCode(408).setBody("timeout")); + server.enqueue(new MockResponse().setResponseCode(200).setBody("success")); + + Response response = client.newCall(buildRequest()).execute(); + + assertThat(response.code()).isEqualTo(200); + assertThat(response.body().string()).isEqualTo("success"); + assertThat(server.getRequestCount()).isEqualTo(2); + } + } + + @Nested + @DisplayName("Status codes that should NOT trigger retries") + class NonRetriableStatusCodes { + + @Test + @DisplayName("does not retry on 200 OK") + void testNoRetryOn200() throws Exception { + client = buildClientWithRetries(2); + + server.enqueue(new MockResponse().setResponseCode(200).setBody("ok")); + + Response response = client.newCall(buildRequest()).execute(); + + assertThat(response.code()).isEqualTo(200); + assertThat(response.body().string()).isEqualTo("ok"); + assertThat(server.getRequestCount()).isEqualTo(1); + } + + @Test + @DisplayName("does not retry on 400 Bad Request") + void testNoRetryOn400() throws Exception { + client = buildClientWithRetries(2); + + server.enqueue(new MockResponse().setResponseCode(400).setBody("bad request")); + + Response response = client.newCall(buildRequest()).execute(); + + assertThat(response.code()).isEqualTo(400); + assertThat(response.body().string()).isEqualTo("bad request"); + assertThat(server.getRequestCount()).isEqualTo(1); + } + + @Test + @DisplayName("does not retry on 401 Unauthorized") + void testNoRetryOn401() throws Exception { + client = buildClientWithRetries(2); + + server.enqueue(new MockResponse().setResponseCode(401).setBody("unauthorized")); + + Response response = client.newCall(buildRequest()).execute(); + + assertThat(response.code()).isEqualTo(401); + assertThat(response.body().string()).isEqualTo("unauthorized"); + assertThat(server.getRequestCount()).isEqualTo(1); + } + + @Test + @DisplayName("does not retry on 403 Forbidden") + void testNoRetryOn403() throws Exception { + client = buildClientWithRetries(2); + + server.enqueue(new MockResponse().setResponseCode(403).setBody("forbidden")); + + Response response = client.newCall(buildRequest()).execute(); + + assertThat(response.code()).isEqualTo(403); + assertThat(response.body().string()).isEqualTo("forbidden"); + assertThat(server.getRequestCount()).isEqualTo(1); + } + + @Test + @DisplayName("does not retry on 404 Not Found") + void testNoRetryOn404() throws Exception { + client = buildClientWithRetries(2); + + server.enqueue(new MockResponse().setResponseCode(404).setBody("not found")); + + Response response = client.newCall(buildRequest()).execute(); + + assertThat(response.code()).isEqualTo(404); + assertThat(response.body().string()).isEqualTo("not found"); + assertThat(server.getRequestCount()).isEqualTo(1); + } + } + + @Nested + @DisplayName("Retry limit behavior") + class RetryLimits { + + @Test + @DisplayName("stops retrying after max retries exhausted") + void testMaxRetriesExhausted() throws Exception { + client = buildClientWithRetries(2); + + // Enqueue 3 failures (initial + 2 retries) - all should be consumed + server.enqueue(new MockResponse().setResponseCode(500).setBody("error 1")); + server.enqueue(new MockResponse().setResponseCode(500).setBody("error 2")); + server.enqueue(new MockResponse().setResponseCode(500).setBody("error 3")); + // This 4th response should NOT be reached + server.enqueue(new MockResponse().setResponseCode(200).setBody("success")); + + Response response = client.newCall(buildRequest()).execute(); + + assertThat(response.code()).isEqualTo(500); + // 1 initial request + 2 retries = 3 total requests + assertThat(server.getRequestCount()).isEqualTo(3); + } + + @Test + @DisplayName("zero max retries means no retries at all") + void testZeroRetries() throws Exception { + client = buildClientWithRetries(0); + + server.enqueue(new MockResponse().setResponseCode(500).setBody("error")); + server.enqueue(new MockResponse().setResponseCode(200).setBody("success")); + + Response response = client.newCall(buildRequest()).execute(); + + assertThat(response.code()).isEqualTo(500); + assertThat(server.getRequestCount()).isEqualTo(1); + } + + @Test + @DisplayName("succeeds on last retry attempt") + void testSucceedsOnLastRetry() throws Exception { + client = buildClientWithRetries(3); + + server.enqueue(new MockResponse().setResponseCode(500).setBody("error 1")); + server.enqueue(new MockResponse().setResponseCode(500).setBody("error 2")); + server.enqueue(new MockResponse().setResponseCode(500).setBody("error 3")); + server.enqueue(new MockResponse().setResponseCode(200).setBody("success")); + + Response response = client.newCall(buildRequest()).execute(); + + assertThat(response.code()).isEqualTo(200); + assertThat(response.body().string()).isEqualTo("success"); + // 1 initial + 3 retries = 4 total + assertThat(server.getRequestCount()).isEqualTo(4); + } + } + + @Nested + @DisplayName("Retry-After header handling") + class RetryAfterHeader { + + @Test + @DisplayName("respects Retry-After header with seconds value") + void testRetryAfterSeconds() throws Exception { + client = buildClientWithRetries(1); + + server.enqueue(new MockResponse() + .setResponseCode(429) + .setHeader("Retry-After", "1") + .setBody("rate limited")); + server.enqueue(new MockResponse().setResponseCode(200).setBody("success")); + + long start = System.currentTimeMillis(); + Response response = client.newCall(buildRequest()).execute(); + long elapsed = System.currentTimeMillis() - start; + + assertThat(response.code()).isEqualTo(200); + assertThat(server.getRequestCount()).isEqualTo(2); + // Should have waited at least ~1 second (Retry-After: 1) + assertThat(elapsed).isGreaterThanOrEqualTo(900L); + } + } + + @Nested + @DisplayName("Mixed status code sequences") + class MixedSequences { + + @Test + @DisplayName("retries through multiple different server error codes") + void testMultipleDifferentErrors() throws Exception { + client = buildClientWithRetries(3); + + server.enqueue(new MockResponse().setResponseCode(500)); + server.enqueue(new MockResponse().setResponseCode(503)); + server.enqueue(new MockResponse().setResponseCode(429)); + server.enqueue(new MockResponse().setResponseCode(200).setBody("finally")); + + Response response = client.newCall(buildRequest()).execute(); + + assertThat(response.code()).isEqualTo(200); + assertThat(response.body().string()).isEqualTo("finally"); + assertThat(server.getRequestCount()).isEqualTo(4); + } + } +} diff --git a/src/test/java/core/EnvironmentTest.java b/src/test/java/core/EnvironmentTest.java deleted file mode 100644 index 3eb84e1..0000000 --- a/src/test/java/core/EnvironmentTest.java +++ /dev/null @@ -1,88 +0,0 @@ -package core; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Nested; -import org.junit.jupiter.api.Test; - -/** Unit tests for the {@link Environment} class. */ -class EnvironmentTest { - - @Nested - @DisplayName("PRODUCTION environment") - class ProductionEnvironment { - - @Test - @DisplayName("base URL points to api.deepgram.com") - void testBaseUrl() { - assertThat(Environment.PRODUCTION.getBaseURL()).isEqualTo("https://api.deepgram.com"); - } - - @Test - @DisplayName("agent URL points to wss://agent.deepgram.com") - void testAgentUrl() { - assertThat(Environment.PRODUCTION.getAgentURL()).isEqualTo("wss://agent.deepgram.com"); - } - - @Test - @DisplayName("production URL uses wss://api.deepgram.com") - void testProductionUrl() { - assertThat(Environment.PRODUCTION.getProductionURL()).isEqualTo("wss://api.deepgram.com"); - } - } - - @Nested - @DisplayName("AGENT environment") - class AgentEnvironment { - - @Test - @DisplayName("base URL points to agent.deepgram.com") - void testBaseUrl() { - assertThat(Environment.AGENT.getBaseURL()).isEqualTo("https://agent.deepgram.com"); - } - - @Test - @DisplayName("agent URL points to wss://agent.deepgram.com") - void testAgentUrl() { - assertThat(Environment.AGENT.getAgentURL()).isEqualTo("wss://agent.deepgram.com"); - } - - @Test - @DisplayName("production URL uses wss://api.deepgram.com") - void testProductionUrl() { - assertThat(Environment.AGENT.getProductionURL()).isEqualTo("wss://api.deepgram.com"); - } - } - - @Nested - @DisplayName("Custom environment builder") - class CustomEnvironment { - - @Test - @DisplayName("builds environment with all custom URLs") - void testCustomBuilder() { - Environment custom = - Environment.custom() - .base("https://custom-api.example.com") - .agent("wss://custom-agent.example.com") - .production("wss://custom-api.example.com") - .build(); - - assertThat(custom.getBaseURL()).isEqualTo("https://custom-api.example.com"); - assertThat(custom.getAgentURL()).isEqualTo("wss://custom-agent.example.com"); - assertThat(custom.getProductionURL()).isEqualTo("wss://custom-api.example.com"); - } - - @Test - @DisplayName("builds environment with partial custom URLs") - void testPartialCustomBuilder() { - Environment custom = Environment.custom().base("https://my-proxy.example.com").build(); - - assertThat(custom.getBaseURL()).isEqualTo("https://my-proxy.example.com"); - // Unset fields should be null - assertThat(custom.getAgentURL()).isNull(); - assertThat(custom.getProductionURL()).isNull(); - } - } -} diff --git a/src/test/java/core/RetryInterceptorTest.java b/src/test/java/core/RetryInterceptorTest.java deleted file mode 100644 index c28ad8d..0000000 --- a/src/test/java/core/RetryInterceptorTest.java +++ /dev/null @@ -1,286 +0,0 @@ -package core; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.io.IOException; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import okhttp3.mockwebserver.MockResponse; -import okhttp3.mockwebserver.MockWebServer; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Nested; -import org.junit.jupiter.api.Test; - -/** Unit tests for the {@link RetryInterceptor} class. */ -class RetryInterceptorTest { - - private MockWebServer server; - private OkHttpClient client; - - @BeforeEach - void setUp() throws IOException { - server = new MockWebServer(); - server.start(); - } - - @AfterEach - void tearDown() throws IOException { - server.shutdown(); - } - - private OkHttpClient buildClientWithRetries(int maxRetries) { - return new OkHttpClient.Builder().addInterceptor(new RetryInterceptor(maxRetries)).build(); - } - - private Request buildRequest() { - return new Request.Builder().url(server.url("/test")).build(); - } - - @Nested - @DisplayName("Status codes that should trigger retries") - class RetriableStatusCodes { - - @Test - @DisplayName("retries on 429 Too Many Requests and eventually succeeds") - void testRetryOn429() throws Exception { - client = buildClientWithRetries(2); - - server.enqueue(new MockResponse().setResponseCode(429).setBody("rate limited")); - server.enqueue(new MockResponse().setResponseCode(200).setBody("success")); - - Response response = client.newCall(buildRequest()).execute(); - - assertThat(response.code()).isEqualTo(200); - assertThat(response.body().string()).isEqualTo("success"); - assertThat(server.getRequestCount()).isEqualTo(2); - } - - @Test - @DisplayName("retries on 500 Internal Server Error and eventually succeeds") - void testRetryOn500() throws Exception { - client = buildClientWithRetries(2); - - server.enqueue(new MockResponse().setResponseCode(500).setBody("server error")); - server.enqueue(new MockResponse().setResponseCode(200).setBody("success")); - - Response response = client.newCall(buildRequest()).execute(); - - assertThat(response.code()).isEqualTo(200); - assertThat(response.body().string()).isEqualTo("success"); - assertThat(server.getRequestCount()).isEqualTo(2); - } - - @Test - @DisplayName("retries on 503 Service Unavailable and eventually succeeds") - void testRetryOn503() throws Exception { - client = buildClientWithRetries(2); - - server.enqueue(new MockResponse().setResponseCode(503).setBody("unavailable")); - server.enqueue(new MockResponse().setResponseCode(200).setBody("success")); - - Response response = client.newCall(buildRequest()).execute(); - - assertThat(response.code()).isEqualTo(200); - assertThat(response.body().string()).isEqualTo("success"); - assertThat(server.getRequestCount()).isEqualTo(2); - } - - @Test - @DisplayName("retries on 408 Request Timeout and eventually succeeds") - void testRetryOn408() throws Exception { - client = buildClientWithRetries(2); - - server.enqueue(new MockResponse().setResponseCode(408).setBody("timeout")); - server.enqueue(new MockResponse().setResponseCode(200).setBody("success")); - - Response response = client.newCall(buildRequest()).execute(); - - assertThat(response.code()).isEqualTo(200); - assertThat(response.body().string()).isEqualTo("success"); - assertThat(server.getRequestCount()).isEqualTo(2); - } - } - - @Nested - @DisplayName("Status codes that should NOT trigger retries") - class NonRetriableStatusCodes { - - @Test - @DisplayName("does not retry on 200 OK") - void testNoRetryOn200() throws Exception { - client = buildClientWithRetries(2); - - server.enqueue(new MockResponse().setResponseCode(200).setBody("ok")); - - Response response = client.newCall(buildRequest()).execute(); - - assertThat(response.code()).isEqualTo(200); - assertThat(response.body().string()).isEqualTo("ok"); - assertThat(server.getRequestCount()).isEqualTo(1); - } - - @Test - @DisplayName("does not retry on 400 Bad Request") - void testNoRetryOn400() throws Exception { - client = buildClientWithRetries(2); - - server.enqueue(new MockResponse().setResponseCode(400).setBody("bad request")); - - Response response = client.newCall(buildRequest()).execute(); - - assertThat(response.code()).isEqualTo(400); - assertThat(response.body().string()).isEqualTo("bad request"); - assertThat(server.getRequestCount()).isEqualTo(1); - } - - @Test - @DisplayName("does not retry on 401 Unauthorized") - void testNoRetryOn401() throws Exception { - client = buildClientWithRetries(2); - - server.enqueue(new MockResponse().setResponseCode(401).setBody("unauthorized")); - - Response response = client.newCall(buildRequest()).execute(); - - assertThat(response.code()).isEqualTo(401); - assertThat(response.body().string()).isEqualTo("unauthorized"); - assertThat(server.getRequestCount()).isEqualTo(1); - } - - @Test - @DisplayName("does not retry on 403 Forbidden") - void testNoRetryOn403() throws Exception { - client = buildClientWithRetries(2); - - server.enqueue(new MockResponse().setResponseCode(403).setBody("forbidden")); - - Response response = client.newCall(buildRequest()).execute(); - - assertThat(response.code()).isEqualTo(403); - assertThat(response.body().string()).isEqualTo("forbidden"); - assertThat(server.getRequestCount()).isEqualTo(1); - } - - @Test - @DisplayName("does not retry on 404 Not Found") - void testNoRetryOn404() throws Exception { - client = buildClientWithRetries(2); - - server.enqueue(new MockResponse().setResponseCode(404).setBody("not found")); - - Response response = client.newCall(buildRequest()).execute(); - - assertThat(response.code()).isEqualTo(404); - assertThat(response.body().string()).isEqualTo("not found"); - assertThat(server.getRequestCount()).isEqualTo(1); - } - } - - @Nested - @DisplayName("Retry limit behavior") - class RetryLimits { - - @Test - @DisplayName("stops retrying after max retries exhausted") - void testMaxRetriesExhausted() throws Exception { - client = buildClientWithRetries(2); - - // Enqueue 3 failures (initial + 2 retries) - all should be consumed - server.enqueue(new MockResponse().setResponseCode(500).setBody("error 1")); - server.enqueue(new MockResponse().setResponseCode(500).setBody("error 2")); - server.enqueue(new MockResponse().setResponseCode(500).setBody("error 3")); - // This 4th response should NOT be reached - server.enqueue(new MockResponse().setResponseCode(200).setBody("success")); - - Response response = client.newCall(buildRequest()).execute(); - - assertThat(response.code()).isEqualTo(500); - // 1 initial request + 2 retries = 3 total requests - assertThat(server.getRequestCount()).isEqualTo(3); - } - - @Test - @DisplayName("zero max retries means no retries at all") - void testZeroRetries() throws Exception { - client = buildClientWithRetries(0); - - server.enqueue(new MockResponse().setResponseCode(500).setBody("error")); - server.enqueue(new MockResponse().setResponseCode(200).setBody("success")); - - Response response = client.newCall(buildRequest()).execute(); - - assertThat(response.code()).isEqualTo(500); - assertThat(server.getRequestCount()).isEqualTo(1); - } - - @Test - @DisplayName("succeeds on last retry attempt") - void testSucceedsOnLastRetry() throws Exception { - client = buildClientWithRetries(3); - - server.enqueue(new MockResponse().setResponseCode(500).setBody("error 1")); - server.enqueue(new MockResponse().setResponseCode(500).setBody("error 2")); - server.enqueue(new MockResponse().setResponseCode(500).setBody("error 3")); - server.enqueue(new MockResponse().setResponseCode(200).setBody("success")); - - Response response = client.newCall(buildRequest()).execute(); - - assertThat(response.code()).isEqualTo(200); - assertThat(response.body().string()).isEqualTo("success"); - // 1 initial + 3 retries = 4 total - assertThat(server.getRequestCount()).isEqualTo(4); - } - } - - @Nested - @DisplayName("Retry-After header handling") - class RetryAfterHeader { - - @Test - @DisplayName("respects Retry-After header with seconds value") - void testRetryAfterSeconds() throws Exception { - client = buildClientWithRetries(1); - - server.enqueue( - new MockResponse() - .setResponseCode(429) - .setHeader("Retry-After", "1") - .setBody("rate limited")); - server.enqueue(new MockResponse().setResponseCode(200).setBody("success")); - - long start = System.currentTimeMillis(); - Response response = client.newCall(buildRequest()).execute(); - long elapsed = System.currentTimeMillis() - start; - - assertThat(response.code()).isEqualTo(200); - assertThat(server.getRequestCount()).isEqualTo(2); - // Should have waited at least ~1 second (Retry-After: 1) - assertThat(elapsed).isGreaterThanOrEqualTo(900L); - } - } - - @Nested - @DisplayName("Mixed status code sequences") - class MixedSequences { - - @Test - @DisplayName("retries through multiple different server error codes") - void testMultipleDifferentErrors() throws Exception { - client = buildClientWithRetries(3); - - server.enqueue(new MockResponse().setResponseCode(500)); - server.enqueue(new MockResponse().setResponseCode(503)); - server.enqueue(new MockResponse().setResponseCode(429)); - server.enqueue(new MockResponse().setResponseCode(200).setBody("finally")); - - Response response = client.newCall(buildRequest()).execute(); - - assertThat(response.code()).isEqualTo(200); - assertThat(response.body().string()).isEqualTo("finally"); - assertThat(server.getRequestCount()).isEqualTo(4); - } - } -}