pub struct Client { /* private fields */ }
Expand description
An (authenticated) handle to talk with Pinecone. This is where you first go when you need a connection. Specific method descriptions and details can be refered to at Pinecone.
Implementations§
Source§impl Client
impl Client
Sourcepub async fn new<D>(api_key: D, environment: D) -> Result<Client>
pub async fn new<D>(api_key: D, environment: D) -> Result<Client>
Attempts to validate credentials and return a Client
.
If validated it will generate a ClientInfo
which holds the required information
for valid requests.
Sourcepub fn info(&self) -> &ClientInfo
pub fn info(&self) -> &ClientInfo
Returns the ClientInfo
generated during on the Client::new
call.
Sourcepub async fn list_indexes(&self) -> Result<Vec<String>>
pub async fn list_indexes(&self) -> Result<Vec<String>>
Will list all the indexes associated with the given instance of Client
.
Sourcepub async fn list_collections(&self) -> Result<Vec<String>>
pub async fn list_collections(&self) -> Result<Vec<String>>
Lists all the collections associated with the given instance Client
.
Sourcepub async fn create_collection(
&self,
name: impl Into<String>,
source_index: impl AsRef<str>,
) -> Result<String>
pub async fn create_collection( &self, name: impl Into<String>, source_index: impl AsRef<str>, ) -> Result<String>
Creates a new collection.
For more information on Collections vist Pinecone.
Sourcepub async fn describe_collection(
&self,
name: impl AsRef<str>,
) -> Result<CollectionDescription>
pub async fn describe_collection( &self, name: impl AsRef<str>, ) -> Result<CollectionDescription>
Attempts to get a description of a collection.
§Error
This function will error if the collection does not exist
Sourcepub async fn delete_collection(&self, name: impl AsRef<str>) -> Result<String>
pub async fn delete_collection(&self, name: impl AsRef<str>) -> Result<String>
Deletes a given collection.
Sourcepub async fn create_index(&self, data: IndexCreateRequest) -> Result<String>
pub async fn create_index(&self, data: IndexCreateRequest) -> Result<String>
Creates a collection.
The index create operation will take time even after the response is StatusCode::CREATED
and index
operations will not function until this is the case. If creating an index ensure that you
add a resonable delay.
This will error with status code 409 StatusCode::CONFLICT
if the name already exists.
This should be checked for if you’re trying to validate if a given index exists before
doing operations.
Sourcepub fn index(&self, name: impl Into<String>) -> Index
pub fn index(&self, name: impl Into<String>) -> Index
Creates and returns an Index object that can be used to run index specific operations, it
is the primary way you interface with the Index Api. The index created will not be a
validated index and therefor should be validated using the Index::describe
method.