diff --git a/README.md b/README.md index 2e6b531..782038a 100644 --- a/README.md +++ b/README.md @@ -336,6 +336,20 @@ if($response->successful()) { } ``` +### List Vectors + +[Pinecone Docs](https://docs.pinecone.io/reference/api/2025-01/data-plane/list) + +```php +$response = $pinecone->data()->vectors()->list( + 'vector_' +); + +if($response->successful()) { + // +} +``` + ## Testing Testing is done via PestPHP. You can run the tests by running `./vendor/bin/pest` in the root of the project. diff --git a/src/Requests/Data/ListVectors.php b/src/Requests/Data/ListVectors.php new file mode 100644 index 0000000..2679505 --- /dev/null +++ b/src/Requests/Data/ListVectors.php @@ -0,0 +1,47 @@ + $this->prefix + ]; + + if ($this->namespace) { + $payload['namespace'] = $this->namespace; + } + + return $payload; + } + + public function resolveEndpoint(): string + { + return '/vectors/list'; + } + + public function hasRequestFailed(Response $response): ?bool + { + return $response->status() !== 200; + } +} \ No newline at end of file diff --git a/src/Resources/Data/VectorResource.php b/src/Resources/Data/VectorResource.php index 9fc63fb..c7129fb 100644 --- a/src/Resources/Data/VectorResource.php +++ b/src/Resources/Data/VectorResource.php @@ -83,4 +83,12 @@ public function fetch(array $ids, ?string $namespace = null): Response namespace: $namespace )); } + + public function list(string $prefix, ?string $namespace = null): Response + { + return $this->connector->send(new Data\ListVectors( + prefix: $prefix, + namespace: $namespace + )); + } } \ No newline at end of file