pub struct DocumentService { /* private fields */ }document-service only.Expand description
Implements a client for the Discovery Engine API.
§Example
use google_cloud_gax::paginator::ItemPaginator as _;
let client = DocumentService::builder().build().await?;
let parent = "parent_value";
let mut list = client.list_documents()
.set_parent(parent)
.by_item();
while let Some(item) = list.next().await.transpose()? {
println!("{:?}", item);
}§Service Description
Service for ingesting Document information of the customer’s website.
§Configuration
To configure DocumentService use the with_* methods in the type returned
by builder(). The default configuration should
work for most applications. Common configuration changes include
- with_endpoint(): by default this client uses the global default endpoint
(
https://discoveryengine.googleapis.com). Applications using regional endpoints or running in restricted networks (e.g. a network configured override this default. - with_credentials(): by default this client uses Application Default Credentials. Applications using custom authentication may need to override this default.
§Pooling and Cloning
DocumentService holds a connection pool internally, it is advised to
create one and reuse it. You do not need to wrap DocumentService in
an Rc or Arc to reuse it, because it
already uses an Arc internally.
Implementations§
Source§impl DocumentService
impl DocumentService
Sourcepub fn builder() -> ClientBuilder
pub fn builder() -> ClientBuilder
Returns a builder for DocumentService.
let client = DocumentService::builder().build().await?;Sourcepub fn from_stub<T>(stub: T) -> Selfwhere
T: DocumentService + 'static,
pub fn from_stub<T>(stub: T) -> Selfwhere
T: DocumentService + 'static,
Creates a new client from the provided stub.
The most common case for calling this function is in tests mocking the client’s behavior.
Sourcepub fn get_document(&self) -> GetDocument
pub fn get_document(&self) -> GetDocument
Sourcepub fn list_documents(&self) -> ListDocuments
pub fn list_documents(&self) -> ListDocuments
Gets a list of Documents.
§Example
use google_cloud_gax::paginator::ItemPaginator as _;
use google_cloud_discoveryengine_v1::Result;
async fn sample(
client: &DocumentService, parent: &str
) -> Result<()> {
let mut list = client.list_documents()
.set_parent(parent)
.by_item();
while let Some(item) = list.next().await.transpose()? {
println!("{:?}", item);
}
Ok(())
}Sourcepub fn create_document(&self) -> CreateDocument
pub fn create_document(&self) -> CreateDocument
Creates a Document.
§Example
use google_cloud_discoveryengine_v1::model::Document;
use google_cloud_discoveryengine_v1::Result;
async fn sample(
client: &DocumentService, parent: &str
) -> Result<()> {
let response = client.create_document()
.set_parent(parent)
.set_document_id("document_id_value")
.set_document(
Document::new()/* set fields */
)
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn update_document(&self) -> UpdateDocument
pub fn update_document(&self) -> UpdateDocument
Updates a Document.
§Example
use google_cloud_wkt::FieldMask;
use google_cloud_discoveryengine_v1::model::Document;
use google_cloud_discoveryengine_v1::Result;
async fn sample(
client: &DocumentService, name: &str
) -> Result<()> {
let response = client.update_document()
.set_document(
Document::new().set_name(name)/* set fields */
)
.set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn delete_document(&self) -> DeleteDocument
pub fn delete_document(&self) -> DeleteDocument
Sourcepub fn import_documents(&self) -> ImportDocuments
pub fn import_documents(&self) -> ImportDocuments
Bulk import of multiple Documents. Request processing may be synchronous. Non-existing items are created.
Note: It is possible for a subset of the Documents to be successfully updated.
§Long running operations
This method is used to start, and/or poll a long-running Operation. The Working with long-running operations chapter in the user guide covers these operations in detail.
§Example
use google_cloud_lro::Poller;
use google_cloud_discoveryengine_v1::Result;
async fn sample(
client: &DocumentService
) -> Result<()> {
let response = client.import_documents()
/* set fields */
.poller().until_done().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn purge_documents(&self) -> PurgeDocuments
pub fn purge_documents(&self) -> PurgeDocuments
Permanently deletes all selected Documents in a branch.
This process is asynchronous. Depending on the number of Documents to be deleted, this operation can take hours to complete. Before the delete operation completes, some Documents might still be returned by DocumentService.GetDocument or DocumentService.ListDocuments.
To get a list of the Documents to be deleted, set PurgeDocumentsRequest.force to false.
§Long running operations
This method is used to start, and/or poll a long-running Operation. The Working with long-running operations chapter in the user guide covers these operations in detail.
§Example
use google_cloud_lro::Poller;
use google_cloud_discoveryengine_v1::Result;
async fn sample(
client: &DocumentService
) -> Result<()> {
let response = client.purge_documents()
/* set fields */
.poller().until_done().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn batch_get_documents_metadata(&self) -> BatchGetDocumentsMetadata
pub fn batch_get_documents_metadata(&self) -> BatchGetDocumentsMetadata
Gets index freshness metadata for Documents. Supported for website search only.
§Example
use google_cloud_discoveryengine_v1::Result;
async fn sample(
client: &DocumentService
) -> Result<()> {
let response = client.batch_get_documents_metadata()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn list_operations(&self) -> ListOperations
pub fn list_operations(&self) -> ListOperations
Provides the Operations service functionality in this service.
§Example
use google_cloud_gax::paginator::ItemPaginator as _;
use google_cloud_discoveryengine_v1::Result;
async fn sample(
client: &DocumentService
) -> Result<()> {
let mut list = client.list_operations()
/* set fields */
.by_item();
while let Some(item) = list.next().await.transpose()? {
println!("{:?}", item);
}
Ok(())
}Sourcepub fn get_operation(&self) -> GetOperation
pub fn get_operation(&self) -> GetOperation
Provides the Operations service functionality in this service.
§Example
use google_cloud_discoveryengine_v1::Result;
async fn sample(
client: &DocumentService
) -> Result<()> {
let response = client.get_operation()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn cancel_operation(&self) -> CancelOperation
pub fn cancel_operation(&self) -> CancelOperation
Provides the Operations service functionality in this service.
§Example
use google_cloud_discoveryengine_v1::Result;
async fn sample(
client: &DocumentService
) -> Result<()> {
client.cancel_operation()
/* set fields */
.send().await?;
Ok(())
}Trait Implementations§
Source§impl Clone for DocumentService
impl Clone for DocumentService
Source§fn clone(&self) -> DocumentService
fn clone(&self) -> DocumentService
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more