# Dialogflow V2 API - Class Google::Cloud::Dialogflow::V2::Documents::Rest::Client (v1.16.1)

1.16.1 (latest) 1.16.0 1.15.0 1.14.0 1.13.0 1.12.1 1.11.0 1.10.1 1.9.1 1.8.0 1.7.0 1.6.0 1.5.0 1.4.1 1.3.0 1.2.0 1.1.1 1.0.0 0.34.0 0.33.0 0.32.2 0.31.0 0.30.0 0.29.0 0.28.0 0.27.0 0.26.2 0.25.0 0.24.0 0.23.0 0.22.0 0.21.0 0.20.0 0.19.0 0.18.0 0.17.1 0.16.0 0.15.2 0.14.0 0.13.0 0.12.0 Reference documentation and code samples for the Dialogflow V2 API class Google::Cloud::Dialogflow::V2::Documents::Rest::Client.

REST client for the Documents service.


<br />

Service for managing knowledge
[Documents](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-Document "Google::Cloud::Dialogflow::V2::Document (class)").

## Inherits

- Object

## Includes

- [Google::Cloud::Dialogflow::V2::Documents::Paths](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-Documents-Paths)

## Methods

### .configure

    def self.configure() { |config| ... } -> Client::Configuration

Configure the Documents Client class.


<br />

See [Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-Documents-Rest-Client-Configuration "Google::Cloud::Dialogflow::V2::Documents::Rest::Client::Configuration (class)")
for a description of the configuration fields.
**Yields**

- (config) --- Configure the Client client.
**Yield Parameter**

- **config** ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-Documents-Rest-Client-Configuration))
**Returns**

- ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-Documents-Rest-Client-Configuration))
**Example**

```ruby
# Modify the configuration for all Documents clients
::Google::Cloud::Dialogflow::V2::Documents::Rest::Client.configure do |config|
  config.timeout = 10.0
end
```

### #configure

    def configure() { |config| ... } -> Client::Configuration

Configure the Documents Client instance.


The configuration is set to the derived mode, meaning that values can be changed,
but structural changes (adding new fields, etc.) are not allowed. Structural changes
should be made on [Client.configure](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-Documents-Rest-Client#Google__Cloud__Dialogflow__V2__Documents__Rest__Client_configure_class_ "Google::Cloud::Dialogflow::V2::Documents::Rest::Client.configure (method)").

<br />

See [Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-Documents-Rest-Client-Configuration "Google::Cloud::Dialogflow::V2::Documents::Rest::Client::Configuration (class)")
for a description of the configuration fields.
**Yields**

- (config) --- Configure the Client client.
**Yield Parameter**

- **config** ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-Documents-Rest-Client-Configuration))
**Returns**

- ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-Documents-Rest-Client-Configuration))

### #create_document

    def create_document(request, options = nil) -> ::Gapic::Operation
    def create_document(parent: nil, document: nil) -> ::Gapic::Operation

Creates a new document.

