Class DocumentsClient (2.23.0-rc)

Service for managing knowledge Documents.

Equality

Instances of this class created via copy-construction or copy-assignment always compare equal. Instances created with equal std::shared_ptr<*Connection> objects compare equal. Objects that compare equal share the same underlying resources.

Performance

Creating a new instance of this class is a relatively expensive operation, new objects establish new connections to the service. In contrast, copy-construction, move-construction, and the corresponding assignment operations are relatively efficient as the copies share all underlying resources.

Thread Safety

Concurrent access to different instances of this class, even if they compare equal, is guaranteed to work. Two or more threads operating on the same instance of this class is not guaranteed to work. Since copy-construction and move-construction is a relatively efficient operation, consider using such a copy when using this class from multiple threads.

Constructors

DocumentsClient(DocumentsClient const &)

Copy and move support

Parameter
NameDescription
DocumentsClient const &

DocumentsClient(DocumentsClient &&)

Copy and move support

Parameter
NameDescription
DocumentsClient &&

DocumentsClient(std::shared_ptr< DocumentsConnection >, Options)

Parameters
NameDescription
connection std::shared_ptr< DocumentsConnection >
opts Options

Operators

operator=(DocumentsClient const &)

Copy and move support

Parameter
NameDescription
DocumentsClient const &
Returns
TypeDescription
DocumentsClient &

operator=(DocumentsClient &&)

Copy and move support

Parameter
NameDescription
DocumentsClient &&
Returns
TypeDescription
DocumentsClient &

Functions

ListDocuments(std::string const &, Options)

Returns the list of all documents of the knowledge base.

Parameters
NameDescription
parent std::string const &

Required. The knowledge base to list all documents for. Format: projects/<ProjectID>/locations/<LocationID>/knowledgeBases/<Knowledge Base ID>.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
TypeDescription
StreamRange< google::cloud::dialogflow::v2::Document >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.dialogflow.v2.Document, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

ListDocuments(google::cloud::dialogflow::v2::ListDocumentsRequest, Options)

Returns the list of all documents of the knowledge base.

Parameters
NameDescription
request google::cloud::dialogflow::v2::ListDocumentsRequest

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.dialogflow.v2.ListDocumentsRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
TypeDescription
StreamRange< google::cloud::dialogflow::v2::Document >

a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has begin() and end() member functions returning a iterator class meeting the input iterator requirements. The value type for this iterator is a StatusOr as the iteration may fail even after some values are retrieved successfully, for example, if there is a network disconnect. An empty set of results does not indicate an error, it indicates that there are no resources meeting the request criteria. On a successful iteration the StatusOr<T> contains elements of type google.cloud.dialogflow.v2.Document, or rather, the C++ class generated by Protobuf from that type. Please consult the Protobuf documentation for details on the Protobuf mapping rules.

GetDocument(std::string const &, Options)

Retrieves the specified document.

Parameters
NameDescription
name std::string const &

Required. The name of the document to retrieve. Format projects/<ProjectID>/locations/<LocationID>/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
TypeDescription
StatusOr< google::cloud::dialogflow::v2::Document >

the result of the RPC. The response message type (google.cloud.dialogflow.v2.Document) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

GetDocument(google::cloud::dialogflow::v2::GetDocumentRequest const &, Options)

Retrieves the specified document.

Parameters
NameDescription
request google::cloud::dialogflow::v2::GetDocumentRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.dialogflow.v2.GetDocumentRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
TypeDescription
StatusOr< google::cloud::dialogflow::v2::Document >

the result of the RPC. The response message type (google.cloud.dialogflow.v2.Document) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the StatusOr contains the error details.

CreateDocument(std::string const &, google::cloud::dialogflow::v2::Document const &, Options)

Creates a new document.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

Parameters
NameDescription
parent std::string const &

Required. The knowledge base to create a document for. Format: projects/<ProjectID>/locations/<LocationID>/knowledgeBases/<Knowledge Base ID>.

document google::cloud::dialogflow::v2::Document const &

Required. The document to create.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
TypeDescription
future< StatusOr< google::cloud::dialogflow::v2::Document > >

A future that becomes satisfied when the LRO (Long Running Operation) completes or the polling policy in effect for this call is exhausted. The future is satisfied with an error if the LRO completes with an error or the polling policy is exhausted. In this case the StatusOr returned by the future contains the error. If the LRO completes successfully the value of the future contains the LRO's result. For this RPC the result is a google.cloud.dialogflow.v2.Document proto message. The C++ class representing this message is created by Protobuf, using the Protobuf mapping rules.

