# Cloud Natural Language V2 Client - Class Document (1.2.1)

1.2.1 (latest) 1.2.0 1.1.4 1.0.1 0.34.3 0.33.0 0.32.7 0.31.3 0.30.2 0.29.0 0.28.5 Reference documentation and code samples for the Cloud Natural Language V2 Client class Document.

Represents the input to API methods.

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

## Namespace

Google \\ Cloud \\ Language \\ V2

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ type` | `int` Required. If the type is not set or is `TYPE_UNSPECIFIED`, returns an `INVALID_ARGUMENT` error. |
| `↳ content` | `string` The content of the input in string format. Cloud audit logging exempt since it is based on user data. |
| `↳ gcs_content_uri` | `string` The Google Cloud Storage URI where the file content is located. This URI must be of the form: gs://bucket_name/object_name. For more details, see <https://cloud.google.com/storage/docs/reference-uris>. NOTE: Cloud Storage object versioning is not supported. |
| `↳ language_code` | `string` Optional. The language of the document (if not specified, the language is automatically detected). Both ISO and BCP-47 language codes are accepted. [Language Support](https://cloud.google.com/natural-language/docs/languages) lists currently supported languages for each API method. If the language (either specified by the caller or automatically detected) is not supported by the called API method, an `INVALID_ARGUMENT` error is returned. |

### getType

Required. If the type is not set or is `TYPE_UNSPECIFIED`,
returns an `INVALID_ARGUMENT` error.

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

### setType

Required. If the type is not set or is `TYPE_UNSPECIFIED`,
returns an `INVALID_ARGUMENT` error.

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

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

### getContent

The content of the input in string format.

Cloud audit logging exempt since it is based on user data.

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

### hasContent

### setContent

The content of the input in string format.

Cloud audit logging exempt since it is based on user data.

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

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

### getGcsContentUri

The Google Cloud Storage URI where the file content is located.

This URI must be of the form: gs://bucket_name/object_name. For more
details, see <https://cloud.google.com/storage/docs/reference-uris>.
NOTE: Cloud Storage object versioning is not supported.

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

### hasGcsContentUri

### setGcsContentUri

The Google Cloud Storage URI where the file content is located.

This URI must be of the form: gs://bucket_name/object_name. For more
details, see <https://cloud.google.com/storage/docs/reference-uris>.
NOTE: Cloud Storage object versioning is not supported.

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

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

### getLanguageCode

Optional. The language of the document (if not specified, the language is
automatically detected). Both ISO and BCP-47 language codes are
accepted.  

[Language
Support](https://cloud.google.com/natural-language/docs/languages) lists
currently supported languages for each API method. If the language (either
specified by the caller or automatically detected) is not supported by the
called API method, an `INVALID_ARGUMENT` error is returned.

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

### setLanguageCode

Optional. The language of the document (if not specified, the language is
automatically detected). Both ISO and BCP-47 language codes are
accepted.  

[Language
Support](https://cloud.google.com/natural-language/docs/languages) lists
currently supported languages for each API method. If the language (either
specified by the caller or automatically detected) is not supported by the
called API method, an `INVALID_ARGUMENT` error is returned.

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

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

### getSource

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