This method is a [long-running
operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
The returned `Operation` type has the following method-specific fields:

- `metadata`: [KnowledgeOperationMetadata](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-KnowledgeOperationMetadata "Google::Cloud::Dialogflow::V2::KnowledgeOperationMetadata (class)")
- `response`: [Document](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-Document "Google::Cloud::Dialogflow::V2::Document (class)")
**Overloads**

    def create_document(request, options = nil) -> ::Gapic::Operation

Pass arguments to `create_document` via a request object, either of type [CreateDocumentRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-CreateDocumentRequest "Google::Cloud::Dialogflow::V2::CreateDocumentRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::Dialogflow::V2::CreateDocumentRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-CreateDocumentRequest), ::Hash) --- A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- **options** (::Gapic::CallOptions, ::Hash) --- Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

    def create_document(parent: nil, document: nil) -> ::Gapic::Operation

Pass arguments to `create_document` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). **Parameters**

- **parent** (::String) --- Required. The knowledge base to create a document for. Format: `projects/<Project ID>/locations/<Location
  ID>/knowledgeBases/<Knowledge Base ID>`.
- **document** ([::Google::Cloud::Dialogflow::V2::Document](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-Document), ::Hash) --- Required. The document to create.
**Yields**

- (result, operation) --- Access the result along with the TransportOperation object
**Yield Parameters**

- **result** (::Gapic::Operation)
- **operation** (::Gapic::Rest::TransportOperation)
**Returns**

- (::Gapic::Operation)
**Raises**

- (::Google::Cloud::Error) --- if the REST call is aborted.
**Example**

Basic example

```ruby
require "google/cloud/dialogflow/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Dialogflow::V2::Documents::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dialogflow::V2::CreateDocumentRequest.new

# Call the create_document method.
result = client.create_document request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end
```

### #delete_document

    def delete_document(request, options = nil) -> ::Gapic::Operation
    def delete_document(name: nil) -> ::Gapic::Operation

Deletes the specified document.

This method is a [long-running
operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
The returned `Operation` type has the following method-specific fields:

- `metadata`: [KnowledgeOperationMetadata](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-KnowledgeOperationMetadata "Google::Cloud::Dialogflow::V2::KnowledgeOperationMetadata (class)")
- `response`: An [Empty
  message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
**Overloads**

    def delete_document(request, options = nil) -> ::Gapic::Operation

Pass arguments to `delete_document` via a request object, either of type [Google::Cloud::Dialogflow::V2::DeleteDocumentRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-DeleteDocumentRequest "Google::Cloud::Dialogflow::V2::DeleteDocumentRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::Dialogflow::V2::DeleteDocumentRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-DeleteDocumentRequest), ::Hash) --- A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- **options** (::Gapic::CallOptions, ::Hash) --- Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

    def delete_document(name: nil) -> ::Gapic::Operation

Pass arguments to `delete_document` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). **Parameter**

- **name** (::String) --- Required. The name of the document to delete. Format: `projects/<Project ID>/locations/<Location
  ID>/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>`.
**Yields**

- (result, operation) --- Access the result along with the TransportOperation object
**Yield Parameters**

- **result** (::Gapic::Operation)
- **operation** (::Gapic::Rest::TransportOperation)
**Returns**

- (::Gapic::Operation)
**Raises**

- (::Google::Cloud::Error) --- if the REST call is aborted.
**Example**

Basic example

```ruby
require "google/cloud/dialogflow/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Dialogflow::V2::Documents::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dialogflow::V2::DeleteDocumentRequest.new

# Call the delete_document method.
result = client.delete_document request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end
```

### #export_document

    def export_document(request, options = nil) -> ::Gapic::Operation
    def export_document(name: nil, gcs_destination: nil, export_full_content: nil, smart_messaging_partial_update: nil) -> ::Gapic::Operation

Exports a smart messaging candidate document into the specified
destination.

This method is a [long-running
operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
The returned `Operation` type has the following method-specific fields:

- `metadata`: [KnowledgeOperationMetadata](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-KnowledgeOperationMetadata "Google::Cloud::Dialogflow::V2::KnowledgeOperationMetadata (class)")
- `response`: [Document](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-Document "Google::Cloud::Dialogflow::V2::Document (class)")
**Overloads**

    def export_document(request, options = nil) -> ::Gapic::Operation

Pass arguments to `export_document` via a request object, either of type [ExportDocumentRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-ExportDocumentRequest "Google::Cloud::Dialogflow::V2::ExportDocumentRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::Dialogflow::V2::ExportDocumentRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-ExportDocumentRequest), ::Hash) --- A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- **options** (::Gapic::CallOptions, ::Hash) --- Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

    def export_document(name: nil, gcs_destination: nil, export_full_content: nil, smart_messaging_partial_update: nil) -> ::Gapic::Operation

Pass arguments to `export_document` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). **Parameters**

- **name** (::String) --- Required. The name of the document to export. Format: `projects/<Project ID>/locations/<Location
  ID>/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>`.
- **gcs_destination** ([::Google::Cloud::Dialogflow::V2::GcsDestination](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-GcsDestination), ::Hash) --- Cloud Storage file path to export the document.
- **export_full_content** (::Boolean) --- When enabled, export the full content of the document including empirical probability.
- **smart_messaging_partial_update** (::Boolean) --- When enabled, export the smart messaging allowlist document for partial update.
**Yields**

- (result, operation) --- Access the result along with the TransportOperation object
**Yield Parameters**

- **result** (::Gapic::Operation)
- **operation** (::Gapic::Rest::TransportOperation)
**Returns**

- (::Gapic::Operation)
**Raises**

- (::Google::Cloud::Error) --- if the REST call is aborted.
**Example**

Basic example

```ruby
require "google/cloud/dialogflow/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Dialogflow::V2::Documents::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dialogflow::V2::ExportDocumentRequest.new

# Call the export_document method.
result = client.export_document request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end
```

### #get_document

    def get_document(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::Document
    def get_document(name: nil) -> ::Google::Cloud::Dialogflow::V2::Document

Retrieves the specified document.
**Overloads**

    def get_document(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::Document

Pass arguments to `get_document` via a request object, either of type [GetDocumentRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-GetDocumentRequest "Google::Cloud::Dialogflow::V2::GetDocumentRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::Dialogflow::V2::GetDocumentRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-GetDocumentRequest), ::Hash) --- A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- **options** (::Gapic::CallOptions, ::Hash) --- Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

    def get_document(name: nil) -> ::Google::Cloud::Dialogflow::V2::Document

Pass arguments to `get_document` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). **Parameter**

- **name** (::String) --- Required. The name of the document to retrieve. Format `projects/<Project ID>/locations/<Location
  ID>/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>`.
**Yields**

- (result, operation) --- Access the result along with the TransportOperation object
**Yield Parameters**

- **result** ([::Google::Cloud::Dialogflow::V2::Document](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-Document))
- **operation** (::Gapic::Rest::TransportOperation)
**Returns**

- ([::Google::Cloud::Dialogflow::V2::Document](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-Document))
**Raises**

- (::Google::Cloud::Error) --- if the REST call is aborted.
**Example**

Basic example

```ruby
require "google/cloud/dialogflow/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Dialogflow::V2::Documents::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dialogflow::V2::GetDocumentRequest.new

# Call the get_document method.
result = client.get_document request

# The returned object is of type Google::Cloud::Dialogflow::V2::Document.
p result
```

### #import_documents

    def import_documents(request, options = nil) -> ::Gapic::Operation
    def import_documents(parent: nil, gcs_source: nil, document_template: nil, import_gcs_custom_metadata: nil) -> ::Gapic::Operation

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](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
The returned `Operation` type has the following method-specific fields:

- `metadata`: [KnowledgeOperationMetadata](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-KnowledgeOperationMetadata "Google::Cloud::Dialogflow::V2::KnowledgeOperationMetadata (class)")
- `response`: [ImportDocumentsResponse](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-ImportDocumentsResponse "Google::Cloud::Dialogflow::V2::ImportDocumentsResponse (class)")
**Overloads**

    def import_documents(request, options = nil) -> ::Gapic::Operation

Pass arguments to `import_documents` via a request object, either of type [ImportDocumentsRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-ImportDocumentsRequest "Google::Cloud::Dialogflow::V2::ImportDocumentsRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::Dialogflow::V2::ImportDocumentsRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-ImportDocumentsRequest), ::Hash) --- A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- **options** (::Gapic::CallOptions, ::Hash) --- Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

    def import_documents(parent: nil, gcs_source: nil, document_template: nil, import_gcs_custom_metadata: nil) -> ::Gapic::Operation

Pass arguments to `import_documents` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). **Parameters**

- **parent** (::String) --- Required. The knowledge base to import documents into. Format: `projects/<Project ID>/locations/<Location
  ID>/knowledgeBases/<Knowledge Base ID>`.
- **gcs_source** ([::Google::Cloud::Dialogflow::V2::GcsSources](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-GcsSources), ::Hash) --- Optional. The Google Cloud Storage location for the documents. The path can include a wildcard.


  These URIs may have the forms
  `gs://<bucket-name>/<object-name>`.
  `gs://<bucket-name>/<object-path>/*.<extension>`.
- **document_template** ([::Google::Cloud::Dialogflow::V2::ImportDocumentTemplate](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-ImportDocumentTemplate), ::Hash) --- Required. Document template used for importing all the documents.
- **import_gcs_custom_metadata** (::Boolean) --- Whether to import custom metadata from Google Cloud Storage. Only valid when the document source is Google Cloud Storage URI.
**Yields**

- (result, operation) --- Access the result along with the TransportOperation object
**Yield Parameters**

- **result** (::Gapic::Operation)
- **operation** (::Gapic::Rest::TransportOperation)
**Returns**

- (::Gapic::Operation)
**Raises**

- (::Google::Cloud::Error) --- if the REST call is aborted.
**Example**

Basic example

```ruby
require "google/cloud/dialogflow/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Dialogflow::V2::Documents::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dialogflow::V2::ImportDocumentsRequest.new

# Call the import_documents method.
result = client.import_documents request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end
```

### #initialize

    def initialize() { |config| ... } -> Client

Create a new Documents REST client object.
**Yields**

- (config) --- Configure the Documents client.
**Yield Parameter**

- **config** ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-Documents-Rest-Client-Configuration))
**Returns**

- ([Client](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-Documents-Rest-Client)) --- a new instance of Client
**Example**

```ruby
# Create a client using the default configuration
client = ::Google::Cloud::Dialogflow::V2::Documents::Rest::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::Dialogflow::V2::Documents::Rest::Client.new do |config|
  config.timeout = 10.0
end
```

### #list_documents

    def list_documents(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Document>
    def list_documents(parent: nil, page_size: nil, page_token: nil, filter: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Document>

Returns the list of all documents of the knowledge base.
**Overloads**

    def list_documents(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Document>

Pass arguments to `list_documents` via a request object, either of type [ListDocumentsRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-ListDocumentsRequest "Google::Cloud::Dialogflow::V2::ListDocumentsRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::Dialogflow::V2::ListDocumentsRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-ListDocumentsRequest), ::Hash) --- A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- **options** (::Gapic::CallOptions, ::Hash) --- Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

    def list_documents(parent: nil, page_size: nil, page_token: nil, filter: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Document>

Pass arguments to `list_documents` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). **Parameters**

- **parent** (::String) --- Required. The knowledge base to list all documents for. Format: `projects/<Project ID>/locations/<Location
  ID>/knowledgeBases/<Knowledge Base ID>`.
- **page_size** (::Integer) --- The maximum number of items to return in a single page. By default 10 and at most 100.
- **page_token** (::String) --- The next_page_token value returned from a previous list request.
- **filter** (::String) --- The filter expression used to filter documents returned by the list method. The expression has the following syntax:


  <br />


  The following fields and operators are supported:
  - knowledge_types with has(:) operator
  - display_name with has(:) operator
  - state with equals(=) operator

  Examples:
  - "knowledge_types:FAQ" matches documents with FAQ knowledge type.
  - "display_name:customer" matches documents whose display name contains "customer".
  - "state=ACTIVE" matches documents with ACTIVE state.
  - "knowledge_types:FAQ AND state=ACTIVE" matches all active FAQ documents.

  For more information about filtering, see
  [API Filtering](https://aip.dev/160).
**Yields**

- (result, operation) --- Access the result along with the TransportOperation object
**Yield Parameters**

- **result** (::Gapic::Rest::PagedEnumerable\<[::Google::Cloud::Dialogflow::V2::Document](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-Document)\>)
- **operation** (::Gapic::Rest::TransportOperation)
**Returns**

- (::Gapic::Rest::PagedEnumerable\<[::Google::Cloud::Dialogflow::V2::Document](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-Document)\>)
**Raises**

- (::Google::Cloud::Error) --- if the REST call is aborted.
**Example**

Basic example

```ruby
require "google/cloud/dialogflow/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Dialogflow::V2::Documents::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dialogflow::V2::ListDocumentsRequest.new

# Call the list_documents method.
result = client.list_documents request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::Dialogflow::V2::Document.
  p item
end
```

### #location_client

    def location_client() -> Google::Cloud::Location::Locations::Rest::Client

Get the associated client for mix-in of the Locations.
**Returns**

- (Google::Cloud::Location::Locations::Rest::Client)

### #logger

    def logger() -> Logger

The logger used for request/response debug logging.
**Returns**

- (Logger)

### #operations_client

    def operations_client() -> ::Google::Cloud::Dialogflow::V2::Documents::Rest::Operations

Get the associated client for long-running operations.
**Returns**

- ([::Google::Cloud::Dialogflow::V2::Documents::Rest::Operations](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-Documents-Rest-Operations))

### #reload_document

    def reload_document(request, options = nil) -> ::Gapic::Operation
    def reload_document(name: nil, content_uri: nil, import_gcs_custom_metadata: nil, smart_messaging_partial_update: nil) -> ::Gapic::Operation

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](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
The returned `Operation` type has the following method-specific fields:

- `metadata`: [KnowledgeOperationMetadata](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-KnowledgeOperationMetadata "Google::Cloud::Dialogflow::V2::KnowledgeOperationMetadata (class)")
- `response`: [Document](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-Document "Google::Cloud::Dialogflow::V2::Document (class)")

<br />

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

    def reload_document(request, options = nil) -> ::Gapic::Operation

Pass arguments to `reload_document` via a request object, either of type [ReloadDocumentRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-ReloadDocumentRequest "Google::Cloud::Dialogflow::V2::ReloadDocumentRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::Dialogflow::V2::ReloadDocumentRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-ReloadDocumentRequest), ::Hash) --- A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- **options** (::Gapic::CallOptions, ::Hash) --- Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

    def reload_document(name: nil, content_uri: nil, import_gcs_custom_metadata: nil, smart_messaging_partial_update: nil) -> ::Gapic::Operation

Pass arguments to `reload_document` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). **Parameters**

- **name** (::String) --- Required. The name of the document to reload. Format: `projects/<Project ID>/locations/<Location
  ID>/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>`
- **content_uri** (::String) --- 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>`.
- **import_gcs_custom_metadata** (::Boolean) --- Optional. Whether to import custom metadata from Google Cloud Storage. Only valid when the document source is Google Cloud Storage URI.
- **smart_messaging_partial_update** (::Boolean) --- Optional. When enabled, the reload request is to apply partial update to the smart messaging allowlist.
**Yields**

- (result, operation) --- Access the result along with the TransportOperation object
**Yield Parameters**

- **result** (::Gapic::Operation)
- **operation** (::Gapic::Rest::TransportOperation)
**Returns**

- (::Gapic::Operation)
**Raises**

- (::Google::Cloud::Error) --- if the REST call is aborted.
**Example**

Basic example

```ruby
require "google/cloud/dialogflow/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Dialogflow::V2::Documents::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dialogflow::V2::ReloadDocumentRequest.new

# Call the reload_document method.
result = client.reload_document request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end
```

### #universe_domain

    def universe_domain() -> String

The effective universe domain
**Returns**

- (String)

### #update_document

    def update_document(request, options = nil) -> ::Gapic::Operation
    def update_document(document: nil, update_mask: nil) -> ::Gapic::Operation

Updates the specified document.

This method is a [long-running
operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
The returned `Operation` type has the following method-specific fields:

- `metadata`: [KnowledgeOperationMetadata](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-KnowledgeOperationMetadata "Google::Cloud::Dialogflow::V2::KnowledgeOperationMetadata (class)")
- `response`: [Document](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-Document "Google::Cloud::Dialogflow::V2::Document (class)")
**Overloads**

    def update_document(request, options = nil) -> ::Gapic::Operation

Pass arguments to `update_document` via a request object, either of type [UpdateDocumentRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-UpdateDocumentRequest "Google::Cloud::Dialogflow::V2::UpdateDocumentRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::Dialogflow::V2::UpdateDocumentRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-UpdateDocumentRequest), ::Hash) --- A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- **options** (::Gapic::CallOptions, ::Hash) --- Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

    def update_document(document: nil, update_mask: nil) -> ::Gapic::Operation

Pass arguments to `update_document` via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above). **Parameters**

- **document** ([::Google::Cloud::Dialogflow::V2::Document](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Cloud-Dialogflow-V2-Document), ::Hash) --- Required. The document to update.
- **update_mask** ([::Google::Protobuf::FieldMask](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-dialogflow-v2/latest/Google-Protobuf-FieldMask), ::Hash) --- Optional. Not specified means `update all`. Currently, only `display_name` can be updated, an InvalidArgument will be returned for attempting to update other fields.
**Yields**

- (result, operation) --- Access the result along with the TransportOperation object
**Yield Parameters**

- **result** (::Gapic::Operation)
- **operation** (::Gapic::Rest::TransportOperation)
**Returns**

- (::Gapic::Operation)
**Raises**

- (::Google::Cloud::Error) --- if the REST call is aborted.
**Example**

Basic example

```ruby
require "google/cloud/dialogflow/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Dialogflow::V2::Documents::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Dialogflow::V2::UpdateDocumentRequest.new

# Call the update_document method.
result = client.update_document request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end
```