# Google Cloud Dialogflow V2 Client - Class Document (2.4.0)

2.4.0 (latest) 2.3.1 2.2.1 2.1.2 2.0.1 1.17.2 1.16.0 1.15.1 1.14.0 1.13.0 1.12.3 1.11.0 1.10.2 1.9.0 1.8.0 1.7.2 1.6.0 1.5.0 1.4.0 1.3.2 1.2.0 1.1.1 1.0.1 Reference documentation and code samples for the Google Cloud Dialogflow V2 Client class Document.

A knowledge document to be used by a
[KnowledgeBase](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.KnowledgeBase).

For more information, see the [knowledge base
guide](https://cloud.google.com/dialogflow/docs/how/knowledge-bases).
Note: The `projects.agent.knowledgeBases.documents` resource is deprecated;
only use `projects.knowledgeBases.documents`.

Generated from protobuf message `google.cloud.dialogflow.v2.Document`

## Namespace

Google \\ Cloud \\ Dialogflow \\ V2

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ name` | `string` Optional. The document resource name. The name must be empty when creating a document. Format: `projects/<Project ID>/locations/<Location ID>/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>`. |
| `↳ display_name` | `string` Required. The display name of the document. The name must be 1024 bytes or less; otherwise, the creation request fails. |
| `↳ mime_type` | `string` Required. The MIME type of this document. |
| `↳ knowledge_types` | `int[]` Required. The knowledge type of document content. |
| `↳ content_uri` | `string` The URI where the file content is located. For documents stored in Google Cloud Storage, these URIs must have the form `gs://<bucket-name>/<object-name>`. NOTE: External URLs must correspond to public webpages, i.e., they must be indexed by Google Search. In particular, URLs for showing documents in Google Cloud Storage (i.e. the URL in your browser) are not supported. Instead use the `gs://` format URI described above. |
| `↳ raw_content` | `string` The raw content of the document. This field is only permitted for EXTRACTIVE_QA and FAQ knowledge types. |
| `↳ enable_auto_reload` | `bool` Optional. If true, we try to automatically reload the document every day (at a time picked by the system). If false or unspecified, we don't try to automatically reload the document. Currently you can only enable automatic reload for documents sourced from a public url, see `source` field for the source types. Reload status can be tracked in `latest_reload_status`. If a reload fails, we will keep the document unchanged. If a reload fails with internal errors, the system will try to reload the document on the next day. If a reload fails with non-retriable errors (e.g. PERMISSION_DENIED), the system will not try to reload the document anymore. You need to manually reload the document successfully by calling `ReloadDocument` and clear the errors. |
| `↳ latest_reload_status` | `https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.Document.ReloadStatus` Output only. The time and status of the latest reload. This reload may have been triggered automatically or manually and may not have succeeded. |
| `↳ metadata` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` Optional. Metadata for the document. The metadata supports arbitrary key-value pairs. Suggested use cases include storing a document's title, an external URL distinct from the document's content_uri, etc. The max size of a `key` or a `value` of the metadata is 1024 bytes. |
| `↳ state` | `int` Output only. The current state of the document. |

### getName

Optional. The document resource name.

The name must be empty when creating a document.
Format: `projects/<Project ID>/locations/<Location
ID>/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setName

Optional. The document resource name.

The name must be empty when creating a document.
Format: `projects/<Project ID>/locations/<Location
ID>/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getDisplayName

Required. The display name of the document. The name must be 1024 bytes or
less; otherwise, the creation request fails.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setDisplayName

Required. The display name of the document. The name must be 1024 bytes or
less; otherwise, the creation request fails.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getMimeType

Required. The MIME type of this document.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setMimeType

Required. The MIME type of this document.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getKnowledgeTypes

Required. The knowledge type of document content.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<int>` |   |

### setKnowledgeTypes

Required. The knowledge type of document content.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int[]` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getContentUri

The URI where the file content is located.

For documents stored in Google Cloud Storage, these URIs must have
the form `gs://<bucket-name>/<object-name>`.
NOTE: External URLs must correspond to public webpages, i.e., they must
be indexed by Google Search. In particular, URLs for showing documents in
Google Cloud Storage (i.e. the URL in your browser) are not supported.
Instead use the `gs://` format URI described above.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### hasContentUri

### setContentUri

The URI where the file content is located.

For documents stored in Google Cloud Storage, these URIs must have
the form `gs://<bucket-name>/<object-name>`.
NOTE: External URLs must correspond to public webpages, i.e., they must
be indexed by Google Search. In particular, URLs for showing documents in
Google Cloud Storage (i.e. the URL in your browser) are not supported.
Instead use the `gs://` format URI described above.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getRawContent

The raw content of the document. This field is only permitted for
EXTRACTIVE_QA and FAQ knowledge types.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### hasRawContent

### setRawContent

The raw content of the document. This field is only permitted for
EXTRACTIVE_QA and FAQ knowledge types.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getEnableAutoReload

Optional. If true, we try to automatically reload the document every day
(at a time picked by the system). If false or unspecified, we don't try
to automatically reload the document.

Currently you can only enable automatic reload for documents sourced from
a public url, see `source` field for the source types.
Reload status can be tracked in `latest_reload_status`. If a reload
fails, we will keep the document unchanged.
If a reload fails with internal errors, the system will try to reload the
document on the next day.
If a reload fails with non-retriable errors (e.g. PERMISSION_DENIED), the
system will not try to reload the document anymore. You need to manually
reload the document successfully by calling `ReloadDocument` and clear the
errors.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### setEnableAutoReload

Optional. If true, we try to automatically reload the document every day
(at a time picked by the system). If false or unspecified, we don't try
to automatically reload the document.

Currently you can only enable automatic reload for documents sourced from
a public url, see `source` field for the source types.
Reload status can be tracked in `latest_reload_status`. If a reload
fails, we will keep the document unchanged.
If a reload fails with internal errors, the system will try to reload the
document on the next day.
If a reload fails with non-retriable errors (e.g. PERMISSION_DENIED), the
system will not try to reload the document anymore. You need to manually
reload the document successfully by calling `ReloadDocument` and clear the
errors.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `bool` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getLatestReloadStatus

Output only. The time and status of the latest reload.

This reload may have been triggered automatically or manually
and may not have succeeded.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.Document.ReloadStatus|null` |   |

### hasLatestReloadStatus

### clearLatestReloadStatus

### setLatestReloadStatus

Output only. The time and status of the latest reload.

This reload may have been triggered automatically or manually
and may not have succeeded.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.Document.ReloadStatus` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getMetadata

Optional. Metadata for the document. The metadata supports arbitrary
key-value pairs. Suggested use cases include storing a document's title,
an external URL distinct from the document's content_uri, etc.

The max size of a `key` or a `value` of the metadata is 1024 bytes.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` |   |

### setMetadata

Optional. Metadata for the document. The metadata supports arbitrary
key-value pairs. Suggested use cases include storing a document's title,
an external URL distinct from the document's content_uri, etc.

The max size of a `key` or a `value` of the metadata is 1024 bytes.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getState

Output only. The current state of the document.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [State](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.Document.State). |

### setState

Output only. The current state of the document.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [State](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.Document.State). |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getSource

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |