diff --git a/.gitignore b/.gitignore index 60b413c0..018ae61d 100644 --- a/.gitignore +++ b/.gitignore @@ -79,4 +79,6 @@ nb-configuration.xml ############################## ## OS X ############################## -.DS_Store \ No newline at end of file +.DS_Store + +gen diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..df376f56 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "codegen/apis"] + path = codegen/apis + url = git@github.com:pinecone-io/apis.git diff --git a/README.md b/README.md index a8e16d64..5216eb55 100644 --- a/README.md +++ b/README.md @@ -39,8 +39,7 @@ having to obtain the *pinecone-client* dependencies separately. ### Initializing the client Before you can use the Pinecone Java SDK, you must sign up for a Pinecone account and find your API key in the Pinecone -console -dashboard at [https://app.pinecone.io](https://app.pinecone.io). +console dashboard at [https://app.pinecone.io](https://app.pinecone.io). #### Using apiKey @@ -75,7 +74,7 @@ public class InitializeClientExample { OkHttpClient httpClient = builder.build(); - Pinecone pinecone = new Pinecone.Builder("PINECONE_API_KEY").build(); + Pinecone pinecone = new Pinecone.Builder("PINECONE_API_KEY").withOkHttpClient(httpClient).build(); } } ``` diff --git a/codegen/apis b/codegen/apis new file mode 160000 index 00000000..3e5739b4 --- /dev/null +++ b/codegen/apis @@ -0,0 +1 @@ +Subproject commit 3e5739b49a9592a0a7da935e4247e377bd5d1e8a diff --git a/codegen/build-oas.sh b/codegen/build-oas.sh new file mode 100755 index 00000000..1edda52e --- /dev/null +++ b/codegen/build-oas.sh @@ -0,0 +1,87 @@ +#!/bin/bash + +set -eux -o pipefail + +version=$1 # e.g. 2024-07 +modules=("control") + +destination="src/main/java/org/openapitools" +build_dir="gen" + +update_apis_repo() { + echo "Updating apis repo" + pushd codegen/apis + git fetch + git checkout main + git pull + just build + popd +} + +verify_spec_version() { + local version=$1 + echo "Verifying spec version $version exists in apis repo" + if [ -z "$version" ]; then + echo "Version is required" + exit 1 + fi + + verify_directory_exists "codegen/apis/_build/${version}" +} + +verify_file_exists() { + local filename=$1 + if [ ! -f "$filename" ]; then + echo "File does not exist at $filename" + exit 1 + fi +} + +verify_directory_exists() { + local directory=$1 + if [ ! -d "$directory" ]; then + echo "Directory does not exist at $directory" + exit 1 + fi +} + +generate_client() { + local module_name=$1 + + oas_file="codegen/apis/_build/${version}/${module_name}_${version}.oas.yaml" + + verify_file_exists $oas_file + + # Cleanup previous build files + echo "Cleaning up previous build files" + rm -rf "${build_dir}" + + # Generate client module + docker run --rm -v $(pwd):/workspace openapitools/openapi-generator-cli:v7.0.1 generate \ + --input-spec "/workspace/$oas_file" \ + --generator-name java \ + --additional-properties=dateLibrary='java8',disallowAdditionalPropertiesIfNotPresent=false \ + --output "/workspace/${build_dir}" + + # Copy the generated module to the correct location + rm -rf "${destination}/${module_name}" + mkdir -p "${destination}/${module_name}" + + path_to_copy="${build_dir}/src/main/java/org/openapitools/client" + cp -r $path_to_copy "${destination}/${module_name}" + + # Adjust package names in generated file + find "${destination}/${module_name}" -name "*.java" | while IFS= read -r file; do + sed -i '' "s/org\.openapitools\.client/org\.openapitools\.${module_name}\.client/g" "$file" + done +} + +update_apis_repo +verify_spec_version $version + +rm -rf "${destination}" +mkdir -p "${destination}" + +for module in "${modules[@]}"; do + generate_client $module +done diff --git a/src/integration/java/io/pinecone/helpers/TestResourcesManager.java b/src/integration/java/io/pinecone/helpers/TestResourcesManager.java index 840854a6..5da24484 100644 --- a/src/integration/java/io/pinecone/helpers/TestResourcesManager.java +++ b/src/integration/java/io/pinecone/helpers/TestResourcesManager.java @@ -5,7 +5,7 @@ import io.pinecone.clients.Pinecone; import io.pinecone.exceptions.PineconeException; import io.pinecone.proto.DescribeIndexStatsResponse; -import org.openapitools.client.model.*; +import org.openapitools.control.client.model.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -50,8 +50,8 @@ public class TestResourcesManager { ? "us-east4-gcp" : System.getenv("PINECONE_ENVIRONMENT"); private static final String metric = System.getenv("METRIC") == null - ? IndexMetric.DOTPRODUCT.toString() - : IndexMetric.valueOf(System.getenv("METRIC")).toString(); + ? IndexModel.MetricEnum.DOTPRODUCT.toString() + : IndexModel.MetricEnum.valueOf(System.getenv("METRIC")).toString(); private static final String cloud = System.getenv("CLOUD") == null ? ServerlessSpec.CloudEnum.AWS.toString() : System.getenv("CLOUD"); @@ -317,7 +317,7 @@ public String getOrCreateServerlessIndex() throws InterruptedException, Pinecone String indexName = RandomStringBuilder.build("serverless-index", 8); serverlessIndexModel = pineconeClient.createServerlessIndex(indexName, metric, dimension, cloud, - region); + region, DeletionProtection.DISABLED); waitUntilIndexIsReady(pineconeClient, indexName); // Explicitly wait after ready to avoid the "no healthy upstream" issue diff --git a/src/integration/java/io/pinecone/helpers/TestUtilities.java b/src/integration/java/io/pinecone/helpers/TestUtilities.java index 04c1c66c..a04b7eab 100644 --- a/src/integration/java/io/pinecone/helpers/TestUtilities.java +++ b/src/integration/java/io/pinecone/helpers/TestUtilities.java @@ -4,7 +4,7 @@ import io.pinecone.clients.Pinecone; import io.pinecone.proto.DescribeIndexStatsResponse; import io.pinecone.proto.NamespaceSummary; -import org.openapitools.client.model.*; +import org.openapitools.control.client.model.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/integration/java/io/pinecone/integration/controlPlane/pod/CollectionTest.java b/src/integration/java/io/pinecone/integration/controlPlane/pod/CollectionTest.java index c5095696..bcb5ff9e 100644 --- a/src/integration/java/io/pinecone/integration/controlPlane/pod/CollectionTest.java +++ b/src/integration/java/io/pinecone/integration/controlPlane/pod/CollectionTest.java @@ -12,7 +12,7 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -import org.openapitools.client.model.*; +import org.openapitools.control.client.model.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -117,11 +117,11 @@ public void testIndexFromCollectionHappyPath() throws InterruptedException { public void testCreateIndexFromCollectionWithDiffMetric() throws InterruptedException { // Use a different metric than the source index String[] metrics = { - IndexMetric.COSINE.toString(), - IndexMetric.EUCLIDEAN.toString(), - IndexMetric.DOTPRODUCT.toString() + IndexModel.MetricEnum.COSINE.toString(), + IndexModel.MetricEnum.EUCLIDEAN.toString(), + IndexModel.MetricEnum.DOTPRODUCT.toString() }; - String targetMetric = IndexMetric.COSINE.toString(); + String targetMetric = IndexModel.MetricEnum.COSINE.toString(); for (String metric : metrics) { if (!metric.equals(sourceIndexMetric)) { targetMetric = metric; diff --git a/src/integration/java/io/pinecone/integration/controlPlane/pod/ConfigureIndexTest.java b/src/integration/java/io/pinecone/integration/controlPlane/pod/ConfigureIndexTest.java index 9621e7cc..c709eb51 100644 --- a/src/integration/java/io/pinecone/integration/controlPlane/pod/ConfigureIndexTest.java +++ b/src/integration/java/io/pinecone/integration/controlPlane/pod/ConfigureIndexTest.java @@ -8,9 +8,10 @@ import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.openapitools.client.model.IndexModel; -import org.openapitools.client.model.IndexModelStatus; -import org.openapitools.client.model.PodSpec; +import org.openapitools.control.client.model.DeletionProtection; +import org.openapitools.control.client.model.IndexModel; +import org.openapitools.control.client.model.IndexModelStatus; +import org.openapitools.control.client.model.PodSpec; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -55,7 +56,7 @@ public void afterEach() throws InterruptedException { @Test public void configureIndexWithInvalidIndexName() { try { - controlPlaneClient.configureIndex("non-existent-index", 3); + controlPlaneClient.configurePodsIndex("non-existent-index", 3, DeletionProtection.DISABLED); fail("Expected to throw PineconeNotFoundException"); } catch (PineconeNotFoundException expected) { @@ -66,7 +67,7 @@ public void configureIndexWithInvalidIndexName() { @Test public void configureIndexExceedingQuota() { try { - controlPlaneClient.configureIndex(indexName, 600); + controlPlaneClient.configurePodsIndex(indexName, 30, DeletionProtection.DISABLED); fail("Expected to throw PineconeForbiddenException"); } catch (PineconeForbiddenException expected) { assertTrue(expected.getLocalizedMessage().contains("reached the max pods allowed")); @@ -81,7 +82,7 @@ public void scaleUpAndDown() throws InterruptedException { // Verify the scaled up replicas assertWithRetry(() -> { - controlPlaneClient.configureIndex(indexName, 3); + controlPlaneClient.configurePodsIndex(indexName, 3, DeletionProtection.DISABLED); PodSpec podSpec = controlPlaneClient.describeIndex(indexName).getSpec().getPod(); assertNotNull(podSpec); assertEquals(podSpec.getReplicas(), 3); @@ -91,7 +92,7 @@ public void scaleUpAndDown() throws InterruptedException { // Verify replicas were scaled down assertWithRetry(() -> { - controlPlaneClient.configureIndex(indexName, 1); + controlPlaneClient.configurePodsIndex(indexName, 1, DeletionProtection.DISABLED); PodSpec podSpec = controlPlaneClient.describeIndex(indexName).getSpec().getPod(); assertNotNull(podSpec); assertEquals(podSpec.getReplicas(), 1); @@ -107,7 +108,7 @@ public void changingBasePodType() throws InterruptedException { assertEquals(1, indexModel.getSpec().getPod().getReplicas()); // Try to change the base pod type - controlPlaneClient.configureIndex(indexName, "p2.x2"); + controlPlaneClient.configurePodsIndex(indexName, "p2.x2"); fail("Expected to throw PineconeBadRequestException"); } catch (PineconeBadRequestException expected) { @@ -125,7 +126,7 @@ public void sizeIncrease() throws InterruptedException { // Change the pod type to a larger one // Get the index description to verify the new pod type assertWithRetry(() -> { - controlPlaneClient.configureIndex(indexName, "p1.x2"); + controlPlaneClient.configurePodsIndex(indexName, "p1.x2"); PodSpec podSpec = controlPlaneClient.describeIndex(indexName).getSpec().getPod(); assertNotNull(podSpec); assertEquals(podSpec.getPodType(), "p1.x2"); diff --git a/src/integration/java/io/pinecone/integration/controlPlane/pod/CreateDescribeListAndDeleteIndexTest.java b/src/integration/java/io/pinecone/integration/controlPlane/pod/CreateDescribeListAndDeleteIndexTest.java index 7b498380..3fb80381 100644 --- a/src/integration/java/io/pinecone/integration/controlPlane/pod/CreateDescribeListAndDeleteIndexTest.java +++ b/src/integration/java/io/pinecone/integration/controlPlane/pod/CreateDescribeListAndDeleteIndexTest.java @@ -6,7 +6,7 @@ import io.pinecone.helpers.TestResourcesManager; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.openapitools.client.model.*; +import org.openapitools.control.client.model.*; import static org.junit.jupiter.api.Assertions.*; @@ -36,7 +36,7 @@ public void describeAndListIndex() { assertNotNull(indexModel); assertEquals(indexDimension, indexModel.getDimension()); assertEquals(indexName, indexModel.getName()); - assertEquals(IndexMetric.DOTPRODUCT, indexModel.getMetric()); + assertEquals(IndexModel.MetricEnum.DOTPRODUCT, indexModel.getMetric()); assertNotNull(indexModel.getSpec().getPod()); assertEquals(indexPodType, indexModel.getSpec().getPod().getPodType()); @@ -63,7 +63,7 @@ public void createPodsIndexWithMinimumRequiredParams() { assertEquals(podType, podsIndex.getSpec().getPod().getPodType()); // Confirm defaults are put in by the backend when not supplied by the user - assertEquals(IndexMetric.COSINE, podsIndex.getMetric()); + assertEquals(IndexModel.MetricEnum.COSINE, podsIndex.getMetric()); assertEquals(1, podsIndex.getSpec().getPod().getPods()); assertEquals(1, podsIndex.getSpec().getPod().getReplicas()); assertEquals(1, podsIndex.getSpec().getPod().getShards()); diff --git a/src/integration/java/io/pinecone/integration/controlPlane/pod/DeletionProtectionTest.java b/src/integration/java/io/pinecone/integration/controlPlane/pod/DeletionProtectionTest.java new file mode 100644 index 00000000..d084856a --- /dev/null +++ b/src/integration/java/io/pinecone/integration/controlPlane/pod/DeletionProtectionTest.java @@ -0,0 +1,48 @@ +package io.pinecone.integration.controlPlane.pod; + +import io.pinecone.clients.Pinecone; +import io.pinecone.helpers.RandomStringBuilder; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.openapitools.control.client.model.DeletionProtection; +import org.openapitools.control.client.model.IndexModel; + +public class DeletionProtectionTest { + private static final Pinecone controlPlaneClient = new Pinecone + .Builder(System.getenv("PINECONE_API_KEY")) + .withSourceTag("pinecone_test") + .build(); + + @Test + public void createPodIndexWithDeletionProtectionEnabled() { + String indexName = RandomStringBuilder.build("create-pod", 8); + // Create pod index with deletion protection enabled + controlPlaneClient.createPodsIndex(indexName, 3, "us-east-1-aws", "p1.x1", DeletionProtection.ENABLED); + IndexModel indexModel = controlPlaneClient.describeIndex(indexName); + DeletionProtection deletionProtection = indexModel.getDeletionProtection(); + Assertions.assertEquals(deletionProtection, DeletionProtection.ENABLED); + // Configure index to disable deletionProtection + controlPlaneClient.configurePodsIndex(indexName, DeletionProtection.DISABLED); + // Delete index + controlPlaneClient.deleteIndex(indexName); + } + + @Test + public void createPodIndexWithDeletionProtectionDisabled() { + String indexName = RandomStringBuilder.build("create-pod", 8); + // Create pod index with deletion protection disabled + controlPlaneClient.createPodsIndex(indexName, 3, "us-east-1-aws", "p1.x1"); + IndexModel indexModel = controlPlaneClient.describeIndex(indexName); + DeletionProtection deletionProtection = indexModel.getDeletionProtection(); + Assertions.assertEquals(deletionProtection, DeletionProtection.DISABLED); + // Configure index to enable deletionProtection + controlPlaneClient.configurePodsIndex(indexName, DeletionProtection.ENABLED); + indexModel = controlPlaneClient.describeIndex(indexName); + deletionProtection = indexModel.getDeletionProtection(); + Assertions.assertEquals(deletionProtection, DeletionProtection.ENABLED); + // Configure index to disable deletionProtection + controlPlaneClient.configurePodsIndex(indexName, DeletionProtection.DISABLED); + // Delete index + controlPlaneClient.deleteIndex(indexName); + } +} diff --git a/src/integration/java/io/pinecone/integration/controlPlane/serverless/CreateDescribeListAndDeleteIndexTest.java b/src/integration/java/io/pinecone/integration/controlPlane/serverless/CreateDescribeListAndDeleteIndexTest.java index aa4aee29..a8feea06 100644 --- a/src/integration/java/io/pinecone/integration/controlPlane/serverless/CreateDescribeListAndDeleteIndexTest.java +++ b/src/integration/java/io/pinecone/integration/controlPlane/serverless/CreateDescribeListAndDeleteIndexTest.java @@ -7,7 +7,7 @@ import io.pinecone.helpers.TestResourcesManager; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.openapitools.client.model.*; +import org.openapitools.control.client.model.*; import java.util.Arrays; @@ -36,7 +36,7 @@ public void describeAndListIndex() { assertNotNull(indexModel); assertEquals(dimension, indexModel.getDimension()); assertEquals(indexName, indexModel.getName()); - assertEquals(IndexMetric.DOTPRODUCT, indexModel.getMetric()); + assertEquals(IndexModel.MetricEnum.DOTPRODUCT, indexModel.getMetric()); assertNotNull(indexModel.getSpec().getServerless()); // List the index @@ -48,7 +48,7 @@ public void describeAndListIndex() { @Test public void createServerlessIndexWithInvalidName() { try { - controlPlaneClient.createServerlessIndex("Invalid-name", "cosine", 3, "aws", "us-west-2"); + controlPlaneClient.createServerlessIndex("Invalid-name", "cosine", 3, "aws", "us-west-2", DeletionProtection.DISABLED); fail("Expected to throw PineconeBadRequestException"); } catch (PineconeBadRequestException expected) { @@ -59,7 +59,7 @@ public void createServerlessIndexWithInvalidName() { @Test public void createServerlessIndexWithInvalidDimension() { try { - controlPlaneClient.createServerlessIndex("serverless-test-index", "cosine", -3, "aws", "us-west-2"); + controlPlaneClient.createServerlessIndex("serverless-test-index", "cosine", -3, "aws", "us-west-2", DeletionProtection.DISABLED); fail("Expected to throw PineconeValidationException"); } catch (PineconeValidationException expected) { assertTrue(expected.getLocalizedMessage().contains("Dimension must be greater than 0")); @@ -69,7 +69,7 @@ public void createServerlessIndexWithInvalidDimension() { @Test public void createServerlessIndexWithInvalidCloud() { try { - controlPlaneClient.createServerlessIndex("serverless-test-index", "cosine", 3, "blah", "us-west-2"); + controlPlaneClient.createServerlessIndex("serverless-test-index", "cosine", 3, "blah", "us-west-2", DeletionProtection.DISABLED); fail("Expected to throw PineconeValidationException"); } catch (PineconeValidationException expected) { assertTrue(expected.getLocalizedMessage().contains("Cloud cannot be null or empty. Must be one of " + Arrays.toString(ServerlessSpec.CloudEnum.values()))); @@ -79,7 +79,7 @@ public void createServerlessIndexWithInvalidCloud() { @Test public void createServerlessIndexWithInvalidRegion() { try { - controlPlaneClient.createServerlessIndex("serverless-test-index", "cosine", 3, "aws", "invalid-region"); + controlPlaneClient.createServerlessIndex("serverless-test-index", "cosine", 3, "aws", "invalid-region", DeletionProtection.DISABLED); fail("Expected to throw PineconeNotFoundException"); } catch (PineconeNotFoundException expected) { assertTrue(expected.getLocalizedMessage().contains("Resource cloud: aws region: invalid-region not found")); diff --git a/src/integration/java/io/pinecone/integration/controlPlane/serverless/DeletionProtectionTest.java b/src/integration/java/io/pinecone/integration/controlPlane/serverless/DeletionProtectionTest.java new file mode 100644 index 00000000..94cd805e --- /dev/null +++ b/src/integration/java/io/pinecone/integration/controlPlane/serverless/DeletionProtectionTest.java @@ -0,0 +1,45 @@ +package io.pinecone.integration.controlPlane.serverless; + +import io.pinecone.clients.Pinecone; +import io.pinecone.helpers.RandomStringBuilder; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.openapitools.control.client.model.DeletionProtection; +import org.openapitools.control.client.model.IndexModel; + +public class DeletionProtectionTest { + private static final Pinecone controlPlaneClient = new Pinecone + .Builder(System.getenv("PINECONE_API_KEY")) + .withSourceTag("pinecone_test") + .build(); + + @Test + public void createIndexWithDeletionProtectionEnabled() { + String indexName = RandomStringBuilder.build("create-serv", 8); + // Create serverless index with deletion protection enabled + controlPlaneClient.createServerlessIndex(indexName, "cosine", 3, "aws", "us-west-2", DeletionProtection.ENABLED); + // Describe index to verify deletion protection is enabled + IndexModel indexModel = controlPlaneClient.describeIndex(indexName); + DeletionProtection deletionProtection = indexModel.getDeletionProtection(); + Assertions.assertEquals(deletionProtection, DeletionProtection.ENABLED); + } + + @Test + public void createPodIndexWithDeletionProtectionDisabled() { + String indexName = RandomStringBuilder.build("create-pod", 8); + // Create serverless index with deletion protection disabled + controlPlaneClient.createServerlessIndex(indexName, "cosine", 3, "aws", "us-west-2", DeletionProtection.DISABLED); + IndexModel indexModel = controlPlaneClient.describeIndex(indexName); + DeletionProtection deletionProtection = indexModel.getDeletionProtection(); + Assertions.assertEquals(deletionProtection, DeletionProtection.DISABLED); + // Configure index to enable deletionProtection + controlPlaneClient.configureServerlessIndex(indexName, DeletionProtection.ENABLED); + indexModel = controlPlaneClient.describeIndex(indexName); + deletionProtection = indexModel.getDeletionProtection(); + Assertions.assertEquals(deletionProtection, DeletionProtection.ENABLED); + // Configure index to disable deletionProtection + controlPlaneClient.configureServerlessIndex(indexName, DeletionProtection.DISABLED); + // Delete index + controlPlaneClient.deleteIndex(indexName); + } +} diff --git a/src/main/java/io/pinecone/clients/Pinecone.java b/src/main/java/io/pinecone/clients/Pinecone.java index 13bbd5c4..3523383a 100644 --- a/src/main/java/io/pinecone/clients/Pinecone.java +++ b/src/main/java/io/pinecone/clients/Pinecone.java @@ -5,10 +5,11 @@ import io.pinecone.configs.ProxyConfig; import io.pinecone.exceptions.*; import okhttp3.OkHttpClient; -import org.openapitools.client.ApiClient; -import org.openapitools.client.ApiException; -import org.openapitools.client.api.ManageIndexesApi; -import org.openapitools.client.model.*; +import org.openapitools.control.client.ApiClient; +import org.openapitools.control.client.ApiException; +import org.openapitools.control.client.Configuration; +import org.openapitools.control.client.api.ManageIndexesApi; +import org.openapitools.control.client.model.*; import java.net.InetSocketAddress; import java.net.Proxy; @@ -55,7 +56,7 @@ PineconeConfig getConfig() { *

* Example: *

{@code 
-     *     client.createServerlessIndex("YOUR-INDEX", "cosine", 1536, "aws", "us-west-2");
+     *     client.createServerlessIndex("YOUR-INDEX", "cosine", 1536, "aws", "us-west-2", DeletionProtection.ENABLED);
      * }
* * @param indexName The name of the index to be created. @@ -63,22 +64,27 @@ PineconeConfig getConfig() { * @param dimension The number of dimensions for the index. * @param cloud The cloud provider for the index. * @param region The cloud region for the index. + * @param deletionProtection Enable or disable deletion protection for the index. * @return {@link IndexModel} representing the created serverless index. * @throws PineconeException if the API encounters an error during index creation or if any of the arguments are invalid. */ - public IndexModel createServerlessIndex(String indexName, String metric, int dimension, String cloud, - String region) throws PineconeException { + public IndexModel createServerlessIndex(String indexName, + String metric, + int dimension, + String cloud, + String region, + DeletionProtection deletionProtection) throws PineconeException { if (indexName == null || indexName.isEmpty()) { throw new PineconeValidationException("Index name cannot be null or empty"); } if (metric == null || metric.isEmpty()) { - throw new PineconeValidationException("Metric cannot be null or empty. Must be one of " + Arrays.toString(IndexMetric.values())); + throw new PineconeValidationException("Metric cannot be null or empty. Must be one of " + Arrays.toString(CreateIndexRequest.MetricEnum.values())); } try { - IndexMetric.fromValue(metric.toLowerCase()); + CreateIndexRequest.MetricEnum.fromValue(metric.toLowerCase()); } catch (IllegalArgumentException e) { - throw new PineconeValidationException("Metric cannot be null or empty. Must be one of " + Arrays.toString(IndexMetric.values())); + throw new PineconeValidationException("Metric cannot be null or empty. Must be one of " + Arrays.toString(CreateIndexRequest.MetricEnum.values())); } if (dimension < 1) { @@ -99,13 +105,13 @@ public IndexModel createServerlessIndex(String indexName, String metric, int dim } // Convert user string for "metric" arg into IndexMetric - IndexMetric userMetric = IndexMetric.fromValue(metric.toLowerCase()); + CreateIndexRequest.MetricEnum userMetric = CreateIndexRequest.MetricEnum.fromValue(metric.toLowerCase()); // Convert user string for "cloud" arg into ServerlessSpec.CloudEnum ServerlessSpec.CloudEnum cloudProvider = ServerlessSpec.CloudEnum.fromValue(cloud.toLowerCase()); ServerlessSpec serverlessSpec = new ServerlessSpec().cloud(cloudProvider).region(region); - CreateIndexRequestSpec createServerlessIndexRequestSpec = new CreateIndexRequestSpec().serverless(serverlessSpec); + IndexSpec createServerlessIndexRequestSpec = new IndexSpec().serverless(serverlessSpec); IndexModel indexModel = null; @@ -114,7 +120,8 @@ public IndexModel createServerlessIndex(String indexName, String metric, int dim .name(indexName) .metric(userMetric) .dimension(dimension) - .spec(createServerlessIndexRequestSpec)); + .spec(createServerlessIndexRequestSpec) + .deletionProtection(deletionProtection)); } catch (ApiException apiException) { handleApiException(apiException); } @@ -137,7 +144,33 @@ public IndexModel createServerlessIndex(String indexName, String metric, int dim * @throws PineconeException if the API encounters an error during index creation or if any of the arguments are invalid. */ public IndexModel createPodsIndex(String indexName, Integer dimension, String environment, String podType) { - return createPodsIndex(indexName, dimension, environment, podType, null, null, null, null, null, null); + return createPodsIndex(indexName, dimension, environment, podType, null, null, null, + null, null, null, DeletionProtection.DISABLED); + } + + /** + * Overload for creating a new pods index with environment, podType, and deletion protection. + *

+ * Example: + *

{@code
+     *     client.createPodsIndex("YOUR-INDEX", 1536, "us-east4-gcp", "p1.x2", DeletionProtection.ENABLED);
+     * }
+ * + * @param indexName The name of the index to be created. + * @param dimension The number of dimensions for the index. + * @param environment The cloud environment where you want the index to be hosted. + * @param podType The type of pod to use. A string with one of s1, p1, or p2 appended with a "." and one of x1, x2, x4, or x8. + * @param deletionProtection Enable or disable deletion protection for the index. + * @return {@link IndexModel} representing the created serverless index. + * @throws PineconeException if the API encounters an error during index creation or if any of the arguments are invalid. + */ + public IndexModel createPodsIndex(String indexName, + Integer dimension, + String environment, + String podType, + DeletionProtection deletionProtection) { + return createPodsIndex(indexName, dimension, environment, podType, null, null, null, + null, null, null, deletionProtection); } /** @@ -158,7 +191,8 @@ public IndexModel createPodsIndex(String indexName, Integer dimension, String en */ public IndexModel createPodsIndex(String indexName, Integer dimension, String environment, String podType, String metric) { - return createPodsIndex(indexName, dimension, environment, podType, metric, null, null, null, null, null); + return createPodsIndex(indexName, dimension, environment, podType, metric, null, null, + null, null, null, DeletionProtection.DISABLED); } /** @@ -166,11 +200,11 @@ public IndexModel createPodsIndex(String indexName, Integer dimension, String en *

* Example: *

{@code 
-     *     import org.openapitools.client.model.CreateIndexRequestSpecPodMetadataConfig;
+     *     import org.openapitools.control.client.model.PodSpecMetadataConfig;
      *     ...
      *
-     *     CreateIndexRequestSpecPodMetadataConfig metadataConfig =
-     *         new CreateIndexRequestSpecPodMetadataConfig()
+     *     PodSpecMetadataConfig metadataConfig =
+     *         new PodSpecMetadataConfig()
      *         .fields(Arrays.asList("genre", "year"));
      *
      *     client.createPodsIndex("YOUR-INDEX", 1536, "us-east4-gcp", "p1.x2", "cosine", metadataConfig);
@@ -187,9 +221,9 @@ public IndexModel createPodsIndex(String indexName, Integer dimension, String en
      * @throws PineconeException if the API encounters an error during index creation or if any of the arguments are invalid.
      */
     public IndexModel createPodsIndex(String indexName, Integer dimension, String environment,
-                                      String podType, String metric, CreateIndexRequestSpecPodMetadataConfig metadataConfig) {
-        return createPodsIndex(indexName, dimension, environment, podType, metric, null, null, null, metadataConfig,
-                null);
+                                      String podType, String metric, PodSpecMetadataConfig metadataConfig) {
+        return createPodsIndex(indexName, dimension, environment, podType, metric, null, null, null,
+                metadataConfig,null, DeletionProtection.DISABLED);
     }
 
     /**
@@ -212,7 +246,7 @@ public IndexModel createPodsIndex(String indexName, Integer dimension, String en
     public IndexModel createPodsIndex(String indexName, Integer dimension, String environment,
                                       String podType, String metric, String sourceCollection) {
         return createPodsIndex(indexName, dimension, environment, podType, metric, null, null, null, null,
-                sourceCollection);
+                sourceCollection, DeletionProtection.DISABLED);
     }
 
     /**
@@ -233,7 +267,8 @@ public IndexModel createPodsIndex(String indexName, Integer dimension, String en
      */
     public IndexModel createPodsIndex(String indexName, Integer dimension, String environment,
                                       String podType, Integer pods) {
-        return createPodsIndex(indexName, dimension, environment, podType, null, null, null, pods, null, null);
+        return createPodsIndex(indexName, dimension, environment, podType, null, null, null, pods,
+                null, null, DeletionProtection.DISABLED);
     }
 
     /**
@@ -241,11 +276,11 @@ public IndexModel createPodsIndex(String indexName, Integer dimension, String en
      * 

* Example: *

{@code 
-     *     import org.openapitools.client.model.CreateIndexRequestSpecPodMetadataConfig;
+     *     import org.openapitools.control.client.model.PodSpecMetadataConfig;
      *     ...
      *
-     *     CreateIndexRequestSpecPodMetadataConfig metadataConfig =
-     *         new CreateIndexRequestSpecPodMetadataConfig()
+     *     PodSpecMetadataConfig metadataConfig =
+     *         new PodSpecMetadataConfig()
      *         .fields(Arrays.asList("genre", "year"));
      *     client.createPodsIndex("YOUR-INDEX", 1536, "us-east4-gcp", "p1.x2", "cosine", 6);
      * }
@@ -260,9 +295,9 @@ public IndexModel createPodsIndex(String indexName, Integer dimension, String en */ public IndexModel createPodsIndex(String indexName, Integer dimension, String environment, String podType, Integer pods, - CreateIndexRequestSpecPodMetadataConfig metadataConfig) { + PodSpecMetadataConfig metadataConfig) { return createPodsIndex(indexName, dimension, environment, podType, null, null, null, pods, metadataConfig, - null); + null, DeletionProtection.DISABLED); } /** @@ -285,7 +320,8 @@ public IndexModel createPodsIndex(String indexName, Integer dimension, String en public IndexModel createPodsIndex(String indexName, Integer dimension, String environment, String podType, Integer replicas, Integer shards) { - return createPodsIndex(indexName, dimension, environment, podType, null, replicas, shards, null, null, null); + return createPodsIndex(indexName, dimension, environment, podType, null, replicas, shards, null, + null, null, DeletionProtection.DISABLED); } /** @@ -293,11 +329,11 @@ public IndexModel createPodsIndex(String indexName, Integer dimension, String en *

* Example: *

{@code 
-     *     import org.openapitools.client.model.CreateIndexRequestSpecPodMetadataConfig;
+     *     import org.openapitools.control.client.model.PodSpecMetadataConfig;
      *     ...
      *
-     *     CreateIndexRequestSpecPodMetadataConfig metadataConfig =
-     *         new CreateIndexRequestSpecPodMetadataConfig()
+     *     PodSpecMetadataConfig metadataConfig =
+     *         new PodSpecMetadataConfig()
      *         .fields(Arrays.asList("genre", "year"));
      *     client.createPodsIndex("YOUR-INDEX", 1536, "us-east4-gcp", "p1.x2", "cosine", 2, 2, metadataConfig);
      * }
@@ -313,10 +349,11 @@ public IndexModel createPodsIndex(String indexName, Integer dimension, String en */ public IndexModel createPodsIndex(String indexName, Integer dimension, String environment, String podType, Integer replicas, - Integer shards, CreateIndexRequestSpecPodMetadataConfig metadataConfig) { - return createPodsIndex(indexName, dimension, environment, podType, null, replicas, shards, null, - metadataConfig, - null); + Integer shards, PodSpecMetadataConfig metadataConfig) { + return createPodsIndex(indexName, dimension, environment, + podType, null, replicas, + shards, null, metadataConfig, + null, DeletionProtection.DISABLED); } /** @@ -324,13 +361,13 @@ public IndexModel createPodsIndex(String indexName, Integer dimension, String en *

* Example: *

{@code 
-     *     import org.openapitools.client.model.CreateIndexRequestSpecPodMetadataConfig;
+     *     import org.openapitools.control.client.model.PodSpecMetadataConfig;
      *     ...
      *
-     *     CreateIndexRequestSpecPodMetadataConfig metadataConfig =
-     *         new CreateIndexRequestSpecPodMetadataConfig()
+     *     PodSpecMetadataConfig metadataConfig =
+     *         new PodSpecMetadataConfig()
      *         .fields(Arrays.asList("genre", "year"));
-     *     client.createPodsIndex("YOUR-INDEX", 1536, "us-east4-gcp", "p1.x2", "cosine", 2, 2, 4, null, null);
+     *     client.createPodsIndex("YOUR-INDEX", 1536, "us-east4-gcp", "p1.x2", "cosine", 2, 2, 4, null, null, DeletionProtection.DISABLED);
      * }
* * @param indexName The name of the index to be created. @@ -344,28 +381,31 @@ public IndexModel createPodsIndex(String indexName, Integer dimension, String en * @param metadataConfig The configuration for the behavior of Pinecone's internal metadata index. By default, all metadata is indexed; * when metadataConfig is present, only specified metadata fields are indexed. * @param sourceCollection The name of the collection to be used as the source for the index. Collections are snapshots of an index at a point in time. + * @param deletionProtection Enable or disable deletion protection for the index. * @return {@link IndexModel} representing the created serverless index. * @throws PineconeException if the API encounters an error during index creation or if any of the arguments are invalid. */ public IndexModel createPodsIndex(String indexName, Integer dimension, String environment, String podType, String metric, Integer replicas, Integer shards, Integer pods, - CreateIndexRequestSpecPodMetadataConfig metadataConfig, String sourceCollection) throws PineconeException { + PodSpecMetadataConfig metadataConfig, String sourceCollection, + DeletionProtection deletionProtection) throws PineconeException { validatePodIndexParams(indexName, dimension, environment, podType, metric, replicas, shards, pods); - CreateIndexRequestSpecPod podSpec = new CreateIndexRequestSpecPod().environment(environment) + PodSpec podSpec = new PodSpec().environment(environment) .podType(podType) .replicas(replicas) .shards(shards) .pods(pods) .metadataConfig(metadataConfig) .sourceCollection(sourceCollection); - CreateIndexRequestSpec createIndexRequestSpec = new CreateIndexRequestSpec().pod(podSpec); + IndexSpec createIndexRequestSpec = new IndexSpec().pod(podSpec); CreateIndexRequest createIndexRequest = new CreateIndexRequest() .name(indexName) .dimension(dimension) - .metric(metric != null ? IndexMetric.fromValue(metric) : IndexMetric.COSINE) - .spec(createIndexRequestSpec); + .metric(metric != null ? CreateIndexRequest.MetricEnum.fromValue(metric) : CreateIndexRequest.MetricEnum.COSINE) + .spec(createIndexRequestSpec) + .deletionProtection(deletionProtection); IndexModel indexModel = null; try { @@ -402,7 +442,7 @@ public static void validatePodIndexParams(String indexName, Integer dimension, S } if (metric != null && metric.isEmpty()) { - throw new PineconeValidationException("Metric cannot be null or empty. Must be one of " + Arrays.toString(IndexMetric.values())); + throw new PineconeValidationException("Metric cannot be null or empty. Must be one of " + Arrays.toString(IndexModel.MetricEnum.values())); } if (replicas != null && replicas < 1) { @@ -427,7 +467,7 @@ public static void validatePodIndexParams(String indexName, Integer dimension, S *

* Example: *

{@code 
-     *     import org.openapitools.client.model.IndexModel;
+     *     import org.openapitools.control.client.model.IndexModel;
      *     ...
      *
      *     IndexModel indexModel = client.describeIndex("YOUR-INDEX");
@@ -452,11 +492,11 @@ public IndexModel describeIndex(String indexName) throws PineconeException {
      * 

* Example: *

{@code 
-     *     import org.openapitools.client.model.IndexModel;
+     *     import org.openapitools.control.client.model.IndexModel;
      *     ...
      *
      *     // Make a configuration change
-     *     IndexModel indexModel = client.configureIndex("YOUR-INDEX", "p1.x2", 4);
+     *     IndexModel indexModel = client.configurePodsIndex("YOUR-INDEX", "p1.x2", 4, DeletionProtection.ENABLED);
      *
      *     // Call describeIndex to see the index status as the change is applied.
      *     indexModel = client.describeIndex("YOUR-INDEX");
@@ -465,18 +505,15 @@ public IndexModel describeIndex(String indexName) throws PineconeException {
      * @param indexName The name of the index to configure.
      * @param podType The new podType for the index. Can be null if not changing the pod type.
      * @param replicas The desired number of replicas for the index, lowest value is 0. Can be null if not changing the number of replicas.
+     * @param deletionProtection Enable or disable deletion protection for the index.
      * @return {@link IndexModel} representing the configured index.
      * @throws PineconeException if an error occurs during the operation, the index does not exist, or if any of the arguments are invalid.
      */
-    public IndexModel configureIndex(String indexName, String podType, Integer replicas) throws PineconeException {
+    public IndexModel configurePodsIndex(String indexName, String podType, Integer replicas, DeletionProtection deletionProtection) throws PineconeException {
         if (indexName == null || indexName.isEmpty()) {
             throw new PineconeValidationException("indexName cannot be null or empty");
         }
 
-        if (podType == null && replicas == null) {
-            throw new PineconeValidationException("Must provide either podType or replicas");
-        }
-
         // If you pass a # replicas, but they're < 1, throw an exception
         if (replicas != null) {
             if (replicas < 1) {
@@ -491,7 +528,7 @@ public IndexModel configureIndex(String indexName, String podType, Integer repli
                                 .replicas(replicas)
                                 .podType(podType)
                         )
-                );
+                ).deletionProtection(deletionProtection);
 
         IndexModel indexModel = null;
         try {
@@ -503,34 +540,35 @@ public IndexModel configureIndex(String indexName, String podType, Integer repli
     }
 
     /**
-     * Overload for configureIndex to only change the number of replicas for an index.
+     * Overload for configurePodsIndex to change the number of replicas and deletion protection for an index.
      * 

* Example: *

{@code 
-     *     import org.openapitools.client.model.IndexModel;
+     *     import org.openapitools.control.client.model.IndexModel;
      *     ...
      *
-     *     IndexModel indexModel = client.configureIndex("YOUR-INDEX", 4);
+     *     IndexModel indexModel = client.configurePodsIndex("YOUR-INDEX", 4, DeletionProtection.ENABLED);
      * }
* * @param indexName The name of the index. * @param replicas The desired number of replicas for the index, lowest value is 0. + * @param deletionProtection Enable or disable deletion protection for the index. * @return {@link IndexModel} of the configured index. * @throws PineconeException if an error occurs during the operation, the index does not exist, or if the number of replicas is invalid. */ - public IndexModel configureIndex(String indexName, Integer replicas) throws PineconeException { - return configureIndex(indexName, null, replicas); + public IndexModel configurePodsIndex(String indexName, Integer replicas, DeletionProtection deletionProtection) throws PineconeException { + return configurePodsIndex(indexName, null, replicas, deletionProtection); } /** - * Overload for configureIndex to only change the podType of an index. + * Overload for configurePodsIndex to only change the podType of an index. *

* Example: *

{@code 
-     *     import org.openapitools.client.model.IndexModel;
+     *     import org.openapitools.control.client.model.IndexModel;
      *     ...
      *
-     *     IndexModel indexModel = client.configureIndex("YOUR-INDEX", "p1.x2");
+     *     IndexModel indexModel = client.configurePodsIndex("YOUR-INDEX", "p1.x2");
      * }
* * @param indexName The name of the index. @@ -538,8 +576,66 @@ public IndexModel configureIndex(String indexName, Integer replicas) throws Pine * @return {@link IndexModel} of the configured index. * @throws PineconeException if an error occurs during the operation, the index does not exist, or if the podType is invalid. */ - public IndexModel configureIndex(String indexName, String podType) throws PineconeException { - return configureIndex(indexName, podType, null); + public IndexModel configurePodsIndex(String indexName, String podType) throws PineconeException { + DeletionProtection deletionProtection = describeIndex(indexName).getDeletionProtection(); + return configurePodsIndex(indexName, podType, null, deletionProtection); + } + + /** + * Overload for configurePodsIndex to only change the deletion protection of an index. + *

+ * Example: + *

{@code
+     *     import org.openapitools.control.client.model.IndexModel;
+     *     ...
+     *
+     *     IndexModel indexModel = client.configurePodsIndex("YOUR-INDEX", DeletionProtection.ENABLED);
+     * }
+ * + * @param indexName The name of the index. + * @param deletionProtection Enable or disable deletion protection for the index. + * @return {@link IndexModel} of the configured index. + * @throws PineconeException if an error occurs during the operation, the index does not exist, or if the podType is invalid. + */ + public IndexModel configurePodsIndex(String indexName, DeletionProtection deletionProtection) throws PineconeException { + return configurePodsIndex(indexName, null, null, deletionProtection); + } + + /** + * Configures an existing serverless index with deletion protection. + *

+ * Example: + *

{@code
+     *     import org.openapitools.control.client.model.IndexModel;
+     *     ...
+     *
+     *     // Make a configuration change
+     *     IndexModel indexModel = client.configureServerlessIndex("YOUR-INDEX", DeletionProtection.ENABLED);
+     *
+     *     // Call describeIndex to see the index status as the change is applied.
+     *     indexModel = client.describeIndex("YOUR-INDEX");
+     * }
+ * + * @param indexName The name of the index to configure. + * @param deletionProtection Enable or disable deletion protection for the index. + * @return {@link IndexModel} representing the configured index. + * @throws PineconeException if an error occurs during the operation, the index does not exist, or if any of the arguments are invalid. + */ + public IndexModel configureServerlessIndex(String indexName, DeletionProtection deletionProtection) throws PineconeException { + if (indexName == null || indexName.isEmpty()) { + throw new PineconeValidationException("indexName cannot be null or empty"); + } + + // Build ConfigureIndexRequest object + ConfigureIndexRequest configureIndexRequest = new ConfigureIndexRequest().deletionProtection(deletionProtection); + + IndexModel indexModel = null; + try { + indexModel = manageIndexesApi.configureIndex(indexName, configureIndexRequest); + } catch (ApiException apiException) { + handleApiException(apiException); + } + return indexModel; } /** @@ -547,7 +643,7 @@ public IndexModel configureIndex(String indexName, String podType) throws Pineco *

* Example: *

{@code 
-     *     import org.openapitools.client.model.IndexList;
+     *     import org.openapitools.control.client.model.IndexList;
      *     ...
      *
      *     IndexList indexes = client.listIndexes();
@@ -580,7 +676,7 @@ public IndexList listIndexes() throws PineconeException {
      * 

* Example: *

{@code 
-     *     import org.openapitools.client.model.IndexModel;
+     *     import org.openapitools.control.client.model.IndexModel;
      *     ...
      *
      *     // Delete an index
@@ -607,7 +703,7 @@ public void deleteIndex(String indexName) throws PineconeException {
      * 

* Example: *

{@code 
-     *     import org.openapitools.client.model.CollectionModel;
+     *     import org.openapitools.control.client.model.CollectionModel;
      *     ...
      *
      *     CollectionModel collection = client.createCollection("my-collection", "my-source-index");
@@ -645,7 +741,7 @@ public CollectionModel createCollection(String collectionName, String sourceInde
      * Example:
      * 
{@code 
      *     import io.pinecone.clients.Pinecone;
-     *     import org.openapitools.client.model.CollectionModel;
+     *     import org.openapitools.control.client.model.CollectionModel;
      *     ...
      *
      *     CollectionModel collection = client.describeCollection("my-collection");
@@ -670,7 +766,7 @@ public CollectionModel describeCollection(String collectionName) throws Pinecone
      * 

* Example: *

{@code 
-     *     import org.openapitools.client.model.CollectionList;
+     *     import org.openapitools.control.client.model.CollectionList;
      *     ...
      *
      *     CollectionList collections = client.listCollections();
@@ -930,6 +1026,7 @@ public Pinecone build() {
             ApiClient apiClient = (customOkHttpClient != null) ? new ApiClient(customOkHttpClient) : new ApiClient(buildOkHttpClient());
             apiClient.setApiKey(config.getApiKey());
             apiClient.setUserAgent(config.getUserAgent());
+            apiClient.addDefaultHeader("X-Pinecone-Api-Version", Configuration.VERSION);
 
             if (Boolean.parseBoolean(System.getenv("PINECONE_DEBUG"))) {
                 apiClient.setDebugging(true);
diff --git a/src/main/java/io/pinecone/exceptions/HttpErrorMapper.java b/src/main/java/io/pinecone/exceptions/HttpErrorMapper.java
index 1aa372af..436bbd4b 100644
--- a/src/main/java/io/pinecone/exceptions/HttpErrorMapper.java
+++ b/src/main/java/io/pinecone/exceptions/HttpErrorMapper.java
@@ -1,6 +1,6 @@
 package io.pinecone.exceptions;
 
-import org.openapitools.client.ApiException;
+import org.openapitools.control.client.ApiException;
 
 public class HttpErrorMapper {
 
diff --git a/src/main/java/org/openapitools/client/model/CreateIndexRequestSpecPod.java b/src/main/java/org/openapitools/client/model/CreateIndexRequestSpecPod.java
deleted file mode 100644
index cb2359de..00000000
--- a/src/main/java/org/openapitools/client/model/CreateIndexRequestSpecPod.java
+++ /dev/null
@@ -1,475 +0,0 @@
-/*
- * Pinecone Control Plane API
- * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors.
- *
- * The version of the OpenAPI document: v1
- * Contact: support@pinecone.io
- *
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
- * https://openapi-generator.tech
- * Do not edit the class manually.
- */
-
-
-package org.openapitools.client.model;
-
-import java.util.Objects;
-import com.google.gson.TypeAdapter;
-import com.google.gson.annotations.JsonAdapter;
-import com.google.gson.annotations.SerializedName;
-import com.google.gson.stream.JsonReader;
-import com.google.gson.stream.JsonWriter;
-import java.io.IOException;
-import java.util.Arrays;
-import org.openapitools.client.model.CreateIndexRequestSpecPodMetadataConfig;
-
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import com.google.gson.JsonArray;
-import com.google.gson.JsonDeserializationContext;
-import com.google.gson.JsonDeserializer;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParseException;
-import com.google.gson.TypeAdapterFactory;
-import com.google.gson.reflect.TypeToken;
-import com.google.gson.TypeAdapter;
-import com.google.gson.stream.JsonReader;
-import com.google.gson.stream.JsonWriter;
-import java.io.IOException;
-
-import java.lang.reflect.Type;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.openapitools.client.JSON;
-
-/**
- * Configuration needed to deploy a pod-based index.
- */
-@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-04-06T02:44:17.986783Z[Etc/UTC]")
-public class CreateIndexRequestSpecPod {
-  public static final String SERIALIZED_NAME_ENVIRONMENT = "environment";
-  @SerializedName(SERIALIZED_NAME_ENVIRONMENT)
-  private String environment;
-
-  public static final String SERIALIZED_NAME_REPLICAS = "replicas";
-  @SerializedName(SERIALIZED_NAME_REPLICAS)
-  private Integer replicas = 1;
-
-  public static final String SERIALIZED_NAME_POD_TYPE = "pod_type";
-  @SerializedName(SERIALIZED_NAME_POD_TYPE)
-  private String podType = "p1.x1";
-
-  public static final String SERIALIZED_NAME_PODS = "pods";
-  @SerializedName(SERIALIZED_NAME_PODS)
-  private Integer pods;
-
-  public static final String SERIALIZED_NAME_SHARDS = "shards";
-  @SerializedName(SERIALIZED_NAME_SHARDS)
-  private Integer shards = 1;
-
-  public static final String SERIALIZED_NAME_METADATA_CONFIG = "metadata_config";
-  @SerializedName(SERIALIZED_NAME_METADATA_CONFIG)
-  private CreateIndexRequestSpecPodMetadataConfig metadataConfig;
-
-  public static final String SERIALIZED_NAME_SOURCE_COLLECTION = "source_collection";
-  @SerializedName(SERIALIZED_NAME_SOURCE_COLLECTION)
-  private String sourceCollection;
-
-  public CreateIndexRequestSpecPod() {
-  }
-
-  public CreateIndexRequestSpecPod environment(String environment) {
-    
-    this.environment = environment;
-    return this;
-  }
-
-   /**
-   * The environment where the index is hosted.
-   * @return environment
-  **/
-  @javax.annotation.Nonnull
-  public String getEnvironment() {
-    return environment;
-  }
-
-
-  public void setEnvironment(String environment) {
-    this.environment = environment;
-  }
-
-
-  public CreateIndexRequestSpecPod replicas(Integer replicas) {
-    
-    this.replicas = replicas;
-    return this;
-  }
-
-   /**
-   * The number of replicas. Replicas duplicate your index. They provide higher availability and throughput. Replicas can be scaled up or down as your needs change.
-   * minimum: 1
-   * @return replicas
-  **/
-  @javax.annotation.Nullable
-  public Integer getReplicas() {
-    return replicas;
-  }
-
-
-  public void setReplicas(Integer replicas) {
-    this.replicas = replicas;
-  }
-
-
-  public CreateIndexRequestSpecPod podType(String podType) {
-    
-    this.podType = podType;
-    return this;
-  }
-
-   /**
-   * The type of pod to use. One of `s1`, `p1`, or `p2` appended with `.` and one of `x1`, `x2`, `x4`, or `x8`.
-   * @return podType
-  **/
-  @javax.annotation.Nonnull
-  public String getPodType() {
-    return podType;
-  }
-
-
-  public void setPodType(String podType) {
-    this.podType = podType;
-  }
-
-
-  public CreateIndexRequestSpecPod pods(Integer pods) {
-    
-    this.pods = pods;
-    return this;
-  }
-
-   /**
-   * The number of pods to be used in the index. This should be equal to `shards` x `replicas`.
-   * minimum: 1
-   * @return pods
-  **/
-  @javax.annotation.Nullable
-  public Integer getPods() {
-    return pods;
-  }
-
-
-  public void setPods(Integer pods) {
-    this.pods = pods;
-  }
-
-
-  public CreateIndexRequestSpecPod shards(Integer shards) {
-    
-    this.shards = shards;
-    return this;
-  }
-
-   /**
-   * The number of shards. Shards split your data across multiple pods so you can fit more data into an index.
-   * minimum: 1
-   * @return shards
-  **/
-  @javax.annotation.Nullable
-  public Integer getShards() {
-    return shards;
-  }
-
-
-  public void setShards(Integer shards) {
-    this.shards = shards;
-  }
-
-
-  public CreateIndexRequestSpecPod metadataConfig(CreateIndexRequestSpecPodMetadataConfig metadataConfig) {
-    
-    this.metadataConfig = metadataConfig;
-    return this;
-  }
-
-   /**
-   * Get metadataConfig
-   * @return metadataConfig
-  **/
-  @javax.annotation.Nullable
-  public CreateIndexRequestSpecPodMetadataConfig getMetadataConfig() {
-    return metadataConfig;
-  }
-
-
-  public void setMetadataConfig(CreateIndexRequestSpecPodMetadataConfig metadataConfig) {
-    this.metadataConfig = metadataConfig;
-  }
-
-
-  public CreateIndexRequestSpecPod sourceCollection(String sourceCollection) {
-    
-    this.sourceCollection = sourceCollection;
-    return this;
-  }
-
-   /**
-   * The name of the collection to be used as the source for the index.
-   * @return sourceCollection
-  **/
-  @javax.annotation.Nullable
-  public String getSourceCollection() {
-    return sourceCollection;
-  }
-
-
-  public void setSourceCollection(String sourceCollection) {
-    this.sourceCollection = sourceCollection;
-  }
-
-  /**
-   * A container for additional, undeclared properties.
-   * This is a holder for any undeclared properties as specified with
-   * the 'additionalProperties' keyword in the OAS document.
-   */
-  private Map additionalProperties;
-
-  /**
-   * Set the additional (undeclared) property with the specified name and value.
-   * If the property does not already exist, create it otherwise replace it.
-   *
-   * @param key name of the property
-   * @param value value of the property
-   * @return the CreateIndexRequestSpecPod instance itself
-   */
-  public CreateIndexRequestSpecPod putAdditionalProperty(String key, Object value) {
-    if (this.additionalProperties == null) {
-        this.additionalProperties = new HashMap();
-    }
-    this.additionalProperties.put(key, value);
-    return this;
-  }
-
-  /**
-   * Return the additional (undeclared) property.
-   *
-   * @return a map of objects
-   */
-  public Map getAdditionalProperties() {
-    return additionalProperties;
-  }
-
-  /**
-   * Return the additional (undeclared) property with the specified name.
-   *
-   * @param key name of the property
-   * @return an object
-   */
-  public Object getAdditionalProperty(String key) {
-    if (this.additionalProperties == null) {
-        return null;
-    }
-    return this.additionalProperties.get(key);
-  }
-
-
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) {
-      return true;
-    }
-    if (o == null || getClass() != o.getClass()) {
-      return false;
-    }
-    CreateIndexRequestSpecPod createIndexRequestSpecPod = (CreateIndexRequestSpecPod) o;
-    return Objects.equals(this.environment, createIndexRequestSpecPod.environment) &&
-        Objects.equals(this.replicas, createIndexRequestSpecPod.replicas) &&
-        Objects.equals(this.podType, createIndexRequestSpecPod.podType) &&
-        Objects.equals(this.pods, createIndexRequestSpecPod.pods) &&
-        Objects.equals(this.shards, createIndexRequestSpecPod.shards) &&
-        Objects.equals(this.metadataConfig, createIndexRequestSpecPod.metadataConfig) &&
-        Objects.equals(this.sourceCollection, createIndexRequestSpecPod.sourceCollection)&&
-        Objects.equals(this.additionalProperties, createIndexRequestSpecPod.additionalProperties);
-  }
-
-  @Override
-  public int hashCode() {
-    return Objects.hash(environment, replicas, podType, pods, shards, metadataConfig, sourceCollection, additionalProperties);
-  }
-
-  @Override
-  public String toString() {
-    StringBuilder sb = new StringBuilder();
-    sb.append("class CreateIndexRequestSpecPod {\n");
-    sb.append("    environment: ").append(toIndentedString(environment)).append("\n");
-    sb.append("    replicas: ").append(toIndentedString(replicas)).append("\n");
-    sb.append("    podType: ").append(toIndentedString(podType)).append("\n");
-    sb.append("    pods: ").append(toIndentedString(pods)).append("\n");
-    sb.append("    shards: ").append(toIndentedString(shards)).append("\n");
-    sb.append("    metadataConfig: ").append(toIndentedString(metadataConfig)).append("\n");
-    sb.append("    sourceCollection: ").append(toIndentedString(sourceCollection)).append("\n");
-    sb.append("    additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n");
-    sb.append("}");
-    return sb.toString();
-  }
-
-  /**
-   * Convert the given object to string with each line indented by 4 spaces
-   * (except the first line).
-   */
-  private String toIndentedString(Object o) {
-    if (o == null) {
-      return "null";
-    }
-    return o.toString().replace("\n", "\n    ");
-  }
-
-
-  public static HashSet openapiFields;
-  public static HashSet openapiRequiredFields;
-
-  static {
-    // a set of all properties/fields (JSON key names)
-    openapiFields = new HashSet();
-    openapiFields.add("environment");
-    openapiFields.add("replicas");
-    openapiFields.add("pod_type");
-    openapiFields.add("pods");
-    openapiFields.add("shards");
-    openapiFields.add("metadata_config");
-    openapiFields.add("source_collection");
-
-    // a set of required properties/fields (JSON key names)
-    openapiRequiredFields = new HashSet();
-    openapiRequiredFields.add("environment");
-    openapiRequiredFields.add("pod_type");
-  }
-
- /**
-  * Validates the JSON Element and throws an exception if issues found
-  *
-  * @param jsonElement JSON Element
-  * @throws IOException if the JSON Element is invalid with respect to CreateIndexRequestSpecPod
-  */
-  public static void validateJsonElement(JsonElement jsonElement) throws IOException {
-      if (jsonElement == null) {
-        if (!CreateIndexRequestSpecPod.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
-          throw new IllegalArgumentException(String.format("The required field(s) %s in CreateIndexRequestSpecPod is not found in the empty JSON string", CreateIndexRequestSpecPod.openapiRequiredFields.toString()));
-        }
-      }
-
-      // check to make sure all required properties/fields are present in the JSON string
-      for (String requiredField : CreateIndexRequestSpecPod.openapiRequiredFields) {
-        if (jsonElement.getAsJsonObject().get(requiredField) == null) {
-          throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString()));
-        }
-      }
-        JsonObject jsonObj = jsonElement.getAsJsonObject();
-      if (!jsonObj.get("environment").isJsonPrimitive()) {
-        throw new IllegalArgumentException(String.format("Expected the field `environment` to be a primitive type in the JSON string but got `%s`", jsonObj.get("environment").toString()));
-      }
-      if (!jsonObj.get("pod_type").isJsonPrimitive()) {
-        throw new IllegalArgumentException(String.format("Expected the field `pod_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("pod_type").toString()));
-      }
-      // validate the optional field `metadata_config`
-      if (jsonObj.get("metadata_config") != null && !jsonObj.get("metadata_config").isJsonNull()) {
-        CreateIndexRequestSpecPodMetadataConfig.validateJsonElement(jsonObj.get("metadata_config"));
-      }
-      if ((jsonObj.get("source_collection") != null && !jsonObj.get("source_collection").isJsonNull()) && !jsonObj.get("source_collection").isJsonPrimitive()) {
-        throw new IllegalArgumentException(String.format("Expected the field `source_collection` to be a primitive type in the JSON string but got `%s`", jsonObj.get("source_collection").toString()));
-      }
-  }
-
-  public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
-    @SuppressWarnings("unchecked")
-    @Override
-    public  TypeAdapter create(Gson gson, TypeToken type) {
-       if (!CreateIndexRequestSpecPod.class.isAssignableFrom(type.getRawType())) {
-         return null; // this class only serializes 'CreateIndexRequestSpecPod' and its subtypes
-       }
-       final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class);
-       final TypeAdapter thisAdapter
-                        = gson.getDelegateAdapter(this, TypeToken.get(CreateIndexRequestSpecPod.class));
-
-       return (TypeAdapter) new TypeAdapter() {
-           @Override
-           public void write(JsonWriter out, CreateIndexRequestSpecPod value) throws IOException {
-             JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
-             obj.remove("additionalProperties");
-             // serialize additional properties
-             if (value.getAdditionalProperties() != null) {
-               for (Map.Entry entry : value.getAdditionalProperties().entrySet()) {
-                 if (entry.getValue() instanceof String)
-                   obj.addProperty(entry.getKey(), (String) entry.getValue());
-                 else if (entry.getValue() instanceof Number)
-                   obj.addProperty(entry.getKey(), (Number) entry.getValue());
-                 else if (entry.getValue() instanceof Boolean)
-                   obj.addProperty(entry.getKey(), (Boolean) entry.getValue());
-                 else if (entry.getValue() instanceof Character)
-                   obj.addProperty(entry.getKey(), (Character) entry.getValue());
-                 else {
-                   obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject());
-                 }
-               }
-             }
-             elementAdapter.write(out, obj);
-           }
-
-           @Override
-           public CreateIndexRequestSpecPod read(JsonReader in) throws IOException {
-             JsonElement jsonElement = elementAdapter.read(in);
-             validateJsonElement(jsonElement);
-             JsonObject jsonObj = jsonElement.getAsJsonObject();
-             // store additional fields in the deserialized instance
-             CreateIndexRequestSpecPod instance = thisAdapter.fromJsonTree(jsonObj);
-             for (Map.Entry entry : jsonObj.entrySet()) {
-               if (!openapiFields.contains(entry.getKey())) {
-                 if (entry.getValue().isJsonPrimitive()) { // primitive type
-                   if (entry.getValue().getAsJsonPrimitive().isString())
-                     instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString());
-                   else if (entry.getValue().getAsJsonPrimitive().isNumber())
-                     instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber());
-                   else if (entry.getValue().getAsJsonPrimitive().isBoolean())
-                     instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean());
-                   else
-                     throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString()));
-                 } else if (entry.getValue().isJsonArray()) {
-                     instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class));
-                 } else { // JSON object
-                     instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class));
-                 }
-               }
-             }
-             return instance;
-           }
-
-       }.nullSafe();
-    }
-  }
-
- /**
-  * Create an instance of CreateIndexRequestSpecPod given an JSON string
-  *
-  * @param jsonString JSON string
-  * @return An instance of CreateIndexRequestSpecPod
-  * @throws IOException if the JSON string is invalid with respect to CreateIndexRequestSpecPod
-  */
-  public static CreateIndexRequestSpecPod fromJson(String jsonString) throws IOException {
-    return JSON.getGson().fromJson(jsonString, CreateIndexRequestSpecPod.class);
-  }
-
- /**
-  * Convert an instance of CreateIndexRequestSpecPod to an JSON string
-  *
-  * @return JSON string
-  */
-  public String toJson() {
-    return JSON.getGson().toJson(this);
-  }
-}
-
diff --git a/src/main/java/org/openapitools/client/ApiCallback.java b/src/main/java/org/openapitools/control/client/ApiCallback.java
similarity index 95%
rename from src/main/java/org/openapitools/client/ApiCallback.java
rename to src/main/java/org/openapitools/control/client/ApiCallback.java
index f1c03048..ecf70351 100644
--- a/src/main/java/org/openapitools/client/ApiCallback.java
+++ b/src/main/java/org/openapitools/control/client/ApiCallback.java
@@ -2,7 +2,7 @@
  * Pinecone Control Plane API
  * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors.
  *
- * The version of the OpenAPI document: v1
+ * The version of the OpenAPI document: 2024-07
  * Contact: support@pinecone.io
  *
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -11,7 +11,7 @@
  */
 
 
-package org.openapitools.client;
+package org.openapitools.control.client;
 
 import java.io.IOException;
 
diff --git a/src/main/java/org/openapitools/client/ApiClient.java b/src/main/java/org/openapitools/control/client/ApiClient.java
similarity index 96%
rename from src/main/java/org/openapitools/client/ApiClient.java
rename to src/main/java/org/openapitools/control/client/ApiClient.java
index d475f668..c40cf23f 100644
--- a/src/main/java/org/openapitools/client/ApiClient.java
+++ b/src/main/java/org/openapitools/control/client/ApiClient.java
@@ -2,7 +2,7 @@
  * Pinecone Control Plane API
  * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors.
  *
- * The version of the OpenAPI document: v1
+ * The version of the OpenAPI document: 2024-07
  * Contact: support@pinecone.io
  *
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -11,7 +11,7 @@
  */
 
 
-package org.openapitools.client;
+package org.openapitools.control.client;
 
 import okhttp3.*;
 import okhttp3.internal.http.HttpMethod;
@@ -50,10 +50,10 @@
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-import org.openapitools.client.auth.Authentication;
-import org.openapitools.client.auth.HttpBasicAuth;
-import org.openapitools.client.auth.HttpBearerAuth;
-import org.openapitools.client.auth.ApiKeyAuth;
+import org.openapitools.control.client.auth.Authentication;
+import org.openapitools.control.client.auth.HttpBasicAuth;
+import org.openapitools.control.client.auth.HttpBearerAuth;
+import org.openapitools.control.client.auth.ApiKeyAuth;
 
 /**
  * 

ApiClient class.

@@ -64,7 +64,7 @@ public class ApiClient { protected List servers = new ArrayList(Arrays.asList( new ServerConfiguration( "https://api.pinecone.io", - "Production API endpoints; unversioned legacy.", + "Production API endpoints", new HashMap() ) )); @@ -140,7 +140,7 @@ private void init() { json = new JSON(); // Set default User-Agent. - setUserAgent("OpenAPI-Generator/v1/java"); + setUserAgent("OpenAPI-Generator/2024-07/java"); authentications = new HashMap(); } @@ -314,7 +314,7 @@ public DateFormat getDateFormat() { *

Setter for the field dateFormat.

* * @param dateFormat a {@link java.text.DateFormat} object - * @return a {@link org.openapitools.client.ApiClient} object + * @return a {@link org.openapitools.control.client.ApiClient} object */ public ApiClient setDateFormat(DateFormat dateFormat) { JSON.setDateFormat(dateFormat); @@ -325,7 +325,7 @@ public ApiClient setDateFormat(DateFormat dateFormat) { *

Set SqlDateFormat.

* * @param dateFormat a {@link java.text.DateFormat} object - * @return a {@link org.openapitools.client.ApiClient} object + * @return a {@link org.openapitools.control.client.ApiClient} object */ public ApiClient setSqlDateFormat(DateFormat dateFormat) { JSON.setSqlDateFormat(dateFormat); @@ -336,7 +336,7 @@ public ApiClient setSqlDateFormat(DateFormat dateFormat) { *

Set OffsetDateTimeFormat.

* * @param dateFormat a {@link java.time.format.DateTimeFormatter} object - * @return a {@link org.openapitools.client.ApiClient} object + * @return a {@link org.openapitools.control.client.ApiClient} object */ public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { JSON.setOffsetDateTimeFormat(dateFormat); @@ -347,7 +347,7 @@ public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { *

Set LocalDateFormat.

* * @param dateFormat a {@link java.time.format.DateTimeFormatter} object - * @return a {@link org.openapitools.client.ApiClient} object + * @return a {@link org.openapitools.control.client.ApiClient} object */ public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { JSON.setLocalDateFormat(dateFormat); @@ -358,7 +358,7 @@ public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { *

Set LenientOnJson.

* * @param lenientOnJson a boolean - * @return a {@link org.openapitools.client.ApiClient} object + * @return a {@link org.openapitools.control.client.ApiClient} object */ public ApiClient setLenientOnJson(boolean lenientOnJson) { JSON.setLenientOnJson(lenientOnJson); @@ -852,7 +852,7 @@ public String escapeString(String str) { * @param response HTTP response * @param returnType The type of the Java object * @return The deserialized Java object - * @throws org.openapitools.client.ApiException If fail to deserialize response body, i.e. cannot read response body + * @throws org.openapitools.control.client.ApiException If fail to deserialize response body, i.e. cannot read response body * or the Content-Type of the response is not supported. */ @SuppressWarnings("unchecked") @@ -913,7 +913,7 @@ public T deserialize(Response response, Type returnType) throws ApiException * @param obj The Java object * @param contentType The request Content-Type * @return The serialized request body - * @throws org.openapitools.client.ApiException If fail to serialize the given object + * @throws org.openapitools.control.client.ApiException If fail to serialize the given object */ public RequestBody serialize(Object obj, String contentType) throws ApiException { if (obj instanceof byte[]) { @@ -943,7 +943,7 @@ public RequestBody serialize(Object obj, String contentType) throws ApiException * Download file from the given response. * * @param response An instance of the Response object - * @throws org.openapitools.client.ApiException If fail to read file content from response and write to disk + * @throws org.openapitools.control.client.ApiException If fail to read file content from response and write to disk * @return Downloaded file */ public File downloadFileFromResponse(Response response) throws ApiException { @@ -1007,7 +1007,7 @@ public File prepareDownloadFile(Response response) throws IOException { * @param Type * @param call An instance of the Call object * @return ApiResponse<T> - * @throws org.openapitools.client.ApiException If fail to execute the call + * @throws org.openapitools.control.client.ApiException If fail to execute the call */ public ApiResponse execute(Call call) throws ApiException { return execute(call, null); @@ -1022,7 +1022,7 @@ public ApiResponse execute(Call call) throws ApiException { * @return ApiResponse object containing response status, headers and * data, which is a Java object deserialized from response body and would be null * when returnType is null. - * @throws org.openapitools.client.ApiException If fail to execute the call + * @throws org.openapitools.control.client.ApiException If fail to execute the call */ public ApiResponse execute(Call call, Type returnType) throws ApiException { try { @@ -1086,7 +1086,7 @@ public void onResponse(Call call, Response response) throws IOException { * @param response Response * @param returnType Return type * @return Type - * @throws org.openapitools.client.ApiException If the response has an unsuccessful status code or + * @throws org.openapitools.control.client.ApiException If the response has an unsuccessful status code or * fail to deserialize the response body */ public T handleResponse(Response response, Type returnType) throws ApiException { @@ -1133,7 +1133,7 @@ public T handleResponse(Response response, Type returnType) throws ApiExcept * @param authNames The authentications to apply * @param callback Callback for upload/download progress * @return The HTTP call - * @throws org.openapitools.client.ApiException If fail to serialize the request body object + * @throws org.openapitools.control.client.ApiException If fail to serialize the request body object */ public Call buildCall(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { Request request = buildRequest(baseUrl, path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback); @@ -1156,7 +1156,7 @@ public Call buildCall(String baseUrl, String path, String method, List que * @param authNames The authentications to apply * @param callback Callback for upload/download progress * @return The HTTP request - * @throws org.openapitools.client.ApiException If fail to serialize the request body object + * @throws org.openapitools.control.client.ApiException If fail to serialize the request body object */ public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { // aggregate queryParams (non-collection) and collectionQueryParams into allQueryParams @@ -1322,7 +1322,7 @@ public void processCookieParams(Map cookieParams, Request.Builde * @param payload HTTP request body * @param method HTTP method * @param uri URI - * @throws org.openapitools.client.ApiException If fails to update the parameters + * @throws org.openapitools.control.client.ApiException If fails to update the parameters */ public void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException { @@ -1533,7 +1533,7 @@ private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityExcepti * * @param requestBody The HTTP request object * @return The string representation of the HTTP request body - * @throws org.openapitools.client.ApiException If fail to serialize the request body object into a string + * @throws org.openapitools.control.client.ApiException If fail to serialize the request body object into a string */ private String requestBodyToString(RequestBody requestBody) throws ApiException { if (requestBody != null) { diff --git a/src/main/java/org/openapitools/client/ApiException.java b/src/main/java/org/openapitools/control/client/ApiException.java similarity index 96% rename from src/main/java/org/openapitools/client/ApiException.java rename to src/main/java/org/openapitools/control/client/ApiException.java index 2e7e56b2..d5d59025 100644 --- a/src/main/java/org/openapitools/client/ApiException.java +++ b/src/main/java/org/openapitools/control/client/ApiException.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: v1 + * The version of the OpenAPI document: 2024-07 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -11,7 +11,7 @@ */ -package org.openapitools.client; +package org.openapitools.control.client; import java.util.Map; import java.util.List; @@ -21,7 +21,7 @@ *

ApiException class.

*/ @SuppressWarnings("serial") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-04-06T02:44:17.986783Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-16T15:28:37.412995Z[Etc/UTC]") public class ApiException extends Exception { private int code = 0; private Map> responseHeaders = null; diff --git a/src/main/java/org/openapitools/client/ApiResponse.java b/src/main/java/org/openapitools/control/client/ApiResponse.java similarity index 95% rename from src/main/java/org/openapitools/client/ApiResponse.java rename to src/main/java/org/openapitools/control/client/ApiResponse.java index a501fbdf..107f6d92 100644 --- a/src/main/java/org/openapitools/client/ApiResponse.java +++ b/src/main/java/org/openapitools/control/client/ApiResponse.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: v1 + * The version of the OpenAPI document: 2024-07 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -11,7 +11,7 @@ */ -package org.openapitools.client; +package org.openapitools.control.client; import java.util.List; import java.util.Map; diff --git a/src/main/java/org/openapitools/client/Configuration.java b/src/main/java/org/openapitools/control/client/Configuration.java similarity index 84% rename from src/main/java/org/openapitools/client/Configuration.java rename to src/main/java/org/openapitools/control/client/Configuration.java index a5195dd7..fa487481 100644 --- a/src/main/java/org/openapitools/client/Configuration.java +++ b/src/main/java/org/openapitools/control/client/Configuration.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: v1 + * The version of the OpenAPI document: 2024-07 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -11,11 +11,11 @@ */ -package org.openapitools.client; +package org.openapitools.control.client; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-04-06T02:44:17.986783Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-16T15:28:37.412995Z[Etc/UTC]") public class Configuration { - public static final String VERSION = "v1"; + public static final String VERSION = "2024-07"; private static ApiClient defaultApiClient = new ApiClient(); diff --git a/src/main/java/org/openapitools/client/GzipRequestInterceptor.java b/src/main/java/org/openapitools/control/client/GzipRequestInterceptor.java similarity index 96% rename from src/main/java/org/openapitools/client/GzipRequestInterceptor.java rename to src/main/java/org/openapitools/control/client/GzipRequestInterceptor.java index c1ce2763..7082a637 100644 --- a/src/main/java/org/openapitools/client/GzipRequestInterceptor.java +++ b/src/main/java/org/openapitools/control/client/GzipRequestInterceptor.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: v1 + * The version of the OpenAPI document: 2024-07 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -11,7 +11,7 @@ */ -package org.openapitools.client; +package org.openapitools.control.client; import okhttp3.*; import okio.Buffer; diff --git a/src/main/java/org/openapitools/client/JSON.java b/src/main/java/org/openapitools/control/client/JSON.java similarity index 87% rename from src/main/java/org/openapitools/client/JSON.java rename to src/main/java/org/openapitools/control/client/JSON.java index cce9331a..63391d2a 100644 --- a/src/main/java/org/openapitools/client/JSON.java +++ b/src/main/java/org/openapitools/control/client/JSON.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: v1 + * The version of the OpenAPI document: 2024-07 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -11,7 +11,7 @@ */ -package org.openapitools.client; +package org.openapitools.control.client; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -93,25 +93,29 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter); gsonBuilder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); gsonBuilder.registerTypeAdapter(byte[].class, byteArrayAdapter); - gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CollectionList.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CollectionModel.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ConfigureIndexRequest.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ConfigureIndexRequestSpec.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ConfigureIndexRequestSpecPod.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateCollectionRequest.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateIndexRequest.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateIndexRequestSpec.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateIndexRequestSpecPod.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CreateIndexRequestSpecPodMetadataConfig.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ErrorResponse.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ErrorResponseError.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.IndexList.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.IndexModel.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.IndexModelSpec.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.IndexModelStatus.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PodSpec.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.PodSpecMetadataConfig.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ServerlessSpec.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.control.client.model.CollectionList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.control.client.model.CollectionModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.control.client.model.ConfigureIndexRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.control.client.model.ConfigureIndexRequestSpec.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.control.client.model.ConfigureIndexRequestSpecPod.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.control.client.model.CreateCollectionRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.control.client.model.CreateIndexRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.control.client.model.EmbedRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.control.client.model.EmbedRequestInputsInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.control.client.model.EmbedRequestParameters.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.control.client.model.Embedding.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.control.client.model.EmbeddingsList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.control.client.model.EmbeddingsListUsage.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.control.client.model.ErrorResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.control.client.model.ErrorResponseError.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.control.client.model.IndexList.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.control.client.model.IndexModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.control.client.model.IndexModelSpec.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.control.client.model.IndexModelStatus.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.control.client.model.IndexSpec.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.control.client.model.PodSpec.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.control.client.model.PodSpecMetadataConfig.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.control.client.model.ServerlessSpec.CustomTypeAdapterFactory()); gson = gsonBuilder.create(); } diff --git a/src/main/java/org/openapitools/client/Pair.java b/src/main/java/org/openapitools/control/client/Pair.java similarity index 88% rename from src/main/java/org/openapitools/client/Pair.java rename to src/main/java/org/openapitools/control/client/Pair.java index ebdf91ac..74a4e948 100644 --- a/src/main/java/org/openapitools/client/Pair.java +++ b/src/main/java/org/openapitools/control/client/Pair.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: v1 + * The version of the OpenAPI document: 2024-07 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -11,9 +11,9 @@ */ -package org.openapitools.client; +package org.openapitools.control.client; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-04-06T02:44:17.986783Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-16T15:28:37.412995Z[Etc/UTC]") public class Pair { private String name = ""; private String value = ""; diff --git a/src/main/java/org/openapitools/client/ProgressRequestBody.java b/src/main/java/org/openapitools/control/client/ProgressRequestBody.java similarity index 95% rename from src/main/java/org/openapitools/client/ProgressRequestBody.java rename to src/main/java/org/openapitools/control/client/ProgressRequestBody.java index 6e1660e0..68d6c739 100644 --- a/src/main/java/org/openapitools/client/ProgressRequestBody.java +++ b/src/main/java/org/openapitools/control/client/ProgressRequestBody.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: v1 + * The version of the OpenAPI document: 2024-07 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -11,7 +11,7 @@ */ -package org.openapitools.client; +package org.openapitools.control.client; import okhttp3.MediaType; import okhttp3.RequestBody; diff --git a/src/main/java/org/openapitools/client/ProgressResponseBody.java b/src/main/java/org/openapitools/control/client/ProgressResponseBody.java similarity index 95% rename from src/main/java/org/openapitools/client/ProgressResponseBody.java rename to src/main/java/org/openapitools/control/client/ProgressResponseBody.java index 5d64f2fc..2b9e8c9c 100644 --- a/src/main/java/org/openapitools/client/ProgressResponseBody.java +++ b/src/main/java/org/openapitools/control/client/ProgressResponseBody.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: v1 + * The version of the OpenAPI document: 2024-07 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -11,7 +11,7 @@ */ -package org.openapitools.client; +package org.openapitools.control.client; import okhttp3.MediaType; import okhttp3.ResponseBody; diff --git a/src/main/java/org/openapitools/client/ServerConfiguration.java b/src/main/java/org/openapitools/control/client/ServerConfiguration.java similarity index 97% rename from src/main/java/org/openapitools/client/ServerConfiguration.java rename to src/main/java/org/openapitools/control/client/ServerConfiguration.java index 59edc528..1f1e8496 100644 --- a/src/main/java/org/openapitools/client/ServerConfiguration.java +++ b/src/main/java/org/openapitools/control/client/ServerConfiguration.java @@ -1,4 +1,4 @@ -package org.openapitools.client; +package org.openapitools.control.client; import java.util.Map; diff --git a/src/main/java/org/openapitools/client/ServerVariable.java b/src/main/java/org/openapitools/control/client/ServerVariable.java similarity index 94% rename from src/main/java/org/openapitools/client/ServerVariable.java rename to src/main/java/org/openapitools/control/client/ServerVariable.java index c2f13e21..60411ba8 100644 --- a/src/main/java/org/openapitools/client/ServerVariable.java +++ b/src/main/java/org/openapitools/control/client/ServerVariable.java @@ -1,4 +1,4 @@ -package org.openapitools.client; +package org.openapitools.control.client; import java.util.HashSet; diff --git a/src/main/java/org/openapitools/client/StringUtil.java b/src/main/java/org/openapitools/control/client/StringUtil.java similarity index 93% rename from src/main/java/org/openapitools/client/StringUtil.java rename to src/main/java/org/openapitools/control/client/StringUtil.java index ee790ca2..dc56e8ec 100644 --- a/src/main/java/org/openapitools/client/StringUtil.java +++ b/src/main/java/org/openapitools/control/client/StringUtil.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: v1 + * The version of the OpenAPI document: 2024-07 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -11,12 +11,12 @@ */ -package org.openapitools.client; +package org.openapitools.control.client; import java.util.Collection; import java.util.Iterator; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-04-06T02:44:17.986783Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-16T15:28:37.412995Z[Etc/UTC]") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/src/main/java/org/openapitools/control/client/api/InferenceApi.java b/src/main/java/org/openapitools/control/client/api/InferenceApi.java new file mode 100644 index 00000000..c9726176 --- /dev/null +++ b/src/main/java/org/openapitools/control/client/api/InferenceApi.java @@ -0,0 +1,207 @@ +/* + * Pinecone Control Plane API + * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. + * + * The version of the OpenAPI document: 2024-07 + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.control.client.api; + +import org.openapitools.control.client.ApiCallback; +import org.openapitools.control.client.ApiClient; +import org.openapitools.control.client.ApiException; +import org.openapitools.control.client.ApiResponse; +import org.openapitools.control.client.Configuration; +import org.openapitools.control.client.Pair; +import org.openapitools.control.client.ProgressRequestBody; +import org.openapitools.control.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import org.openapitools.control.client.model.EmbedRequest; +import org.openapitools.control.client.model.EmbeddingsList; +import org.openapitools.control.client.model.ErrorResponse; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class InferenceApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public InferenceApi() { + this(Configuration.getDefaultApiClient()); + } + + public InferenceApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for embed + * @param embedRequest Generate embeddings for inputs (optional) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request. The request body included invalid request parameters. -
401 Unauthorized. Possible causes: Invalid API key. -
500 Internal server error. -
+ */ + public okhttp3.Call embedCall(EmbedRequest embedRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = embedRequest; + + // create path and map variables + String localVarPath = "/embed"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKeyAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call embedValidateBeforeCall(EmbedRequest embedRequest, final ApiCallback _callback) throws ApiException { + return embedCall(embedRequest, _callback); + + } + + /** + * Embed data + * Generate embeddings for input data + * @param embedRequest Generate embeddings for inputs (optional) + * @return EmbeddingsList + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request. The request body included invalid request parameters. -
401 Unauthorized. Possible causes: Invalid API key. -
500 Internal server error. -
+ */ + public EmbeddingsList embed(EmbedRequest embedRequest) throws ApiException { + ApiResponse localVarResp = embedWithHttpInfo(embedRequest); + return localVarResp.getData(); + } + + /** + * Embed data + * Generate embeddings for input data + * @param embedRequest Generate embeddings for inputs (optional) + * @return ApiResponse<EmbeddingsList> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request. The request body included invalid request parameters. -
401 Unauthorized. Possible causes: Invalid API key. -
500 Internal server error. -
+ */ + public ApiResponse embedWithHttpInfo(EmbedRequest embedRequest) throws ApiException { + okhttp3.Call localVarCall = embedValidateBeforeCall(embedRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Embed data (asynchronously) + * Generate embeddings for input data + * @param embedRequest Generate embeddings for inputs (optional) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request. The request body included invalid request parameters. -
401 Unauthorized. Possible causes: Invalid API key. -
500 Internal server error. -
+ */ + public okhttp3.Call embedAsync(EmbedRequest embedRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = embedValidateBeforeCall(embedRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/src/main/java/org/openapitools/client/api/ManageIndexesApi.java b/src/main/java/org/openapitools/control/client/api/ManageIndexesApi.java similarity index 92% rename from src/main/java/org/openapitools/client/api/ManageIndexesApi.java rename to src/main/java/org/openapitools/control/client/api/ManageIndexesApi.java index a263eab8..f6aaccbb 100644 --- a/src/main/java/org/openapitools/client/api/ManageIndexesApi.java +++ b/src/main/java/org/openapitools/control/client/api/ManageIndexesApi.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: v1 + * The version of the OpenAPI document: 2024-07 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -11,30 +11,30 @@ */ -package org.openapitools.client.api; +package org.openapitools.control.client.api; -import org.openapitools.client.ApiCallback; -import org.openapitools.client.ApiClient; -import org.openapitools.client.ApiException; -import org.openapitools.client.ApiResponse; -import org.openapitools.client.Configuration; -import org.openapitools.client.Pair; -import org.openapitools.client.ProgressRequestBody; -import org.openapitools.client.ProgressResponseBody; +import org.openapitools.control.client.ApiCallback; +import org.openapitools.control.client.ApiClient; +import org.openapitools.control.client.ApiException; +import org.openapitools.control.client.ApiResponse; +import org.openapitools.control.client.Configuration; +import org.openapitools.control.client.Pair; +import org.openapitools.control.client.ProgressRequestBody; +import org.openapitools.control.client.ProgressResponseBody; import com.google.gson.reflect.TypeToken; import java.io.IOException; -import org.openapitools.client.model.CollectionList; -import org.openapitools.client.model.CollectionModel; -import org.openapitools.client.model.ConfigureIndexRequest; -import org.openapitools.client.model.CreateCollectionRequest; -import org.openapitools.client.model.CreateIndexRequest; -import org.openapitools.client.model.ErrorResponse; -import org.openapitools.client.model.IndexList; -import org.openapitools.client.model.IndexModel; +import org.openapitools.control.client.model.CollectionList; +import org.openapitools.control.client.model.CollectionModel; +import org.openapitools.control.client.model.ConfigureIndexRequest; +import org.openapitools.control.client.model.CreateCollectionRequest; +import org.openapitools.control.client.model.CreateIndexRequest; +import org.openapitools.control.client.model.ErrorResponse; +import org.openapitools.control.client.model.IndexList; +import org.openapitools.control.client.model.IndexModel; import java.lang.reflect.Type; import java.util.ArrayList; @@ -82,7 +82,7 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for configureIndex * @param indexName The name of the index to configure. (required) - * @param configureIndexRequest The desired pod type and replica configuration for the index. (required) + * @param configureIndexRequest The desired pod size and replica configuration for the index. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -101,7 +101,7 @@ public void setCustomBaseUrl(String customBaseUrl) { public okhttp3.Call configureIndexCall(String indexName, ConfigureIndexRequest configureIndexRequest, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { "https://api.pinecone.io" }; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use if (localCustomBaseUrl != null){ @@ -162,9 +162,9 @@ private okhttp3.Call configureIndexValidateBeforeCall(String indexName, Configur /** * Configure an index - * This operation specifies the pod type and number of replicas for an index. It applies to pod-based indexes only. Serverless indexes scale automatically based on usage. + * This operation configures the pod size and number of replicas for a pod-based index. It is not possible to change the pod type of an index. However, you can create a collection from an index and then [create a new index with a different pod type](http://docs.pinecone.io/guides/indexes/create-an-index#create-an-index-from-a-collection) from the collection. * @param indexName The name of the index to configure. (required) - * @param configureIndexRequest The desired pod type and replica configuration for the index. (required) + * @param configureIndexRequest The desired pod size and replica configuration for the index. (required) * @return IndexModel * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -186,9 +186,9 @@ public IndexModel configureIndex(String indexName, ConfigureIndexRequest configu /** * Configure an index - * This operation specifies the pod type and number of replicas for an index. It applies to pod-based indexes only. Serverless indexes scale automatically based on usage. + * This operation configures the pod size and number of replicas for a pod-based index. It is not possible to change the pod type of an index. However, you can create a collection from an index and then [create a new index with a different pod type](http://docs.pinecone.io/guides/indexes/create-an-index#create-an-index-from-a-collection) from the collection. * @param indexName The name of the index to configure. (required) - * @param configureIndexRequest The desired pod type and replica configuration for the index. (required) + * @param configureIndexRequest The desired pod size and replica configuration for the index. (required) * @return ApiResponse<IndexModel> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -211,9 +211,9 @@ public ApiResponse configureIndexWithHttpInfo(String indexName, Conf /** * Configure an index (asynchronously) - * This operation specifies the pod type and number of replicas for an index. It applies to pod-based indexes only. Serverless indexes scale automatically based on usage. + * This operation configures the pod size and number of replicas for a pod-based index. It is not possible to change the pod type of an index. However, you can create a collection from an index and then [create a new index with a different pod type](http://docs.pinecone.io/guides/indexes/create-an-index#create-an-index-from-a-collection) from the collection. * @param indexName The name of the index to configure. (required) - * @param configureIndexRequest The desired pod type and replica configuration for the index. (required) + * @param configureIndexRequest The desired pod size and replica configuration for the index. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object @@ -249,7 +249,7 @@ public okhttp3.Call configureIndexAsync(String indexName, ConfigureIndexRequest 400 Bad request. The request body included invalid request parameters. - 401 Unauthorized. Possible causes: Invalid API key. - 403 You've exceed your collections quota. - - 409 A collection already exists with the name provided. - + 409 Collection of given name already exists. - 422 Unprocessable entity. The request body could not be deserialized. - 500 Internal server error. - @@ -257,7 +257,7 @@ public okhttp3.Call configureIndexAsync(String indexName, ConfigureIndexRequest public okhttp3.Call createCollectionCall(CreateCollectionRequest createCollectionRequest, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { "https://api.pinecone.io" }; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use if (localCustomBaseUrl != null){ @@ -312,7 +312,7 @@ private okhttp3.Call createCollectionValidateBeforeCall(CreateCollectionRequest /** * Create a collection - * This operation creates a Pinecone collection. Serverless and starter indexes do not support collections. + * This operation creates a Pinecone collection. Serverless indexes do not support collections. * @param createCollectionRequest The desired configuration for the collection. (required) * @return CollectionModel * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body @@ -323,7 +323,7 @@ private okhttp3.Call createCollectionValidateBeforeCall(CreateCollectionRequest 400 Bad request. The request body included invalid request parameters. - 401 Unauthorized. Possible causes: Invalid API key. - 403 You've exceed your collections quota. - - 409 A collection already exists with the name provided. - + 409 Collection of given name already exists. - 422 Unprocessable entity. The request body could not be deserialized. - 500 Internal server error. - @@ -335,7 +335,7 @@ public CollectionModel createCollection(CreateCollectionRequest createCollection /** * Create a collection - * This operation creates a Pinecone collection. Serverless and starter indexes do not support collections. + * This operation creates a Pinecone collection. Serverless indexes do not support collections. * @param createCollectionRequest The desired configuration for the collection. (required) * @return ApiResponse<CollectionModel> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body @@ -346,7 +346,7 @@ public CollectionModel createCollection(CreateCollectionRequest createCollection 400 Bad request. The request body included invalid request parameters. - 401 Unauthorized. Possible causes: Invalid API key. - 403 You've exceed your collections quota. - - 409 A collection already exists with the name provided. - + 409 Collection of given name already exists. - 422 Unprocessable entity. The request body could not be deserialized. - 500 Internal server error. - @@ -359,7 +359,7 @@ public ApiResponse createCollectionWithHttpInfo(CreateCollectio /** * Create a collection (asynchronously) - * This operation creates a Pinecone collection. Serverless and starter indexes do not support collections. + * This operation creates a Pinecone collection. Serverless indexes do not support collections. * @param createCollectionRequest The desired configuration for the collection. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call @@ -371,7 +371,7 @@ public ApiResponse createCollectionWithHttpInfo(CreateCollectio 400 Bad request. The request body included invalid request parameters. - 401 Unauthorized. Possible causes: Invalid API key. - 403 You've exceed your collections quota. - - 409 A collection already exists with the name provided. - + 409 Collection of given name already exists. - 422 Unprocessable entity. The request body could not be deserialized. - 500 Internal server error. - @@ -405,7 +405,7 @@ public okhttp3.Call createCollectionAsync(CreateCollectionRequest createCollecti public okhttp3.Call createIndexCall(CreateIndexRequest createIndexRequest, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { "https://api.pinecone.io" }; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use if (localCustomBaseUrl != null){ @@ -460,7 +460,7 @@ private okhttp3.Call createIndexValidateBeforeCall(CreateIndexRequest createInde /** * Create an index - * This operation deploys a Pinecone index. This is where you specify the measure of similarity, the dimension of vectors to be stored in the index, which cloud provider you would like to deploy with, and more. For guidance and examples, see [Create an index](https://docs.pinecone.io/guides/indexes/create-an-index#create-a-serverless-index). + * This operation deploys a Pinecone index. This is where you specify the measure of similarity, the dimension of vectors to be stored in the index, which cloud provider you would like to deploy with, and more. For guidance and examples, see [Create an index](https://docs.pinecone.io/guides/indexes/create-an-index#create-a-serverless-index). * @param createIndexRequest The desired configuration for the index. (required) * @return IndexModel * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body @@ -484,7 +484,7 @@ public IndexModel createIndex(CreateIndexRequest createIndexRequest) throws ApiE /** * Create an index - * This operation deploys a Pinecone index. This is where you specify the measure of similarity, the dimension of vectors to be stored in the index, which cloud provider you would like to deploy with, and more. For guidance and examples, see [Create an index](https://docs.pinecone.io/guides/indexes/create-an-index#create-a-serverless-index). + * This operation deploys a Pinecone index. This is where you specify the measure of similarity, the dimension of vectors to be stored in the index, which cloud provider you would like to deploy with, and more. For guidance and examples, see [Create an index](https://docs.pinecone.io/guides/indexes/create-an-index#create-a-serverless-index). * @param createIndexRequest The desired configuration for the index. (required) * @return ApiResponse<IndexModel> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body @@ -509,7 +509,7 @@ public ApiResponse createIndexWithHttpInfo(CreateIndexRequest create /** * Create an index (asynchronously) - * This operation deploys a Pinecone index. This is where you specify the measure of similarity, the dimension of vectors to be stored in the index, which cloud provider you would like to deploy with, and more. For guidance and examples, see [Create an index](https://docs.pinecone.io/guides/indexes/create-an-index#create-a-serverless-index). + * This operation deploys a Pinecone index. This is where you specify the measure of similarity, the dimension of vectors to be stored in the index, which cloud provider you would like to deploy with, and more. For guidance and examples, see [Create an index](https://docs.pinecone.io/guides/indexes/create-an-index#create-a-serverless-index). * @param createIndexRequest The desired configuration for the index. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call @@ -543,7 +543,7 @@ public okhttp3.Call createIndexAsync(CreateIndexRequest createIndexRequest, fina * @http.response.details - + @@ -552,7 +552,7 @@ public okhttp3.Call createIndexAsync(CreateIndexRequest createIndexRequest, fina public okhttp3.Call deleteCollectionCall(String collectionName, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { "https://api.pinecone.io" }; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use if (localCustomBaseUrl != null){ @@ -576,7 +576,6 @@ public okhttp3.Call deleteCollectionCall(String collectionName, final ApiCallbac Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - "text/plain", "application/json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); @@ -608,48 +607,45 @@ private okhttp3.Call deleteCollectionValidateBeforeCall(String collectionName, f /** * Delete a collection - * This operation deletes an existing collection. Serverless and starter indexes do not support collections. + * This operation deletes an existing collection. Serverless indexes do not support collections. * @param collectionName The name of the collection. (required) - * @return String * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details
Status Code Description Response Headers
202 The index has been successfully deleted. -
202 The collection has been successfully deleted. -
401 Unauthorized. Possible causes: Invalid API key. -
404 Collection not found. -
500 Internal server error. -
- +
Status Code Description Response Headers
202 The index has been successfully deleted. -
202 The collection has been successfully deleted. -
401 Unauthorized. Possible causes: Invalid API key. -
404 Collection not found. -
500 Internal server error. -
*/ - public String deleteCollection(String collectionName) throws ApiException { - ApiResponse localVarResp = deleteCollectionWithHttpInfo(collectionName); - return localVarResp.getData(); + public void deleteCollection(String collectionName) throws ApiException { + deleteCollectionWithHttpInfo(collectionName); } /** * Delete a collection - * This operation deletes an existing collection. Serverless and starter indexes do not support collections. + * This operation deletes an existing collection. Serverless indexes do not support collections. * @param collectionName The name of the collection. (required) - * @return ApiResponse<String> + * @return ApiResponse<Void> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - +
Status Code Description Response Headers
202 The index has been successfully deleted. -
202 The collection has been successfully deleted. -
401 Unauthorized. Possible causes: Invalid API key. -
404 Collection not found. -
500 Internal server error. -
*/ - public ApiResponse deleteCollectionWithHttpInfo(String collectionName) throws ApiException { + public ApiResponse deleteCollectionWithHttpInfo(String collectionName) throws ApiException { okhttp3.Call localVarCall = deleteCollectionValidateBeforeCall(collectionName, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); + return localVarApiClient.execute(localVarCall); } /** * Delete a collection (asynchronously) - * This operation deletes an existing collection. Serverless and starter indexes do not support collections. + * This operation deletes an existing collection. Serverless indexes do not support collections. * @param collectionName The name of the collection. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call @@ -657,17 +653,16 @@ public ApiResponse deleteCollectionWithHttpInfo(String collectionName) t * @http.response.details - +
Status Code Description Response Headers
202 The index has been successfully deleted. -
202 The collection has been successfully deleted. -
401 Unauthorized. Possible causes: Invalid API key. -
404 Collection not found. -
500 Internal server error. -
*/ - public okhttp3.Call deleteCollectionAsync(String collectionName, final ApiCallback _callback) throws ApiException { + public okhttp3.Call deleteCollectionAsync(String collectionName, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = deleteCollectionValidateBeforeCall(collectionName, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); return localVarCall; } /** @@ -689,7 +684,7 @@ public okhttp3.Call deleteCollectionAsync(String collectionName, final ApiCallba public okhttp3.Call deleteIndexCall(String indexName, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { "https://api.pinecone.io" }; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use if (localCustomBaseUrl != null){ @@ -823,7 +818,7 @@ public okhttp3.Call deleteIndexAsync(String indexName, final ApiCallback _ public okhttp3.Call describeCollectionCall(String collectionName, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { "https://api.pinecone.io" }; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use if (localCustomBaseUrl != null){ @@ -878,7 +873,7 @@ private okhttp3.Call describeCollectionValidateBeforeCall(String collectionName, /** * Describe a collection - * This operation gets a description of a collection. Serverless and starter indexes do not support collections. + * This operation gets a description of a collection. Serverless indexes do not support collections. * @param collectionName The name of the collection to be described. (required) * @return CollectionModel * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body @@ -898,7 +893,7 @@ public CollectionModel describeCollection(String collectionName) throws ApiExcep /** * Describe a collection - * This operation gets a description of a collection. Serverless and starter indexes do not support collections. + * This operation gets a description of a collection. Serverless indexes do not support collections. * @param collectionName The name of the collection to be described. (required) * @return ApiResponse<CollectionModel> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body @@ -919,7 +914,7 @@ public ApiResponse describeCollectionWithHttpInfo(String collec /** * Describe a collection (asynchronously) - * This operation gets a description of a collection. Serverless and starter indexes do not support collections. + * This operation gets a description of a collection. Serverless indexes do not support collections. * @param collectionName The name of the collection to be described. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call @@ -958,7 +953,7 @@ public okhttp3.Call describeCollectionAsync(String collectionName, final ApiCall public okhttp3.Call describeIndexCall(String indexName, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { "https://api.pinecone.io" }; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use if (localCustomBaseUrl != null){ @@ -1091,7 +1086,7 @@ public okhttp3.Call describeIndexAsync(String indexName, final ApiCallback listCollectionsWithHttpInfo() throws ApiExcep /** * List collections (asynchronously) - * This operation returns a list of all collections in a project. Serverless and starter indexes do not support collections. + * This operation returns a list of all collections in a project. Serverless indexes do not support collections. * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object @@ -1212,7 +1207,7 @@ public okhttp3.Call listCollectionsAsync(final ApiCallback _call public okhttp3.Call listIndexesCall(final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] { "https://api.pinecone.io" }; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use if (localCustomBaseUrl != null){ diff --git a/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/src/main/java/org/openapitools/control/client/auth/ApiKeyAuth.java similarity index 87% rename from src/main/java/org/openapitools/client/auth/ApiKeyAuth.java rename to src/main/java/org/openapitools/control/client/auth/ApiKeyAuth.java index 74eca46c..6b0a704e 100644 --- a/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java +++ b/src/main/java/org/openapitools/control/client/auth/ApiKeyAuth.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: v1 + * The version of the OpenAPI document: 2024-07 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -11,16 +11,16 @@ */ -package org.openapitools.client.auth; +package org.openapitools.control.client.auth; -import org.openapitools.client.ApiException; -import org.openapitools.client.Pair; +import org.openapitools.control.client.ApiException; +import org.openapitools.control.client.Pair; import java.net.URI; import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-04-06T02:44:17.986783Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-16T15:28:37.412995Z[Etc/UTC]") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/src/main/java/org/openapitools/client/auth/Authentication.java b/src/main/java/org/openapitools/control/client/auth/Authentication.java similarity index 84% rename from src/main/java/org/openapitools/client/auth/Authentication.java rename to src/main/java/org/openapitools/control/client/auth/Authentication.java index 69528e4d..0aea4023 100644 --- a/src/main/java/org/openapitools/client/auth/Authentication.java +++ b/src/main/java/org/openapitools/control/client/auth/Authentication.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: v1 + * The version of the OpenAPI document: 2024-07 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -11,10 +11,10 @@ */ -package org.openapitools.client.auth; +package org.openapitools.control.client.auth; -import org.openapitools.client.Pair; -import org.openapitools.client.ApiException; +import org.openapitools.control.client.Pair; +import org.openapitools.control.client.ApiException; import java.net.URI; import java.util.Map; diff --git a/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/src/main/java/org/openapitools/control/client/auth/HttpBasicAuth.java similarity index 87% rename from src/main/java/org/openapitools/client/auth/HttpBasicAuth.java rename to src/main/java/org/openapitools/control/client/auth/HttpBasicAuth.java index 5b9b900a..d1848193 100644 --- a/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java +++ b/src/main/java/org/openapitools/control/client/auth/HttpBasicAuth.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: v1 + * The version of the OpenAPI document: 2024-07 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -11,10 +11,10 @@ */ -package org.openapitools.client.auth; +package org.openapitools.control.client.auth; -import org.openapitools.client.Pair; -import org.openapitools.client.ApiException; +import org.openapitools.control.client.Pair; +import org.openapitools.control.client.ApiException; import okhttp3.Credentials; diff --git a/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java b/src/main/java/org/openapitools/control/client/auth/HttpBearerAuth.java similarity index 87% rename from src/main/java/org/openapitools/client/auth/HttpBearerAuth.java rename to src/main/java/org/openapitools/control/client/auth/HttpBearerAuth.java index fe37cbb8..b5cdf1a1 100644 --- a/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java +++ b/src/main/java/org/openapitools/control/client/auth/HttpBearerAuth.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: v1 + * The version of the OpenAPI document: 2024-07 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -11,16 +11,16 @@ */ -package org.openapitools.client.auth; +package org.openapitools.control.client.auth; -import org.openapitools.client.ApiException; -import org.openapitools.client.Pair; +import org.openapitools.control.client.ApiException; +import org.openapitools.control.client.Pair; import java.net.URI; import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-04-06T02:44:17.986783Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-16T15:28:37.412995Z[Etc/UTC]") public class HttpBearerAuth implements Authentication { private final String scheme; private String bearerToken; diff --git a/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java b/src/main/java/org/openapitools/control/client/model/AbstractOpenApiSchema.java similarity index 95% rename from src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java rename to src/main/java/org/openapitools/control/client/model/AbstractOpenApiSchema.java index b7419c43..56928d9a 100644 --- a/src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +++ b/src/main/java/org/openapitools/control/client/model/AbstractOpenApiSchema.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: v1 + * The version of the OpenAPI document: 2024-07 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -11,9 +11,9 @@ */ -package org.openapitools.client.model; +package org.openapitools.control.client.model; -import org.openapitools.client.ApiException; +import org.openapitools.control.client.ApiException; import java.util.Objects; import java.lang.reflect.Type; import java.util.Map; @@ -23,7 +23,7 @@ /** * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-04-06T02:44:17.986783Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-16T15:28:37.412995Z[Etc/UTC]") public abstract class AbstractOpenApiSchema { // store the actual instance of the schema/object diff --git a/src/main/java/org/openapitools/client/model/CollectionList.java b/src/main/java/org/openapitools/control/client/model/CollectionList.java similarity index 97% rename from src/main/java/org/openapitools/client/model/CollectionList.java rename to src/main/java/org/openapitools/control/client/model/CollectionList.java index b733a0a3..f2d253ad 100644 --- a/src/main/java/org/openapitools/client/model/CollectionList.java +++ b/src/main/java/org/openapitools/control/client/model/CollectionList.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: v1 + * The version of the OpenAPI document: 2024-07 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -11,7 +11,7 @@ */ -package org.openapitools.client.model; +package org.openapitools.control.client.model; import java.util.Objects; import com.google.gson.TypeAdapter; @@ -23,7 +23,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import org.openapitools.client.model.CollectionModel; +import org.openapitools.control.client.model.CollectionModel; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -47,12 +47,12 @@ import java.util.Map; import java.util.Set; -import org.openapitools.client.JSON; +import org.openapitools.control.client.JSON; /** * The list of collections that exist in the project. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-04-06T02:44:17.986783Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-16T15:28:37.412995Z[Etc/UTC]") public class CollectionList { public static final String SERIALIZED_NAME_COLLECTIONS = "collections"; @SerializedName(SERIALIZED_NAME_COLLECTIONS) diff --git a/src/main/java/org/openapitools/client/model/CollectionModel.java b/src/main/java/org/openapitools/control/client/model/CollectionModel.java similarity index 98% rename from src/main/java/org/openapitools/client/model/CollectionModel.java rename to src/main/java/org/openapitools/control/client/model/CollectionModel.java index f9c34e8a..728dd8e5 100644 --- a/src/main/java/org/openapitools/client/model/CollectionModel.java +++ b/src/main/java/org/openapitools/control/client/model/CollectionModel.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: v1 + * The version of the OpenAPI document: 2024-07 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -11,7 +11,7 @@ */ -package org.openapitools.client.model; +package org.openapitools.control.client.model; import java.util.Objects; import com.google.gson.TypeAdapter; @@ -44,12 +44,12 @@ import java.util.Map; import java.util.Set; -import org.openapitools.client.JSON; +import org.openapitools.control.client.JSON; /** * The CollectionModel describes the configuration and status of a Pinecone collection. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-04-06T02:44:17.986783Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-16T15:28:37.412995Z[Etc/UTC]") public class CollectionModel { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @@ -134,7 +134,7 @@ public CollectionModel name(String name) { } /** - * Get name + * The name of the collection. * @return name **/ @javax.annotation.Nonnull diff --git a/src/main/java/org/openapitools/client/model/ConfigureIndexRequest.java b/src/main/java/org/openapitools/control/client/model/ConfigureIndexRequest.java similarity index 86% rename from src/main/java/org/openapitools/client/model/ConfigureIndexRequest.java rename to src/main/java/org/openapitools/control/client/model/ConfigureIndexRequest.java index 71f159f8..756530e7 100644 --- a/src/main/java/org/openapitools/client/model/ConfigureIndexRequest.java +++ b/src/main/java/org/openapitools/control/client/model/ConfigureIndexRequest.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: v1 + * The version of the OpenAPI document: 2024-07 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -11,7 +11,7 @@ */ -package org.openapitools.client.model; +package org.openapitools.control.client.model; import java.util.Objects; import com.google.gson.TypeAdapter; @@ -21,7 +21,8 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; import java.util.Arrays; -import org.openapitools.client.model.ConfigureIndexRequestSpec; +import org.openapitools.control.client.model.ConfigureIndexRequestSpec; +import org.openapitools.control.client.model.DeletionProtection; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -45,17 +46,21 @@ import java.util.Map; import java.util.Set; -import org.openapitools.client.JSON; +import org.openapitools.control.client.JSON; /** * Configuration used to scale an index. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-04-06T02:44:17.986783Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-16T15:28:37.412995Z[Etc/UTC]") public class ConfigureIndexRequest { public static final String SERIALIZED_NAME_SPEC = "spec"; @SerializedName(SERIALIZED_NAME_SPEC) private ConfigureIndexRequestSpec spec; + public static final String SERIALIZED_NAME_DELETION_PROTECTION = "deletion_protection"; + @SerializedName(SERIALIZED_NAME_DELETION_PROTECTION) + private DeletionProtection deletionProtection = DeletionProtection.DISABLED; + public ConfigureIndexRequest() { } @@ -69,7 +74,7 @@ public ConfigureIndexRequest spec(ConfigureIndexRequestSpec spec) { * Get spec * @return spec **/ - @javax.annotation.Nonnull + @javax.annotation.Nullable public ConfigureIndexRequestSpec getSpec() { return spec; } @@ -79,6 +84,27 @@ public void setSpec(ConfigureIndexRequestSpec spec) { this.spec = spec; } + + public ConfigureIndexRequest deletionProtection(DeletionProtection deletionProtection) { + + this.deletionProtection = deletionProtection; + return this; + } + + /** + * Get deletionProtection + * @return deletionProtection + **/ + @javax.annotation.Nullable + public DeletionProtection getDeletionProtection() { + return deletionProtection; + } + + + public void setDeletionProtection(DeletionProtection deletionProtection) { + this.deletionProtection = deletionProtection; + } + /** * A container for additional, undeclared properties. * This is a holder for any undeclared properties as specified with @@ -134,13 +160,14 @@ public boolean equals(Object o) { return false; } ConfigureIndexRequest configureIndexRequest = (ConfigureIndexRequest) o; - return Objects.equals(this.spec, configureIndexRequest.spec)&& + return Objects.equals(this.spec, configureIndexRequest.spec) && + Objects.equals(this.deletionProtection, configureIndexRequest.deletionProtection)&& Objects.equals(this.additionalProperties, configureIndexRequest.additionalProperties); } @Override public int hashCode() { - return Objects.hash(spec, additionalProperties); + return Objects.hash(spec, deletionProtection, additionalProperties); } @Override @@ -148,6 +175,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ConfigureIndexRequest {\n"); sb.append(" spec: ").append(toIndentedString(spec)).append("\n"); + sb.append(" deletionProtection: ").append(toIndentedString(deletionProtection)).append("\n"); sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); @@ -172,10 +200,10 @@ private String toIndentedString(Object o) { // a set of all properties/fields (JSON key names) openapiFields = new HashSet(); openapiFields.add("spec"); + openapiFields.add("deletion_protection"); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("spec"); } /** @@ -190,16 +218,11 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti throw new IllegalArgumentException(String.format("The required field(s) %s in ConfigureIndexRequest is not found in the empty JSON string", ConfigureIndexRequest.openapiRequiredFields.toString())); } } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : ConfigureIndexRequest.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); - } - } JsonObject jsonObj = jsonElement.getAsJsonObject(); - // validate the required field `spec` - ConfigureIndexRequestSpec.validateJsonElement(jsonObj.get("spec")); + // validate the optional field `spec` + if (jsonObj.get("spec") != null && !jsonObj.get("spec").isJsonNull()) { + ConfigureIndexRequestSpec.validateJsonElement(jsonObj.get("spec")); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/src/main/java/org/openapitools/client/model/ConfigureIndexRequestSpec.java b/src/main/java/org/openapitools/control/client/model/ConfigureIndexRequestSpec.java similarity index 97% rename from src/main/java/org/openapitools/client/model/ConfigureIndexRequestSpec.java rename to src/main/java/org/openapitools/control/client/model/ConfigureIndexRequestSpec.java index 1f903a80..19c58340 100644 --- a/src/main/java/org/openapitools/client/model/ConfigureIndexRequestSpec.java +++ b/src/main/java/org/openapitools/control/client/model/ConfigureIndexRequestSpec.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: v1 + * The version of the OpenAPI document: 2024-07 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -11,7 +11,7 @@ */ -package org.openapitools.client.model; +package org.openapitools.control.client.model; import java.util.Objects; import com.google.gson.TypeAdapter; @@ -21,7 +21,7 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; import java.util.Arrays; -import org.openapitools.client.model.ConfigureIndexRequestSpecPod; +import org.openapitools.control.client.model.ConfigureIndexRequestSpecPod; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -45,12 +45,12 @@ import java.util.Map; import java.util.Set; -import org.openapitools.client.JSON; +import org.openapitools.control.client.JSON; /** * ConfigureIndexRequestSpec */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-04-06T02:44:17.986783Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-16T15:28:37.412995Z[Etc/UTC]") public class ConfigureIndexRequestSpec { public static final String SERIALIZED_NAME_POD = "pod"; @SerializedName(SERIALIZED_NAME_POD) diff --git a/src/main/java/org/openapitools/client/model/ConfigureIndexRequestSpecPod.java b/src/main/java/org/openapitools/control/client/model/ConfigureIndexRequestSpecPod.java similarity index 98% rename from src/main/java/org/openapitools/client/model/ConfigureIndexRequestSpecPod.java rename to src/main/java/org/openapitools/control/client/model/ConfigureIndexRequestSpecPod.java index 1ac1ae9b..125b568f 100644 --- a/src/main/java/org/openapitools/client/model/ConfigureIndexRequestSpecPod.java +++ b/src/main/java/org/openapitools/control/client/model/ConfigureIndexRequestSpecPod.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: v1 + * The version of the OpenAPI document: 2024-07 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -11,7 +11,7 @@ */ -package org.openapitools.client.model; +package org.openapitools.control.client.model; import java.util.Objects; import com.google.gson.TypeAdapter; @@ -44,12 +44,12 @@ import java.util.Map; import java.util.Set; -import org.openapitools.client.JSON; +import org.openapitools.control.client.JSON; /** * ConfigureIndexRequestSpecPod */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-04-06T02:44:17.986783Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-16T15:28:37.412995Z[Etc/UTC]") public class ConfigureIndexRequestSpecPod { public static final String SERIALIZED_NAME_REPLICAS = "replicas"; @SerializedName(SERIALIZED_NAME_REPLICAS) diff --git a/src/main/java/org/openapitools/client/model/CreateCollectionRequest.java b/src/main/java/org/openapitools/control/client/model/CreateCollectionRequest.java similarity index 98% rename from src/main/java/org/openapitools/client/model/CreateCollectionRequest.java rename to src/main/java/org/openapitools/control/client/model/CreateCollectionRequest.java index cbb8c7fe..b2f2a57f 100644 --- a/src/main/java/org/openapitools/client/model/CreateCollectionRequest.java +++ b/src/main/java/org/openapitools/control/client/model/CreateCollectionRequest.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: v1 + * The version of the OpenAPI document: 2024-07 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -11,7 +11,7 @@ */ -package org.openapitools.client.model; +package org.openapitools.control.client.model; import java.util.Objects; import com.google.gson.TypeAdapter; @@ -44,12 +44,12 @@ import java.util.Map; import java.util.Set; -import org.openapitools.client.JSON; +import org.openapitools.control.client.JSON; /** * The configuration needed to create a Pinecone collection. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-04-06T02:44:17.986783Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-16T15:28:37.412995Z[Etc/UTC]") public class CreateCollectionRequest { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) diff --git a/src/main/java/org/openapitools/client/model/CreateIndexRequest.java b/src/main/java/org/openapitools/control/client/model/CreateIndexRequest.java similarity index 78% rename from src/main/java/org/openapitools/client/model/CreateIndexRequest.java rename to src/main/java/org/openapitools/control/client/model/CreateIndexRequest.java index 390fce38..1c35f841 100644 --- a/src/main/java/org/openapitools/client/model/CreateIndexRequest.java +++ b/src/main/java/org/openapitools/control/client/model/CreateIndexRequest.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: v1 + * The version of the OpenAPI document: 2024-07 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -11,7 +11,7 @@ */ -package org.openapitools.client.model; +package org.openapitools.control.client.model; import java.util.Objects; import com.google.gson.TypeAdapter; @@ -21,8 +21,8 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; import java.util.Arrays; -import org.openapitools.client.model.CreateIndexRequestSpec; -import org.openapitools.client.model.IndexMetric; +import org.openapitools.control.client.model.DeletionProtection; +import org.openapitools.control.client.model.IndexSpec; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -46,12 +46,12 @@ import java.util.Map; import java.util.Set; -import org.openapitools.client.JSON; +import org.openapitools.control.client.JSON; /** * The configuration needed to create a Pinecone index. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-04-06T02:44:17.986783Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-16T15:28:37.412995Z[Etc/UTC]") public class CreateIndexRequest { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @@ -61,13 +61,66 @@ public class CreateIndexRequest { @SerializedName(SERIALIZED_NAME_DIMENSION) private Integer dimension; + /** + * The distance metric to be used for similarity search. You can use 'euclidean', 'cosine', or 'dotproduct'. + */ + @JsonAdapter(MetricEnum.Adapter.class) + public enum MetricEnum { + COSINE("cosine"), + + EUCLIDEAN("euclidean"), + + DOTPRODUCT("dotproduct"); + + private String value; + + MetricEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static MetricEnum fromValue(String value) { + for (MetricEnum b : MetricEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final MetricEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public MetricEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return MetricEnum.fromValue(value); + } + } + } + public static final String SERIALIZED_NAME_METRIC = "metric"; @SerializedName(SERIALIZED_NAME_METRIC) - private IndexMetric metric = IndexMetric.COSINE; + private MetricEnum metric = MetricEnum.COSINE; + + public static final String SERIALIZED_NAME_DELETION_PROTECTION = "deletion_protection"; + @SerializedName(SERIALIZED_NAME_DELETION_PROTECTION) + private DeletionProtection deletionProtection = DeletionProtection.DISABLED; public static final String SERIALIZED_NAME_SPEC = "spec"; @SerializedName(SERIALIZED_NAME_SPEC) - private CreateIndexRequestSpec spec; + private IndexSpec spec; public CreateIndexRequest() { } @@ -116,28 +169,49 @@ public void setDimension(Integer dimension) { } - public CreateIndexRequest metric(IndexMetric metric) { + public CreateIndexRequest metric(MetricEnum metric) { this.metric = metric; return this; } /** - * Get metric + * The distance metric to be used for similarity search. You can use 'euclidean', 'cosine', or 'dotproduct'. * @return metric **/ @javax.annotation.Nullable - public IndexMetric getMetric() { + public MetricEnum getMetric() { return metric; } - public void setMetric(IndexMetric metric) { + public void setMetric(MetricEnum metric) { this.metric = metric; } - public CreateIndexRequest spec(CreateIndexRequestSpec spec) { + public CreateIndexRequest deletionProtection(DeletionProtection deletionProtection) { + + this.deletionProtection = deletionProtection; + return this; + } + + /** + * Get deletionProtection + * @return deletionProtection + **/ + @javax.annotation.Nullable + public DeletionProtection getDeletionProtection() { + return deletionProtection; + } + + + public void setDeletionProtection(DeletionProtection deletionProtection) { + this.deletionProtection = deletionProtection; + } + + + public CreateIndexRequest spec(IndexSpec spec) { this.spec = spec; return this; @@ -148,12 +222,12 @@ public CreateIndexRequest spec(CreateIndexRequestSpec spec) { * @return spec **/ @javax.annotation.Nullable - public CreateIndexRequestSpec getSpec() { + public IndexSpec getSpec() { return spec; } - public void setSpec(CreateIndexRequestSpec spec) { + public void setSpec(IndexSpec spec) { this.spec = spec; } @@ -215,13 +289,14 @@ public boolean equals(Object o) { return Objects.equals(this.name, createIndexRequest.name) && Objects.equals(this.dimension, createIndexRequest.dimension) && Objects.equals(this.metric, createIndexRequest.metric) && + Objects.equals(this.deletionProtection, createIndexRequest.deletionProtection) && Objects.equals(this.spec, createIndexRequest.spec)&& Objects.equals(this.additionalProperties, createIndexRequest.additionalProperties); } @Override public int hashCode() { - return Objects.hash(name, dimension, metric, spec, additionalProperties); + return Objects.hash(name, dimension, metric, deletionProtection, spec, additionalProperties); } @Override @@ -231,6 +306,7 @@ public String toString() { sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" dimension: ").append(toIndentedString(dimension)).append("\n"); sb.append(" metric: ").append(toIndentedString(metric)).append("\n"); + sb.append(" deletionProtection: ").append(toIndentedString(deletionProtection)).append("\n"); sb.append(" spec: ").append(toIndentedString(spec)).append("\n"); sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); @@ -258,6 +334,7 @@ private String toIndentedString(Object o) { openapiFields.add("name"); openapiFields.add("dimension"); openapiFields.add("metric"); + openapiFields.add("deletion_protection"); openapiFields.add("spec"); // a set of required properties/fields (JSON key names) @@ -290,8 +367,11 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti if (!jsonObj.get("name").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); } + if ((jsonObj.get("metric") != null && !jsonObj.get("metric").isJsonNull()) && !jsonObj.get("metric").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `metric` to be a primitive type in the JSON string but got `%s`", jsonObj.get("metric").toString())); + } // validate the required field `spec` - CreateIndexRequestSpec.validateJsonElement(jsonObj.get("spec")); + IndexSpec.validateJsonElement(jsonObj.get("spec")); } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/src/main/java/org/openapitools/client/model/IndexMetric.java b/src/main/java/org/openapitools/control/client/model/DeletionProtection.java similarity index 58% rename from src/main/java/org/openapitools/client/model/IndexMetric.java rename to src/main/java/org/openapitools/control/client/model/DeletionProtection.java index 3116e798..0eaa2c6a 100644 --- a/src/main/java/org/openapitools/client/model/IndexMetric.java +++ b/src/main/java/org/openapitools/control/client/model/DeletionProtection.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: v1 + * The version of the OpenAPI document: 2024-07 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -11,7 +11,7 @@ */ -package org.openapitools.client.model; +package org.openapitools.control.client.model; import java.util.Objects; import com.google.gson.annotations.SerializedName; @@ -23,20 +23,18 @@ import com.google.gson.stream.JsonWriter; /** - * The distance metric to be used for similarity search. You can use 'euclidean', 'cosine', or 'dotproduct'. + * Whether delete protection is enabled/disabled for the resource. */ -@JsonAdapter(IndexMetric.Adapter.class) -public enum IndexMetric { +@JsonAdapter(DeletionProtection.Adapter.class) +public enum DeletionProtection { - COSINE("cosine"), + DISABLED("disabled"), - EUCLIDEAN("euclidean"), - - DOTPRODUCT("dotproduct"); + ENABLED("enabled"); private String value; - IndexMetric(String value) { + DeletionProtection(String value) { this.value = value; } @@ -49,8 +47,8 @@ public String toString() { return String.valueOf(value); } - public static IndexMetric fromValue(String value) { - for (IndexMetric b : IndexMetric.values()) { + public static DeletionProtection fromValue(String value) { + for (DeletionProtection b : DeletionProtection.values()) { if (b.value.equals(value)) { return b; } @@ -58,16 +56,16 @@ public static IndexMetric fromValue(String value) { throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - public static class Adapter extends TypeAdapter { + public static class Adapter extends TypeAdapter { @Override - public void write(final JsonWriter jsonWriter, final IndexMetric enumeration) throws IOException { + public void write(final JsonWriter jsonWriter, final DeletionProtection enumeration) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override - public IndexMetric read(final JsonReader jsonReader) throws IOException { + public DeletionProtection read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); - return IndexMetric.fromValue(value); + return DeletionProtection.fromValue(value); } } } diff --git a/src/main/java/org/openapitools/control/client/model/EmbedRequest.java b/src/main/java/org/openapitools/control/client/model/EmbedRequest.java new file mode 100644 index 00000000..8cffa9b9 --- /dev/null +++ b/src/main/java/org/openapitools/control/client/model/EmbedRequest.java @@ -0,0 +1,375 @@ +/* + * Pinecone Control Plane API + * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. + * + * The version of the OpenAPI document: 2024-07 + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.control.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.control.client.model.EmbedRequestInputsInner; +import org.openapitools.control.client.model.EmbedRequestParameters; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.control.client.JSON; + +/** + * Generate embeddings for inputs + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-16T15:28:37.412995Z[Etc/UTC]") +public class EmbedRequest { + public static final String SERIALIZED_NAME_MODEL = "model"; + @SerializedName(SERIALIZED_NAME_MODEL) + private String model; + + public static final String SERIALIZED_NAME_PARAMETERS = "parameters"; + @SerializedName(SERIALIZED_NAME_PARAMETERS) + private EmbedRequestParameters parameters; + + public static final String SERIALIZED_NAME_INPUTS = "inputs"; + @SerializedName(SERIALIZED_NAME_INPUTS) + private List inputs = new ArrayList<>(); + + public EmbedRequest() { + } + + public EmbedRequest model(String model) { + + this.model = model; + return this; + } + + /** + * Get model + * @return model + **/ + @javax.annotation.Nonnull + public String getModel() { + return model; + } + + + public void setModel(String model) { + this.model = model; + } + + + public EmbedRequest parameters(EmbedRequestParameters parameters) { + + this.parameters = parameters; + return this; + } + + /** + * Get parameters + * @return parameters + **/ + @javax.annotation.Nullable + public EmbedRequestParameters getParameters() { + return parameters; + } + + + public void setParameters(EmbedRequestParameters parameters) { + this.parameters = parameters; + } + + + public EmbedRequest inputs(List inputs) { + + this.inputs = inputs; + return this; + } + + public EmbedRequest addInputsItem(EmbedRequestInputsInner inputsItem) { + if (this.inputs == null) { + this.inputs = new ArrayList<>(); + } + this.inputs.add(inputsItem); + return this; + } + + /** + * Get inputs + * @return inputs + **/ + @javax.annotation.Nonnull + public List getInputs() { + return inputs; + } + + + public void setInputs(List inputs) { + this.inputs = inputs; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the EmbedRequest instance itself + */ + public EmbedRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EmbedRequest embedRequest = (EmbedRequest) o; + return Objects.equals(this.model, embedRequest.model) && + Objects.equals(this.parameters, embedRequest.parameters) && + Objects.equals(this.inputs, embedRequest.inputs)&& + Objects.equals(this.additionalProperties, embedRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(model, parameters, inputs, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EmbedRequest {\n"); + sb.append(" model: ").append(toIndentedString(model)).append("\n"); + sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); + sb.append(" inputs: ").append(toIndentedString(inputs)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("model"); + openapiFields.add("parameters"); + openapiFields.add("inputs"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("model"); + openapiRequiredFields.add("inputs"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EmbedRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EmbedRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EmbedRequest is not found in the empty JSON string", EmbedRequest.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : EmbedRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("model").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `model` to be a primitive type in the JSON string but got `%s`", jsonObj.get("model").toString())); + } + // validate the optional field `parameters` + if (jsonObj.get("parameters") != null && !jsonObj.get("parameters").isJsonNull()) { + EmbedRequestParameters.validateJsonElement(jsonObj.get("parameters")); + } + // ensure the json data is an array + if (!jsonObj.get("inputs").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `inputs` to be an array in the JSON string but got `%s`", jsonObj.get("inputs").toString())); + } + + JsonArray jsonArrayinputs = jsonObj.getAsJsonArray("inputs"); + // validate the required field `inputs` (array) + for (int i = 0; i < jsonArrayinputs.size(); i++) { + EmbedRequestInputsInner.validateJsonElement(jsonArrayinputs.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EmbedRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EmbedRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EmbedRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EmbedRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public EmbedRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + EmbedRequest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EmbedRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of EmbedRequest + * @throws IOException if the JSON string is invalid with respect to EmbedRequest + */ + public static EmbedRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EmbedRequest.class); + } + + /** + * Convert an instance of EmbedRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/control/client/model/EmbedRequestInputsInner.java b/src/main/java/org/openapitools/control/client/model/EmbedRequestInputsInner.java new file mode 100644 index 00000000..86033a5b --- /dev/null +++ b/src/main/java/org/openapitools/control/client/model/EmbedRequestInputsInner.java @@ -0,0 +1,284 @@ +/* + * Pinecone Control Plane API + * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. + * + * The version of the OpenAPI document: 2024-07 + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.control.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.control.client.JSON; + +/** + * EmbedRequestInputsInner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-16T15:28:37.412995Z[Etc/UTC]") +public class EmbedRequestInputsInner { + public static final String SERIALIZED_NAME_TEXT = "text"; + @SerializedName(SERIALIZED_NAME_TEXT) + private String text; + + public EmbedRequestInputsInner() { + } + + public EmbedRequestInputsInner text(String text) { + + this.text = text; + return this; + } + + /** + * Get text + * @return text + **/ + @javax.annotation.Nullable + public String getText() { + return text; + } + + + public void setText(String text) { + this.text = text; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the EmbedRequestInputsInner instance itself + */ + public EmbedRequestInputsInner putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EmbedRequestInputsInner embedRequestInputsInner = (EmbedRequestInputsInner) o; + return Objects.equals(this.text, embedRequestInputsInner.text)&& + Objects.equals(this.additionalProperties, embedRequestInputsInner.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(text, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EmbedRequestInputsInner {\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("text"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EmbedRequestInputsInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EmbedRequestInputsInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EmbedRequestInputsInner is not found in the empty JSON string", EmbedRequestInputsInner.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("text") != null && !jsonObj.get("text").isJsonNull()) && !jsonObj.get("text").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `text` to be a primitive type in the JSON string but got `%s`", jsonObj.get("text").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EmbedRequestInputsInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EmbedRequestInputsInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EmbedRequestInputsInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EmbedRequestInputsInner value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public EmbedRequestInputsInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + EmbedRequestInputsInner instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EmbedRequestInputsInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of EmbedRequestInputsInner + * @throws IOException if the JSON string is invalid with respect to EmbedRequestInputsInner + */ + public static EmbedRequestInputsInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EmbedRequestInputsInner.class); + } + + /** + * Convert an instance of EmbedRequestInputsInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/control/client/model/EmbedRequestParameters.java b/src/main/java/org/openapitools/control/client/model/EmbedRequestParameters.java new file mode 100644 index 00000000..10469745 --- /dev/null +++ b/src/main/java/org/openapitools/control/client/model/EmbedRequestParameters.java @@ -0,0 +1,315 @@ +/* + * Pinecone Control Plane API + * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. + * + * The version of the OpenAPI document: 2024-07 + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.control.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.control.client.JSON; + +/** + * Model-specific parameters. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-16T15:28:37.412995Z[Etc/UTC]") +public class EmbedRequestParameters { + public static final String SERIALIZED_NAME_INPUT_TYPE = "input_type"; + @SerializedName(SERIALIZED_NAME_INPUT_TYPE) + private String inputType; + + public static final String SERIALIZED_NAME_TRUNCATE = "truncate"; + @SerializedName(SERIALIZED_NAME_TRUNCATE) + private String truncate = "END"; + + public EmbedRequestParameters() { + } + + public EmbedRequestParameters inputType(String inputType) { + + this.inputType = inputType; + return this; + } + + /** + * Common property used to distinguish between types of data. + * @return inputType + **/ + @javax.annotation.Nullable + public String getInputType() { + return inputType; + } + + + public void setInputType(String inputType) { + this.inputType = inputType; + } + + + public EmbedRequestParameters truncate(String truncate) { + + this.truncate = truncate; + return this; + } + + /** + * How to handle inputs longer than those supported by the model. If NONE, when the input exceeds the maximum input token length an error will be returned. + * @return truncate + **/ + @javax.annotation.Nullable + public String getTruncate() { + return truncate; + } + + + public void setTruncate(String truncate) { + this.truncate = truncate; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the EmbedRequestParameters instance itself + */ + public EmbedRequestParameters putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EmbedRequestParameters embedRequestParameters = (EmbedRequestParameters) o; + return Objects.equals(this.inputType, embedRequestParameters.inputType) && + Objects.equals(this.truncate, embedRequestParameters.truncate)&& + Objects.equals(this.additionalProperties, embedRequestParameters.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(inputType, truncate, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EmbedRequestParameters {\n"); + sb.append(" inputType: ").append(toIndentedString(inputType)).append("\n"); + sb.append(" truncate: ").append(toIndentedString(truncate)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("input_type"); + openapiFields.add("truncate"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EmbedRequestParameters + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EmbedRequestParameters.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EmbedRequestParameters is not found in the empty JSON string", EmbedRequestParameters.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("input_type") != null && !jsonObj.get("input_type").isJsonNull()) && !jsonObj.get("input_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `input_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("input_type").toString())); + } + if ((jsonObj.get("truncate") != null && !jsonObj.get("truncate").isJsonNull()) && !jsonObj.get("truncate").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `truncate` to be a primitive type in the JSON string but got `%s`", jsonObj.get("truncate").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EmbedRequestParameters.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EmbedRequestParameters' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EmbedRequestParameters.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EmbedRequestParameters value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public EmbedRequestParameters read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + EmbedRequestParameters instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EmbedRequestParameters given an JSON string + * + * @param jsonString JSON string + * @return An instance of EmbedRequestParameters + * @throws IOException if the JSON string is invalid with respect to EmbedRequestParameters + */ + public static EmbedRequestParameters fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EmbedRequestParameters.class); + } + + /** + * Convert an instance of EmbedRequestParameters to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/CreateIndexRequestSpecPodMetadataConfig.java b/src/main/java/org/openapitools/control/client/model/Embedding.java similarity index 66% rename from src/main/java/org/openapitools/client/model/CreateIndexRequestSpecPodMetadataConfig.java rename to src/main/java/org/openapitools/control/client/model/Embedding.java index 946f0d8f..f8d743ea 100644 --- a/src/main/java/org/openapitools/client/model/CreateIndexRequestSpecPodMetadataConfig.java +++ b/src/main/java/org/openapitools/control/client/model/Embedding.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: v1 + * The version of the OpenAPI document: 2024-07 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -11,7 +11,7 @@ */ -package org.openapitools.client.model; +package org.openapitools.control.client.model; import java.util.Objects; import com.google.gson.TypeAdapter; @@ -20,6 +20,7 @@ import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -46,46 +47,46 @@ import java.util.Map; import java.util.Set; -import org.openapitools.client.JSON; +import org.openapitools.control.client.JSON; /** - * Configuration for the behavior of Pinecone's internal metadata index. By default, all metadata is indexed; when `metadata_config` is present, only specified metadata fields are indexed. These configurations are only valid for use with pod-based indexes. + * Embedding of a single input */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-04-06T02:44:17.986783Z[Etc/UTC]") -public class CreateIndexRequestSpecPodMetadataConfig { - public static final String SERIALIZED_NAME_INDEXED = "indexed"; - @SerializedName(SERIALIZED_NAME_INDEXED) - private List indexed; +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-16T15:28:37.412995Z[Etc/UTC]") +public class Embedding { + public static final String SERIALIZED_NAME_VALUES = "values"; + @SerializedName(SERIALIZED_NAME_VALUES) + private List values; - public CreateIndexRequestSpecPodMetadataConfig() { + public Embedding() { } - public CreateIndexRequestSpecPodMetadataConfig indexed(List indexed) { + public Embedding values(List values) { - this.indexed = indexed; + this.values = values; return this; } - public CreateIndexRequestSpecPodMetadataConfig addIndexedItem(String indexedItem) { - if (this.indexed == null) { - this.indexed = new ArrayList<>(); + public Embedding addValuesItem(BigDecimal valuesItem) { + if (this.values == null) { + this.values = new ArrayList<>(); } - this.indexed.add(indexedItem); + this.values.add(valuesItem); return this; } /** - * By default, all metadata is indexed; to change this behavior, use this property to specify an array of metadata fields which should be indexed. - * @return indexed + * The embedding values. + * @return values **/ @javax.annotation.Nullable - public List getIndexed() { - return indexed; + public List getValues() { + return values; } - public void setIndexed(List indexed) { - this.indexed = indexed; + public void setValues(List values) { + this.values = values; } /** @@ -101,9 +102,9 @@ public void setIndexed(List indexed) { * * @param key name of the property * @param value value of the property - * @return the CreateIndexRequestSpecPodMetadataConfig instance itself + * @return the Embedding instance itself */ - public CreateIndexRequestSpecPodMetadataConfig putAdditionalProperty(String key, Object value) { + public Embedding putAdditionalProperty(String key, Object value) { if (this.additionalProperties == null) { this.additionalProperties = new HashMap(); } @@ -142,21 +143,21 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - CreateIndexRequestSpecPodMetadataConfig createIndexRequestSpecPodMetadataConfig = (CreateIndexRequestSpecPodMetadataConfig) o; - return Objects.equals(this.indexed, createIndexRequestSpecPodMetadataConfig.indexed)&& - Objects.equals(this.additionalProperties, createIndexRequestSpecPodMetadataConfig.additionalProperties); + Embedding embedding = (Embedding) o; + return Objects.equals(this.values, embedding.values)&& + Objects.equals(this.additionalProperties, embedding.additionalProperties); } @Override public int hashCode() { - return Objects.hash(indexed, additionalProperties); + return Objects.hash(values, additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class CreateIndexRequestSpecPodMetadataConfig {\n"); - sb.append(" indexed: ").append(toIndentedString(indexed)).append("\n"); + sb.append("class Embedding {\n"); + sb.append(" values: ").append(toIndentedString(values)).append("\n"); sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); @@ -180,7 +181,7 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet(); - openapiFields.add("indexed"); + openapiFields.add("values"); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(); @@ -190,18 +191,18 @@ private String toIndentedString(Object o) { * Validates the JSON Element and throws an exception if issues found * * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to CreateIndexRequestSpecPodMetadataConfig + * @throws IOException if the JSON Element is invalid with respect to Embedding */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { - if (!CreateIndexRequestSpecPodMetadataConfig.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateIndexRequestSpecPodMetadataConfig is not found in the empty JSON string", CreateIndexRequestSpecPodMetadataConfig.openapiRequiredFields.toString())); + if (!Embedding.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Embedding is not found in the empty JSON string", Embedding.openapiRequiredFields.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); // ensure the optional json data is an array if present - if (jsonObj.get("indexed") != null && !jsonObj.get("indexed").isJsonNull() && !jsonObj.get("indexed").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `indexed` to be an array in the JSON string but got `%s`", jsonObj.get("indexed").toString())); + if (jsonObj.get("values") != null && !jsonObj.get("values").isJsonNull() && !jsonObj.get("values").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `values` to be an array in the JSON string but got `%s`", jsonObj.get("values").toString())); } } @@ -209,16 +210,16 @@ public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateIndexRequestSpecPodMetadataConfig.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateIndexRequestSpecPodMetadataConfig' and its subtypes + if (!Embedding.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Embedding' and its subtypes } final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateIndexRequestSpecPodMetadataConfig.class)); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Embedding.class)); - return (TypeAdapter) new TypeAdapter() { + return (TypeAdapter) new TypeAdapter() { @Override - public void write(JsonWriter out, CreateIndexRequestSpecPodMetadataConfig value) throws IOException { + public void write(JsonWriter out, Embedding value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); obj.remove("additionalProperties"); // serialize additional properties @@ -241,12 +242,12 @@ else if (entry.getValue() instanceof Character) } @Override - public CreateIndexRequestSpecPodMetadataConfig read(JsonReader in) throws IOException { + public Embedding read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); JsonObject jsonObj = jsonElement.getAsJsonObject(); // store additional fields in the deserialized instance - CreateIndexRequestSpecPodMetadataConfig instance = thisAdapter.fromJsonTree(jsonObj); + Embedding instance = thisAdapter.fromJsonTree(jsonObj); for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type @@ -273,18 +274,18 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } /** - * Create an instance of CreateIndexRequestSpecPodMetadataConfig given an JSON string + * Create an instance of Embedding given an JSON string * * @param jsonString JSON string - * @return An instance of CreateIndexRequestSpecPodMetadataConfig - * @throws IOException if the JSON string is invalid with respect to CreateIndexRequestSpecPodMetadataConfig + * @return An instance of Embedding + * @throws IOException if the JSON string is invalid with respect to Embedding */ - public static CreateIndexRequestSpecPodMetadataConfig fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateIndexRequestSpecPodMetadataConfig.class); + public static Embedding fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Embedding.class); } /** - * Convert an instance of CreateIndexRequestSpecPodMetadataConfig to an JSON string + * Convert an instance of Embedding to an JSON string * * @return JSON string */ diff --git a/src/main/java/org/openapitools/control/client/model/EmbeddingsList.java b/src/main/java/org/openapitools/control/client/model/EmbeddingsList.java new file mode 100644 index 00000000..9bbdac61 --- /dev/null +++ b/src/main/java/org/openapitools/control/client/model/EmbeddingsList.java @@ -0,0 +1,370 @@ +/* + * Pinecone Control Plane API + * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. + * + * The version of the OpenAPI document: 2024-07 + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.control.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.control.client.model.Embedding; +import org.openapitools.control.client.model.EmbeddingsListUsage; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.control.client.JSON; + +/** + * Embeddings generated for the input + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-16T15:28:37.412995Z[Etc/UTC]") +public class EmbeddingsList { + public static final String SERIALIZED_NAME_MODEL = "model"; + @SerializedName(SERIALIZED_NAME_MODEL) + private String model; + + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private List data; + + public static final String SERIALIZED_NAME_USAGE = "usage"; + @SerializedName(SERIALIZED_NAME_USAGE) + private EmbeddingsListUsage usage; + + public EmbeddingsList() { + } + + public EmbeddingsList model(String model) { + + this.model = model; + return this; + } + + /** + * Get model + * @return model + **/ + @javax.annotation.Nullable + public String getModel() { + return model; + } + + + public void setModel(String model) { + this.model = model; + } + + + public EmbeddingsList data(List data) { + + this.data = data; + return this; + } + + public EmbeddingsList addDataItem(Embedding dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + return this; + } + + /** + * Get data + * @return data + **/ + @javax.annotation.Nullable + public List getData() { + return data; + } + + + public void setData(List data) { + this.data = data; + } + + + public EmbeddingsList usage(EmbeddingsListUsage usage) { + + this.usage = usage; + return this; + } + + /** + * Get usage + * @return usage + **/ + @javax.annotation.Nullable + public EmbeddingsListUsage getUsage() { + return usage; + } + + + public void setUsage(EmbeddingsListUsage usage) { + this.usage = usage; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the EmbeddingsList instance itself + */ + public EmbeddingsList putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EmbeddingsList embeddingsList = (EmbeddingsList) o; + return Objects.equals(this.model, embeddingsList.model) && + Objects.equals(this.data, embeddingsList.data) && + Objects.equals(this.usage, embeddingsList.usage)&& + Objects.equals(this.additionalProperties, embeddingsList.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(model, data, usage, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EmbeddingsList {\n"); + sb.append(" model: ").append(toIndentedString(model)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" usage: ").append(toIndentedString(usage)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("model"); + openapiFields.add("data"); + openapiFields.add("usage"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EmbeddingsList + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EmbeddingsList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EmbeddingsList is not found in the empty JSON string", EmbeddingsList.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("model") != null && !jsonObj.get("model").isJsonNull()) && !jsonObj.get("model").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `model` to be a primitive type in the JSON string but got `%s`", jsonObj.get("model").toString())); + } + if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { + JsonArray jsonArraydata = jsonObj.getAsJsonArray("data"); + if (jsonArraydata != null) { + // ensure the json data is an array + if (!jsonObj.get("data").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + + // validate the optional field `data` (array) + for (int i = 0; i < jsonArraydata.size(); i++) { + Embedding.validateJsonElement(jsonArraydata.get(i)); + }; + } + } + // validate the optional field `usage` + if (jsonObj.get("usage") != null && !jsonObj.get("usage").isJsonNull()) { + EmbeddingsListUsage.validateJsonElement(jsonObj.get("usage")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EmbeddingsList.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EmbeddingsList' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EmbeddingsList.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EmbeddingsList value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public EmbeddingsList read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + EmbeddingsList instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EmbeddingsList given an JSON string + * + * @param jsonString JSON string + * @return An instance of EmbeddingsList + * @throws IOException if the JSON string is invalid with respect to EmbeddingsList + */ + public static EmbeddingsList fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EmbeddingsList.class); + } + + /** + * Convert an instance of EmbeddingsList to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/control/client/model/EmbeddingsListUsage.java b/src/main/java/org/openapitools/control/client/model/EmbeddingsListUsage.java new file mode 100644 index 00000000..2c4cbcd0 --- /dev/null +++ b/src/main/java/org/openapitools/control/client/model/EmbeddingsListUsage.java @@ -0,0 +1,281 @@ +/* + * Pinecone Control Plane API + * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. + * + * The version of the OpenAPI document: 2024-07 + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.control.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.control.client.JSON; + +/** + * Usage statistics for model inference including any instruction prefixes + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-16T15:28:37.412995Z[Etc/UTC]") +public class EmbeddingsListUsage { + public static final String SERIALIZED_NAME_TOTAL_TOKENS = "total_tokens"; + @SerializedName(SERIALIZED_NAME_TOTAL_TOKENS) + private Integer totalTokens; + + public EmbeddingsListUsage() { + } + + public EmbeddingsListUsage totalTokens(Integer totalTokens) { + + this.totalTokens = totalTokens; + return this; + } + + /** + * Get totalTokens + * @return totalTokens + **/ + @javax.annotation.Nullable + public Integer getTotalTokens() { + return totalTokens; + } + + + public void setTotalTokens(Integer totalTokens) { + this.totalTokens = totalTokens; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the EmbeddingsListUsage instance itself + */ + public EmbeddingsListUsage putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EmbeddingsListUsage embeddingsListUsage = (EmbeddingsListUsage) o; + return Objects.equals(this.totalTokens, embeddingsListUsage.totalTokens)&& + Objects.equals(this.additionalProperties, embeddingsListUsage.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(totalTokens, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EmbeddingsListUsage {\n"); + sb.append(" totalTokens: ").append(toIndentedString(totalTokens)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("total_tokens"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EmbeddingsListUsage + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EmbeddingsListUsage.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EmbeddingsListUsage is not found in the empty JSON string", EmbeddingsListUsage.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EmbeddingsListUsage.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EmbeddingsListUsage' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EmbeddingsListUsage.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EmbeddingsListUsage value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public EmbeddingsListUsage read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + EmbeddingsListUsage instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EmbeddingsListUsage given an JSON string + * + * @param jsonString JSON string + * @return An instance of EmbeddingsListUsage + * @throws IOException if the JSON string is invalid with respect to EmbeddingsListUsage + */ + public static EmbeddingsListUsage fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EmbeddingsListUsage.class); + } + + /** + * Convert an instance of EmbeddingsListUsage to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/client/model/ErrorResponse.java b/src/main/java/org/openapitools/control/client/model/ErrorResponse.java similarity index 97% rename from src/main/java/org/openapitools/client/model/ErrorResponse.java rename to src/main/java/org/openapitools/control/client/model/ErrorResponse.java index 3f2ad9c7..3a59ac92 100644 --- a/src/main/java/org/openapitools/client/model/ErrorResponse.java +++ b/src/main/java/org/openapitools/control/client/model/ErrorResponse.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: v1 + * The version of the OpenAPI document: 2024-07 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -11,7 +11,7 @@ */ -package org.openapitools.client.model; +package org.openapitools.control.client.model; import java.util.Objects; import com.google.gson.TypeAdapter; @@ -21,7 +21,7 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; import java.util.Arrays; -import org.openapitools.client.model.ErrorResponseError; +import org.openapitools.control.client.model.ErrorResponseError; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -45,12 +45,12 @@ import java.util.Map; import java.util.Set; -import org.openapitools.client.JSON; +import org.openapitools.control.client.JSON; /** * The response shape used for all error responses. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-04-06T02:44:17.986783Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-16T15:28:37.412995Z[Etc/UTC]") public class ErrorResponse { public static final String SERIALIZED_NAME_STATUS = "status"; @SerializedName(SERIALIZED_NAME_STATUS) diff --git a/src/main/java/org/openapitools/client/model/ErrorResponseError.java b/src/main/java/org/openapitools/control/client/model/ErrorResponseError.java similarity index 97% rename from src/main/java/org/openapitools/client/model/ErrorResponseError.java rename to src/main/java/org/openapitools/control/client/model/ErrorResponseError.java index 6826398d..c6c74ce4 100644 --- a/src/main/java/org/openapitools/client/model/ErrorResponseError.java +++ b/src/main/java/org/openapitools/control/client/model/ErrorResponseError.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: v1 + * The version of the OpenAPI document: 2024-07 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -11,7 +11,7 @@ */ -package org.openapitools.client.model; +package org.openapitools.control.client.model; import java.util.Objects; import com.google.gson.TypeAdapter; @@ -44,12 +44,12 @@ import java.util.Map; import java.util.Set; -import org.openapitools.client.JSON; +import org.openapitools.control.client.JSON; /** * Detailed information about the error that occurred. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-04-06T02:44:17.986783Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-16T15:28:37.412995Z[Etc/UTC]") public class ErrorResponseError { /** * Gets or Sets code @@ -90,7 +90,9 @@ public enum CodeEnum { DATA_LOSS("DATA_LOSS"), - FORBIDDEN("FORBIDDEN"); + FORBIDDEN("FORBIDDEN"), + + UNPROCESSABLE_ENTITY("UNPROCESSABLE_ENTITY"); private String value; diff --git a/src/main/java/org/openapitools/client/model/IndexList.java b/src/main/java/org/openapitools/control/client/model/IndexList.java similarity index 97% rename from src/main/java/org/openapitools/client/model/IndexList.java rename to src/main/java/org/openapitools/control/client/model/IndexList.java index 004b27b5..e8a8a597 100644 --- a/src/main/java/org/openapitools/client/model/IndexList.java +++ b/src/main/java/org/openapitools/control/client/model/IndexList.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: v1 + * The version of the OpenAPI document: 2024-07 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -11,7 +11,7 @@ */ -package org.openapitools.client.model; +package org.openapitools.control.client.model; import java.util.Objects; import com.google.gson.TypeAdapter; @@ -23,7 +23,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import org.openapitools.client.model.IndexModel; +import org.openapitools.control.client.model.IndexModel; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -47,12 +47,12 @@ import java.util.Map; import java.util.Set; -import org.openapitools.client.JSON; +import org.openapitools.control.client.JSON; /** * The list of indexes that exist in the project. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-04-06T02:44:17.986783Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-16T15:28:37.412995Z[Etc/UTC]") public class IndexList { public static final String SERIALIZED_NAME_INDEXES = "indexes"; @SerializedName(SERIALIZED_NAME_INDEXES) diff --git a/src/main/java/org/openapitools/client/model/IndexModel.java b/src/main/java/org/openapitools/control/client/model/IndexModel.java similarity index 81% rename from src/main/java/org/openapitools/client/model/IndexModel.java rename to src/main/java/org/openapitools/control/client/model/IndexModel.java index 090d8c19..1aa42f04 100644 --- a/src/main/java/org/openapitools/client/model/IndexModel.java +++ b/src/main/java/org/openapitools/control/client/model/IndexModel.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: v1 + * The version of the OpenAPI document: 2024-07 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -11,7 +11,7 @@ */ -package org.openapitools.client.model; +package org.openapitools.control.client.model; import java.util.Objects; import com.google.gson.TypeAdapter; @@ -21,9 +21,9 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; import java.util.Arrays; -import org.openapitools.client.model.IndexMetric; -import org.openapitools.client.model.IndexModelSpec; -import org.openapitools.client.model.IndexModelStatus; +import org.openapitools.control.client.model.DeletionProtection; +import org.openapitools.control.client.model.IndexModelSpec; +import org.openapitools.control.client.model.IndexModelStatus; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -47,12 +47,12 @@ import java.util.Map; import java.util.Set; -import org.openapitools.client.JSON; +import org.openapitools.control.client.JSON; /** * The IndexModel describes the configuration and status of a Pinecone index. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-04-06T02:44:17.986783Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-16T15:28:37.412995Z[Etc/UTC]") public class IndexModel { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @@ -62,14 +62,67 @@ public class IndexModel { @SerializedName(SERIALIZED_NAME_DIMENSION) private Integer dimension; + /** + * The distance metric to be used for similarity search. You can use 'euclidean', 'cosine', or 'dotproduct'. + */ + @JsonAdapter(MetricEnum.Adapter.class) + public enum MetricEnum { + COSINE("cosine"), + + EUCLIDEAN("euclidean"), + + DOTPRODUCT("dotproduct"); + + private String value; + + MetricEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static MetricEnum fromValue(String value) { + for (MetricEnum b : MetricEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final MetricEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public MetricEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return MetricEnum.fromValue(value); + } + } + } + public static final String SERIALIZED_NAME_METRIC = "metric"; @SerializedName(SERIALIZED_NAME_METRIC) - private IndexMetric metric = IndexMetric.COSINE; + private MetricEnum metric = MetricEnum.COSINE; public static final String SERIALIZED_NAME_HOST = "host"; @SerializedName(SERIALIZED_NAME_HOST) private String host; + public static final String SERIALIZED_NAME_DELETION_PROTECTION = "deletion_protection"; + @SerializedName(SERIALIZED_NAME_DELETION_PROTECTION) + private DeletionProtection deletionProtection = DeletionProtection.DISABLED; + public static final String SERIALIZED_NAME_SPEC = "spec"; @SerializedName(SERIALIZED_NAME_SPEC) private IndexModelSpec spec; @@ -125,23 +178,23 @@ public void setDimension(Integer dimension) { } - public IndexModel metric(IndexMetric metric) { + public IndexModel metric(MetricEnum metric) { this.metric = metric; return this; } /** - * Get metric + * The distance metric to be used for similarity search. You can use 'euclidean', 'cosine', or 'dotproduct'. * @return metric **/ @javax.annotation.Nonnull - public IndexMetric getMetric() { + public MetricEnum getMetric() { return metric; } - public void setMetric(IndexMetric metric) { + public void setMetric(MetricEnum metric) { this.metric = metric; } @@ -167,6 +220,27 @@ public void setHost(String host) { } + public IndexModel deletionProtection(DeletionProtection deletionProtection) { + + this.deletionProtection = deletionProtection; + return this; + } + + /** + * Get deletionProtection + * @return deletionProtection + **/ + @javax.annotation.Nullable + public DeletionProtection getDeletionProtection() { + return deletionProtection; + } + + + public void setDeletionProtection(DeletionProtection deletionProtection) { + this.deletionProtection = deletionProtection; + } + + public IndexModel spec(IndexModelSpec spec) { this.spec = spec; @@ -267,6 +341,7 @@ public boolean equals(Object o) { Objects.equals(this.dimension, indexModel.dimension) && Objects.equals(this.metric, indexModel.metric) && Objects.equals(this.host, indexModel.host) && + Objects.equals(this.deletionProtection, indexModel.deletionProtection) && Objects.equals(this.spec, indexModel.spec) && Objects.equals(this.status, indexModel.status)&& Objects.equals(this.additionalProperties, indexModel.additionalProperties); @@ -274,7 +349,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(name, dimension, metric, host, spec, status, additionalProperties); + return Objects.hash(name, dimension, metric, host, deletionProtection, spec, status, additionalProperties); } @Override @@ -285,6 +360,7 @@ public String toString() { sb.append(" dimension: ").append(toIndentedString(dimension)).append("\n"); sb.append(" metric: ").append(toIndentedString(metric)).append("\n"); sb.append(" host: ").append(toIndentedString(host)).append("\n"); + sb.append(" deletionProtection: ").append(toIndentedString(deletionProtection)).append("\n"); sb.append(" spec: ").append(toIndentedString(spec)).append("\n"); sb.append(" status: ").append(toIndentedString(status)).append("\n"); sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); @@ -314,6 +390,7 @@ private String toIndentedString(Object o) { openapiFields.add("dimension"); openapiFields.add("metric"); openapiFields.add("host"); + openapiFields.add("deletion_protection"); openapiFields.add("spec"); openapiFields.add("status"); @@ -350,6 +427,9 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti if (!jsonObj.get("name").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); } + if (!jsonObj.get("metric").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `metric` to be a primitive type in the JSON string but got `%s`", jsonObj.get("metric").toString())); + } if (!jsonObj.get("host").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `host` to be a primitive type in the JSON string but got `%s`", jsonObj.get("host").toString())); } diff --git a/src/main/java/org/openapitools/client/model/IndexModelSpec.java b/src/main/java/org/openapitools/control/client/model/IndexModelSpec.java similarity index 97% rename from src/main/java/org/openapitools/client/model/IndexModelSpec.java rename to src/main/java/org/openapitools/control/client/model/IndexModelSpec.java index 0044e4cd..cf098956 100644 --- a/src/main/java/org/openapitools/client/model/IndexModelSpec.java +++ b/src/main/java/org/openapitools/control/client/model/IndexModelSpec.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: v1 + * The version of the OpenAPI document: 2024-07 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -11,7 +11,7 @@ */ -package org.openapitools.client.model; +package org.openapitools.control.client.model; import java.util.Objects; import com.google.gson.TypeAdapter; @@ -21,8 +21,8 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; import java.util.Arrays; -import org.openapitools.client.model.PodSpec; -import org.openapitools.client.model.ServerlessSpec; +import org.openapitools.control.client.model.PodSpec; +import org.openapitools.control.client.model.ServerlessSpec; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -46,12 +46,12 @@ import java.util.Map; import java.util.Set; -import org.openapitools.client.JSON; +import org.openapitools.control.client.JSON; /** * IndexModelSpec */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-04-06T02:44:17.986783Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-16T15:28:37.412995Z[Etc/UTC]") public class IndexModelSpec { public static final String SERIALIZED_NAME_POD = "pod"; @SerializedName(SERIALIZED_NAME_POD) diff --git a/src/main/java/org/openapitools/client/model/IndexModelStatus.java b/src/main/java/org/openapitools/control/client/model/IndexModelStatus.java similarity index 98% rename from src/main/java/org/openapitools/client/model/IndexModelStatus.java rename to src/main/java/org/openapitools/control/client/model/IndexModelStatus.java index 6a721c7a..3bcc66d5 100644 --- a/src/main/java/org/openapitools/client/model/IndexModelStatus.java +++ b/src/main/java/org/openapitools/control/client/model/IndexModelStatus.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: v1 + * The version of the OpenAPI document: 2024-07 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -11,7 +11,7 @@ */ -package org.openapitools.client.model; +package org.openapitools.control.client.model; import java.util.Objects; import com.google.gson.TypeAdapter; @@ -44,12 +44,12 @@ import java.util.Map; import java.util.Set; -import org.openapitools.client.JSON; +import org.openapitools.control.client.JSON; /** * IndexModelStatus */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-04-06T02:44:17.986783Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-16T15:28:37.412995Z[Etc/UTC]") public class IndexModelStatus { public static final String SERIALIZED_NAME_READY = "ready"; @SerializedName(SERIALIZED_NAME_READY) diff --git a/src/main/java/org/openapitools/client/model/CreateIndexRequestSpec.java b/src/main/java/org/openapitools/control/client/model/IndexSpec.java similarity index 65% rename from src/main/java/org/openapitools/client/model/CreateIndexRequestSpec.java rename to src/main/java/org/openapitools/control/client/model/IndexSpec.java index 9bff78d2..5de50f80 100644 --- a/src/main/java/org/openapitools/client/model/CreateIndexRequestSpec.java +++ b/src/main/java/org/openapitools/control/client/model/IndexSpec.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: v1 + * The version of the OpenAPI document: 2024-07 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -11,7 +11,7 @@ */ -package org.openapitools.client.model; +package org.openapitools.control.client.model; import java.util.Objects; import com.google.gson.TypeAdapter; @@ -21,8 +21,8 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; import java.util.Arrays; -import org.openapitools.client.model.CreateIndexRequestSpecPod; -import org.openapitools.client.model.ServerlessSpec; +import org.openapitools.control.client.model.PodSpec; +import org.openapitools.control.client.model.ServerlessSpec; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -46,25 +46,25 @@ import java.util.Map; import java.util.Set; -import org.openapitools.client.JSON; +import org.openapitools.control.client.JSON; /** - * The spec object defines how the index should be deployed. For serverless indexes, you define only the cloud and region where the index should be hosted. For pod-based indexes, you define the environment where the index should be hosted, the pod type and size to use, and other index characteristics. Serverless indexes are in public preview and are available only on AWS in the us-west-2 and us-east-1 regions. Test thoroughly before using serverless indexes in production. + * The spec object defines how the index should be deployed. For serverless indexes, you define only the [cloud and region](http://docs.pinecone.io/guides/indexes/understanding-indexes#cloud-regions) where the index should be hosted. For pod-based indexes, you define the [environment](http://docs.pinecone.io/guides/indexes/understanding-indexes#pod-environments) where the index should be hosted, the [pod type and size](http://docs.pinecone.io/guides/indexes/understanding-indexes#pod-types) to use, and other index characteristics. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-04-06T02:44:17.986783Z[Etc/UTC]") -public class CreateIndexRequestSpec { +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-16T15:28:37.412995Z[Etc/UTC]") +public class IndexSpec { public static final String SERIALIZED_NAME_SERVERLESS = "serverless"; @SerializedName(SERIALIZED_NAME_SERVERLESS) private ServerlessSpec serverless; public static final String SERIALIZED_NAME_POD = "pod"; @SerializedName(SERIALIZED_NAME_POD) - private CreateIndexRequestSpecPod pod; + private PodSpec pod; - public CreateIndexRequestSpec() { + public IndexSpec() { } - public CreateIndexRequestSpec serverless(ServerlessSpec serverless) { + public IndexSpec serverless(ServerlessSpec serverless) { this.serverless = serverless; return this; @@ -85,7 +85,7 @@ public void setServerless(ServerlessSpec serverless) { } - public CreateIndexRequestSpec pod(CreateIndexRequestSpecPod pod) { + public IndexSpec pod(PodSpec pod) { this.pod = pod; return this; @@ -96,12 +96,12 @@ public CreateIndexRequestSpec pod(CreateIndexRequestSpecPod pod) { * @return pod **/ @javax.annotation.Nullable - public CreateIndexRequestSpecPod getPod() { + public PodSpec getPod() { return pod; } - public void setPod(CreateIndexRequestSpecPod pod) { + public void setPod(PodSpec pod) { this.pod = pod; } @@ -115,9 +115,9 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - CreateIndexRequestSpec createIndexRequestSpec = (CreateIndexRequestSpec) o; - return Objects.equals(this.serverless, createIndexRequestSpec.serverless) && - Objects.equals(this.pod, createIndexRequestSpec.pod); + IndexSpec indexSpec = (IndexSpec) o; + return Objects.equals(this.serverless, indexSpec.serverless) && + Objects.equals(this.pod, indexSpec.pod); } @Override @@ -128,7 +128,7 @@ public int hashCode() { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class CreateIndexRequestSpec {\n"); + sb.append("class IndexSpec {\n"); sb.append(" serverless: ").append(toIndentedString(serverless)).append("\n"); sb.append(" pod: ").append(toIndentedString(pod)).append("\n"); sb.append("}"); @@ -162,20 +162,20 @@ private String toIndentedString(Object o) { * Validates the JSON Element and throws an exception if issues found * * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to CreateIndexRequestSpec + * @throws IOException if the JSON Element is invalid with respect to IndexSpec */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { - if (!CreateIndexRequestSpec.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in CreateIndexRequestSpec is not found in the empty JSON string", CreateIndexRequestSpec.openapiRequiredFields.toString())); + if (!IndexSpec.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in IndexSpec is not found in the empty JSON string", IndexSpec.openapiRequiredFields.toString())); } } Set> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry entry : entries) { - if (!CreateIndexRequestSpec.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateIndexRequestSpec` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + if (!IndexSpec.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `IndexSpec` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); @@ -185,7 +185,7 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } // validate the optional field `pod` if (jsonObj.get("pod") != null && !jsonObj.get("pod").isJsonNull()) { - CreateIndexRequestSpecPod.validateJsonElement(jsonObj.get("pod")); + PodSpec.validateJsonElement(jsonObj.get("pod")); } } @@ -193,22 +193,22 @@ public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateIndexRequestSpec.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateIndexRequestSpec' and its subtypes + if (!IndexSpec.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'IndexSpec' and its subtypes } final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(CreateIndexRequestSpec.class)); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(IndexSpec.class)); - return (TypeAdapter) new TypeAdapter() { + return (TypeAdapter) new TypeAdapter() { @Override - public void write(JsonWriter out, CreateIndexRequestSpec value) throws IOException { + public void write(JsonWriter out, IndexSpec value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override - public CreateIndexRequestSpec read(JsonReader in) throws IOException { + public IndexSpec read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); @@ -219,18 +219,18 @@ public CreateIndexRequestSpec read(JsonReader in) throws IOException { } /** - * Create an instance of CreateIndexRequestSpec given an JSON string + * Create an instance of IndexSpec given an JSON string * * @param jsonString JSON string - * @return An instance of CreateIndexRequestSpec - * @throws IOException if the JSON string is invalid with respect to CreateIndexRequestSpec + * @return An instance of IndexSpec + * @throws IOException if the JSON string is invalid with respect to IndexSpec */ - public static CreateIndexRequestSpec fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateIndexRequestSpec.class); + public static IndexSpec fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, IndexSpec.class); } /** - * Convert an instance of CreateIndexRequestSpec to an JSON string + * Convert an instance of IndexSpec to an JSON string * * @return JSON string */ diff --git a/src/main/java/org/openapitools/client/model/PodSpec.java b/src/main/java/org/openapitools/control/client/model/PodSpec.java similarity index 98% rename from src/main/java/org/openapitools/client/model/PodSpec.java rename to src/main/java/org/openapitools/control/client/model/PodSpec.java index a7936a61..d2cf6d99 100644 --- a/src/main/java/org/openapitools/client/model/PodSpec.java +++ b/src/main/java/org/openapitools/control/client/model/PodSpec.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: v1 + * The version of the OpenAPI document: 2024-07 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -11,7 +11,7 @@ */ -package org.openapitools.client.model; +package org.openapitools.control.client.model; import java.util.Objects; import com.google.gson.TypeAdapter; @@ -21,7 +21,7 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; import java.util.Arrays; -import org.openapitools.client.model.PodSpecMetadataConfig; +import org.openapitools.control.client.model.PodSpecMetadataConfig; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -45,12 +45,12 @@ import java.util.Map; import java.util.Set; -import org.openapitools.client.JSON; +import org.openapitools.control.client.JSON; /** * Configuration needed to deploy a pod-based index. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-04-06T02:44:17.986783Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-16T15:28:37.412995Z[Etc/UTC]") public class PodSpec { public static final String SERIALIZED_NAME_ENVIRONMENT = "environment"; @SerializedName(SERIALIZED_NAME_ENVIRONMENT) diff --git a/src/main/java/org/openapitools/client/model/PodSpecMetadataConfig.java b/src/main/java/org/openapitools/control/client/model/PodSpecMetadataConfig.java similarity index 98% rename from src/main/java/org/openapitools/client/model/PodSpecMetadataConfig.java rename to src/main/java/org/openapitools/control/client/model/PodSpecMetadataConfig.java index 1d87deb2..560862a1 100644 --- a/src/main/java/org/openapitools/client/model/PodSpecMetadataConfig.java +++ b/src/main/java/org/openapitools/control/client/model/PodSpecMetadataConfig.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: v1 + * The version of the OpenAPI document: 2024-07 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -11,7 +11,7 @@ */ -package org.openapitools.client.model; +package org.openapitools.control.client.model; import java.util.Objects; import com.google.gson.TypeAdapter; @@ -46,12 +46,12 @@ import java.util.Map; import java.util.Set; -import org.openapitools.client.JSON; +import org.openapitools.control.client.JSON; /** * Configuration for the behavior of Pinecone's internal metadata index. By default, all metadata is indexed; when `metadata_config` is present, only specified metadata fields are indexed. These configurations are only valid for use with pod-based indexes. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-04-06T02:44:17.986783Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-16T15:28:37.412995Z[Etc/UTC]") public class PodSpecMetadataConfig { public static final String SERIALIZED_NAME_INDEXED = "indexed"; @SerializedName(SERIALIZED_NAME_INDEXED) diff --git a/src/main/java/org/openapitools/client/model/ServerlessSpec.java b/src/main/java/org/openapitools/control/client/model/ServerlessSpec.java similarity index 95% rename from src/main/java/org/openapitools/client/model/ServerlessSpec.java rename to src/main/java/org/openapitools/control/client/model/ServerlessSpec.java index c9e40248..60e39ddc 100644 --- a/src/main/java/org/openapitools/client/model/ServerlessSpec.java +++ b/src/main/java/org/openapitools/control/client/model/ServerlessSpec.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: v1 + * The version of the OpenAPI document: 2024-07 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -11,7 +11,7 @@ */ -package org.openapitools.client.model; +package org.openapitools.control.client.model; import java.util.Objects; import com.google.gson.TypeAdapter; @@ -44,15 +44,15 @@ import java.util.Map; import java.util.Set; -import org.openapitools.client.JSON; +import org.openapitools.control.client.JSON; /** * Configuration needed to deploy a serverless index. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-04-06T02:44:17.986783Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-07-16T15:28:37.412995Z[Etc/UTC]") public class ServerlessSpec { /** - * The public cloud where you would like your index hosted. Serverless indexes can be hosted only in AWS at this time. + * The public cloud where you would like your index hosted. */ @JsonAdapter(CloudEnum.Adapter.class) public enum CloudEnum { @@ -118,7 +118,7 @@ public ServerlessSpec cloud(CloudEnum cloud) { } /** - * The public cloud where you would like your index hosted. Serverless indexes can be hosted only in AWS at this time. + * The public cloud where you would like your index hosted. * @return cloud **/ @javax.annotation.Nonnull @@ -139,7 +139,7 @@ public ServerlessSpec region(String region) { } /** - * The region where you would like your index to be created. Serverless indexes can be created only in the us-west-2 and us-east-1 regions of AWS at this time. + * The region where you would like your index to be created. * @return region **/ @javax.annotation.Nonnull diff --git a/src/test/java/io/pinecone/PineconeBuilderTest.java b/src/test/java/io/pinecone/PineconeBuilderTest.java index 389f0d16..08729089 100644 --- a/src/test/java/io/pinecone/PineconeBuilderTest.java +++ b/src/test/java/io/pinecone/PineconeBuilderTest.java @@ -3,7 +3,7 @@ import io.pinecone.exceptions.PineconeConfigurationException; import io.pinecone.clients.Pinecone; import org.mockito.ArgumentCaptor; -import org.openapitools.client.model.*; +import org.openapitools.control.client.model.*; import okhttp3.*; import org.junit.jupiter.api.Test; import com.google.gson.Gson; diff --git a/src/test/java/io/pinecone/PineconeIndexOperationsTest.java b/src/test/java/io/pinecone/PineconeIndexOperationsTest.java index 6c88d5bd..b1e52ce2 100644 --- a/src/test/java/io/pinecone/PineconeIndexOperationsTest.java +++ b/src/test/java/io/pinecone/PineconeIndexOperationsTest.java @@ -6,7 +6,7 @@ import okhttp3.*; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; -import org.openapitools.client.model.*; +import org.openapitools.control.client.model.*; import java.io.IOException; import java.nio.file.Files; @@ -64,55 +64,55 @@ public void testCreateServerlessIndex() throws IOException { Pinecone client = new Pinecone.Builder("testAPiKey").withOkHttpClient(mockClient).build(); - client.createServerlessIndex("testServerlessIndex", "cosine", 3, "aws", "us-west-2"); + client.createServerlessIndex("testServerlessIndex", "cosine", 3, "aws", "us-west-2", DeletionProtection.DISABLED); verify(mockCall, times(1)).execute(); PineconeValidationException thrownEmptyIndexName = assertThrows(PineconeValidationException.class, - () -> client.createServerlessIndex("", "cosine", 3, "aws", "us-west-2")); + () -> client.createServerlessIndex("", "cosine", 3, "aws", "us-west-2", DeletionProtection.DISABLED)); assertEquals("Index name cannot be null or empty", thrownEmptyIndexName.getMessage()); PineconeValidationException thrownNullIndexName = assertThrows(PineconeValidationException.class, - () -> client.createServerlessIndex(null, "cosine", 3, "aws", "us-west-2")); + () -> client.createServerlessIndex(null, "cosine", 3, "aws", "us-west-2", DeletionProtection.DISABLED)); assertEquals("Index name cannot be null or empty", thrownNullIndexName.getMessage()); PineconeValidationException thrownEmptyMetric = assertThrows(PineconeValidationException.class, - () -> client.createServerlessIndex("testServerlessIndex", "", 3, "aws", "us-west-2")); - assertEquals("Metric cannot be null or empty. Must be one of " + Arrays.toString(IndexMetric.values()), thrownEmptyMetric.getMessage()); + () -> client.createServerlessIndex("testServerlessIndex", "", 3, "aws", "us-west-2", DeletionProtection.DISABLED)); + assertEquals("Metric cannot be null or empty. Must be one of " + Arrays.toString(IndexModel.MetricEnum.values()), thrownEmptyMetric.getMessage()); PineconeValidationException thrownInvalidMetric = assertThrows(PineconeValidationException.class, - () -> client.createServerlessIndex("testServerlessIndex", "blah", 3, "aws", "us-west-2")); - assertEquals(String.format("Metric cannot be null or empty. Must be one of " + Arrays.toString(IndexMetric.values())), thrownInvalidMetric.getMessage()); + () -> client.createServerlessIndex("testServerlessIndex", "blah", 3, "aws", "us-west-2", DeletionProtection.DISABLED)); + assertEquals(String.format("Metric cannot be null or empty. Must be one of " + Arrays.toString(IndexModel.MetricEnum.values())), thrownInvalidMetric.getMessage()); PineconeValidationException thrownNullMetric = assertThrows(PineconeValidationException.class, - () -> client.createServerlessIndex("testServerlessIndex", null, 3, "aws", "us-west-2")); - assertEquals("Metric cannot be null or empty. Must be one of " + Arrays.toString(IndexMetric.values()), + () -> client.createServerlessIndex("testServerlessIndex", null, 3, "aws", "us-west-2", DeletionProtection.DISABLED)); + assertEquals("Metric cannot be null or empty. Must be one of " + Arrays.toString(IndexModel.MetricEnum.values()), thrownNullMetric.getMessage()); PineconeValidationException thrownNegativeDimension = assertThrows(PineconeValidationException.class, - () -> client.createServerlessIndex("testServerlessIndex", "cosine", -3, "aws", "us-west-2")); + () -> client.createServerlessIndex("testServerlessIndex", "cosine", -3, "aws", "us-west-2", DeletionProtection.DISABLED)); assertEquals("Dimension must be greater than 0. See limits for more info: https://docs.pinecone.io/reference/limits", thrownNegativeDimension.getMessage()); PineconeValidationException thrownEmptyCloud = assertThrows(PineconeValidationException.class, - () -> client.createServerlessIndex("testServerlessIndex", "cosine", 3, "", "us-west-2")); + () -> client.createServerlessIndex("testServerlessIndex", "cosine", 3, "", "us-west-2", DeletionProtection.DISABLED)); assertEquals("Cloud cannot be null or empty. Must be one of " + Arrays.toString(ServerlessSpec.CloudEnum.values()), thrownEmptyCloud.getMessage()); PineconeValidationException thrownNullCloud = assertThrows(PineconeValidationException.class, - () -> client.createServerlessIndex("testServerlessIndex", "cosine", 3, null, "us-west-2")); + () -> client.createServerlessIndex("testServerlessIndex", "cosine", 3, null, "us-west-2", DeletionProtection.DISABLED)); assertEquals("Cloud cannot be null or empty. Must be one of " + Arrays.toString(ServerlessSpec.CloudEnum.values()), thrownNullCloud.getMessage()); PineconeValidationException thrownInvalidCloud = assertThrows(PineconeValidationException.class, - () -> client.createServerlessIndex("testServerlessIndex", "cosine", 3, "wooooo", "us-west-2")); + () -> client.createServerlessIndex("testServerlessIndex", "cosine", 3, "wooooo", "us-west-2", DeletionProtection.DISABLED)); assertEquals("Cloud cannot be null or empty. Must be one of " + Arrays.toString(ServerlessSpec.CloudEnum.values()), thrownInvalidCloud.getMessage()); PineconeValidationException thrownEmptyRegion = assertThrows(PineconeValidationException.class, - () -> client.createServerlessIndex("testServerlessIndex", "cosine", 3, "aws", "")); + () -> client.createServerlessIndex("testServerlessIndex", "cosine", 3, "aws", "", DeletionProtection.DISABLED)); assertEquals("Region cannot be null or empty", thrownEmptyRegion.getMessage()); PineconeValidationException thrownNullRegion = assertThrows(PineconeValidationException.class, - () -> client.createServerlessIndex("testServerlessIndex", "cosine", 3, "aws", null)); + () -> client.createServerlessIndex("testServerlessIndex", "cosine", 3, "aws", null, DeletionProtection.DISABLED)); assertEquals("Region cannot be null or empty", thrownNullRegion.getMessage()); } @@ -143,8 +143,9 @@ public void testCreatePodsIndex() throws IOException { 2, 1, 2, - new CreateIndexRequestSpecPodMetadataConfig(), - "some-source-collection"); + new PodSpecMetadataConfig(), + "some-source-collection", + DeletionProtection.DISABLED); ArgumentCaptor requestCaptor = ArgumentCaptor.forClass(Request.class); @@ -213,7 +214,7 @@ public void testValidatePodIndexParams() { () -> Pinecone.validatePodIndexParams("test-index", 3, "some-environment", "p1.x1", "", null, null, null)); - assertEquals("Metric cannot be null or empty. Must be one of " + Arrays.toString(IndexMetric.values()), thrownEmptyMetric.getMessage()); + assertEquals("Metric cannot be null or empty. Must be one of " + Arrays.toString(IndexModel.MetricEnum.values()), thrownEmptyMetric.getMessage()); // Replicas PineconeValidationException thrownNegativeReplicas = assertThrows(PineconeValidationException.class, @@ -328,25 +329,25 @@ public void testConfigureIndex() throws IOException { OkHttpClient mockClient = mock(OkHttpClient.class); when(mockClient.newCall(any(Request.class))).thenReturn(mockCall); Pinecone client = new Pinecone.Builder("testAPiKey").withOkHttpClient(mockClient).build(); - IndexModel configuredIndex = client.configureIndex("testPodIndex", 3); + IndexModel configuredIndex = client.configurePodsIndex("testPodIndex", 3, DeletionProtection.DISABLED); verify(mockCall, times(1)).execute(); assertEquals(expectedConfiguredIndex, configuredIndex); // Test for empty string for index name PineconeValidationException thrownEmptyIndexName = assertThrows(PineconeValidationException.class, - () -> client.configureIndex("", - 3)); + () -> client.configurePodsIndex("", + 3, DeletionProtection.DISABLED)); assertEquals("indexName cannot be null or empty", thrownEmptyIndexName.getMessage()); // Test for null as index name - PineconeValidationException thrownNullIndexName = assertThrows(PineconeValidationException.class, () -> client.configureIndex(null, - 3)); + PineconeValidationException thrownNullIndexName = assertThrows(PineconeValidationException.class, () -> client.configurePodsIndex(null, + 3, DeletionProtection.DISABLED)); assertEquals("indexName cannot be null or empty", thrownNullIndexName.getMessage()); // Test for invalid number of replicas PineconeValidationException thrownZeroReplicas = assertThrows(PineconeValidationException.class, - () -> client.configureIndex("testPodIndex", 0)); + () -> client.configurePodsIndex("testPodIndex", 0, DeletionProtection.DISABLED)); assertEquals("Number of replicas must be >= 1", thrownZeroReplicas.getMessage()); } diff --git a/src/test/java/io/pinecone/clients/ConnectionsMapTest.java b/src/test/java/io/pinecone/clients/ConnectionsMapTest.java index 8ac26988..eef8560a 100644 --- a/src/test/java/io/pinecone/clients/ConnectionsMapTest.java +++ b/src/test/java/io/pinecone/clients/ConnectionsMapTest.java @@ -4,9 +4,9 @@ import io.pinecone.configs.PineconeConnection; import org.junit.jupiter.api.Test; import org.mockito.Mockito; -import org.openapitools.client.ApiException; -import org.openapitools.client.api.ManageIndexesApi; -import org.openapitools.client.model.IndexModel; +import org.openapitools.control.client.ApiException; +import org.openapitools.control.client.api.ManageIndexesApi; +import org.openapitools.control.client.model.IndexModel; import java.util.concurrent.ConcurrentHashMap; diff --git a/src/test/java/org/openapitools/client/JsonParsingTest.java b/src/test/java/org/openapitools/client/JsonParsingTest.java index 034b6491..a644a11e 100644 --- a/src/test/java/org/openapitools/client/JsonParsingTest.java +++ b/src/test/java/org/openapitools/client/JsonParsingTest.java @@ -3,8 +3,9 @@ import okhttp3.*; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.openapitools.client.api.ManageIndexesApi; -import org.openapitools.client.model.*; +import org.openapitools.control.client.api.ManageIndexesApi; +import org.openapitools.control.client.model.*; +import org.openapitools.control.client.ApiClient; import java.io.IOException; import java.nio.charset.StandardCharsets; @@ -79,8 +80,8 @@ public void test_createIndex_happyPath() throws Exception { CreateIndexRequest createIndexRequest = new CreateIndexRequest(); createIndexRequest.setName("test-index"); createIndexRequest.setDimension(1536); - createIndexRequest.setMetric(IndexMetric.COSINE); - createIndexRequest.setSpec(new CreateIndexRequestSpec()); + createIndexRequest.setMetric(CreateIndexRequest.MetricEnum.COSINE); + createIndexRequest.setSpec(new IndexSpec()); IndexModel indexModel = api.createIndex(createIndexRequest); assertEquals("serverless-index", indexModel.getName()); @@ -95,8 +96,8 @@ public void test_createIndex_extraProperties() throws Exception { CreateIndexRequest createIndexRequest = new CreateIndexRequest(); createIndexRequest.setName("test-index"); createIndexRequest.setDimension(1536); - createIndexRequest.setMetric(IndexMetric.COSINE); - createIndexRequest.setSpec(new CreateIndexRequestSpec()); + createIndexRequest.setMetric(CreateIndexRequest.MetricEnum.COSINE); + createIndexRequest.setSpec(new IndexSpec()); IndexModel indexModel = api.createIndex(createIndexRequest); assertEquals("serverless-index", indexModel.getName());