CreateDocument(google::cloud::dialogflow::v2::CreateDocumentRequest const &, Options)

Creates a new document.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

Parameters
NameDescription
request google::cloud::dialogflow::v2::CreateDocumentRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.dialogflow.v2.CreateDocumentRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
TypeDescription
future< StatusOr< google::cloud::dialogflow::v2::Document > >

A future that becomes satisfied when the LRO (Long Running Operation) completes or the polling policy in effect for this call is exhausted. The future is satisfied with an error if the LRO completes with an error or the polling policy is exhausted. In this case the StatusOr returned by the future contains the error. If the LRO completes successfully the value of the future contains the LRO's result. For this RPC the result is a google.cloud.dialogflow.v2.Document proto message. The C++ class representing this message is created by Protobuf, using the Protobuf mapping rules.

ImportDocuments(google::cloud::dialogflow::v2::ImportDocumentsRequest const &, Options)

Creates documents by importing data from external sources.

Dialogflow supports up to 350 documents in each request. If you try to import more, Dialogflow will return an error.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

Parameters
NameDescription
request google::cloud::dialogflow::v2::ImportDocumentsRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.dialogflow.v2.ImportDocumentsRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
TypeDescription
future< StatusOr< google::cloud::dialogflow::v2::ImportDocumentsResponse > >

A future that becomes satisfied when the LRO (Long Running Operation) completes or the polling policy in effect for this call is exhausted. The future is satisfied with an error if the LRO completes with an error or the polling policy is exhausted. In this case the StatusOr returned by the future contains the error. If the LRO completes successfully the value of the future contains the LRO's result. For this RPC the result is a google.cloud.dialogflow.v2.ImportDocumentsResponse proto message. The C++ class representing this message is created by Protobuf, using the Protobuf mapping rules.

DeleteDocument(std::string const &, Options)

Deletes the specified document.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

Parameters
NameDescription
name std::string const &

Required. The name of the document to delete. Format: projects/<ProjectID>/locations/<LocationID>/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
TypeDescription
future< StatusOr< google::cloud::dialogflow::v2::KnowledgeOperationMetadata > >

A future that becomes satisfied when the LRO (Long Running Operation) completes or the polling policy in effect for this call is exhausted. The future is satisfied with an error if the LRO completes with an error or the polling policy is exhausted. In this case the StatusOr returned by the future contains the error. If the LRO completes successfully the value of the future contains the LRO's result. For this RPC the result is a google.cloud.dialogflow.v2.KnowledgeOperationMetadata proto message. The C++ class representing this message is created by Protobuf, using the Protobuf mapping rules.

DeleteDocument(google::cloud::dialogflow::v2::DeleteDocumentRequest const &, Options)

Deletes the specified document.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

Parameters
NameDescription
request google::cloud::dialogflow::v2::DeleteDocumentRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.dialogflow.v2.DeleteDocumentRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
TypeDescription
future< StatusOr< google::cloud::dialogflow::v2::KnowledgeOperationMetadata > >

A future that becomes satisfied when the LRO (Long Running Operation) completes or the polling policy in effect for this call is exhausted. The future is satisfied with an error if the LRO completes with an error or the polling policy is exhausted. In this case the StatusOr returned by the future contains the error. If the LRO completes successfully the value of the future contains the LRO's result. For this RPC the result is a google.cloud.dialogflow.v2.KnowledgeOperationMetadata proto message. The C++ class representing this message is created by Protobuf, using the Protobuf mapping rules.

UpdateDocument(google::cloud::dialogflow::v2::Document const &, google::protobuf::FieldMask const &, Options)

Updates the specified document.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

Parameters
NameDescription
document google::cloud::dialogflow::v2::Document const &

Required. The document to update.

update_mask google::protobuf::FieldMask const &

Optional. Not specified means update all. Currently, only display_name can be updated, an InvalidArgument will be returned for attempting to update other fields.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
TypeDescription
future< StatusOr< google::cloud::dialogflow::v2::Document > >

A future that becomes satisfied when the LRO (Long Running Operation) completes or the polling policy in effect for this call is exhausted. The future is satisfied with an error if the LRO completes with an error or the polling policy is exhausted. In this case the StatusOr returned by the future contains the error. If the LRO completes successfully the value of the future contains the LRO's result. For this RPC the result is a google.cloud.dialogflow.v2.Document proto message. The C++ class representing this message is created by Protobuf, using the Protobuf mapping rules.

UpdateDocument(google::cloud::dialogflow::v2::UpdateDocumentRequest const &, Options)

Updates the specified document.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

Parameters
NameDescription
request google::cloud::dialogflow::v2::UpdateDocumentRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.dialogflow.v2.UpdateDocumentRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
TypeDescription
future< StatusOr< google::cloud::dialogflow::v2::Document > >

A future that becomes satisfied when the LRO (Long Running Operation) completes or the polling policy in effect for this call is exhausted. The future is satisfied with an error if the LRO completes with an error or the polling policy is exhausted. In this case the StatusOr returned by the future contains the error. If the LRO completes successfully the value of the future contains the LRO's result. For this RPC the result is a google.cloud.dialogflow.v2.Document proto message. The C++ class representing this message is created by Protobuf, using the Protobuf mapping rules.

ReloadDocument(std::string const &, std::string const &, Options)

Reloads the specified document from its specified source, content_uri or content.

The previously loaded content of the document will be deleted. Note: Even when the content of the document has not changed, there still may be side effects because of internal implementation changes.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

Note: The projects.agent.knowledgeBases.documents resource is deprecated; only use projects.knowledgeBases.documents.

Parameters
NameDescription
name std::string const &

Required. The name of the document to reload. Format: projects/<ProjectID>/locations/<LocationID>/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>

content_uri std::string const &

Optional. The path of gcs source file for reloading document content. For now, only gcs uri is supported.
For documents stored in Google Cloud Storage, these URIs must have the form gs://<bucket-name>/<object-name>.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
TypeDescription
future< StatusOr< google::cloud::dialogflow::v2::Document > >

A future that becomes satisfied when the LRO (Long Running Operation) completes or the polling policy in effect for this call is exhausted. The future is satisfied with an error if the LRO completes with an error or the polling policy is exhausted. In this case the StatusOr returned by the future contains the error. If the LRO completes successfully the value of the future contains the LRO's result. For this RPC the result is a google.cloud.dialogflow.v2.Document proto message. The C++ class representing this message is created by Protobuf, using the Protobuf mapping rules.

ReloadDocument(google::cloud::dialogflow::v2::ReloadDocumentRequest const &, Options)

Reloads the specified document from its specified source, content_uri or content.

The previously loaded content of the document will be deleted. Note: Even when the content of the document has not changed, there still may be side effects because of internal implementation changes.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

Note: The projects.agent.knowledgeBases.documents resource is deprecated; only use projects.knowledgeBases.documents.

Parameters
NameDescription
request google::cloud::dialogflow::v2::ReloadDocumentRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.dialogflow.v2.ReloadDocumentRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
TypeDescription
future< StatusOr< google::cloud::dialogflow::v2::Document > >

A future that becomes satisfied when the LRO (Long Running Operation) completes or the polling policy in effect for this call is exhausted. The future is satisfied with an error if the LRO completes with an error or the polling policy is exhausted. In this case the StatusOr returned by the future contains the error. If the LRO completes successfully the value of the future contains the LRO's result. For this RPC the result is a google.cloud.dialogflow.v2.Document proto message. The C++ class representing this message is created by Protobuf, using the Protobuf mapping rules.

ExportDocument(google::cloud::dialogflow::v2::ExportDocumentRequest const &, Options)

Exports a smart messaging candidate document into the specified destination.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

Parameters
NameDescription
request google::cloud::dialogflow::v2::ExportDocumentRequest const &

Unary RPCs, such as the one wrapped by this function, receive a single request proto message which includes all the inputs for the RPC. In this case, the proto message is a google.cloud.dialogflow.v2.ExportDocumentRequest. Proto messages are converted to C++ classes by Protobuf, using the Protobuf mapping rules.

opts Options

Optional. Override the class-level options, such as retry and backoff policies.

Returns
TypeDescription
future< StatusOr< google::cloud::dialogflow::v2::Document > >

A future that becomes satisfied when the LRO (Long Running Operation) completes or the polling policy in effect for this call is exhausted. The future is satisfied with an error if the LRO completes with an error or the polling policy is exhausted. In this case the StatusOr returned by the future contains the error. If the LRO completes successfully the value of the future contains the LRO's result. For this RPC the result is a google.cloud.dialogflow.v2.Document proto message. The C++ class representing this message is created by Protobuf, using the Protobuf mapping rules.