# Cloud Natural Language V1 Client - Class AnalyzeSentimentRequest (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 V1 Client class AnalyzeSentimentRequest.

The sentiment analysis request message.

Generated from protobuf message `google.cloud.language.v1.AnalyzeSentimentRequest`

## Namespace

Google \\ Cloud \\ Language \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ document` | `https://docs.cloud.google.com/php/docs/reference/cloud-language/latest/V1.Document` Required. Input document. |
| `↳ encoding_type` | `int` The encoding type used by the API to calculate sentence offsets. |

### getDocument

Required. Input document.

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

### hasDocument

### clearDocument

### setDocument

Required. Input document.

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

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

### getEncodingType

The encoding type used by the API to calculate sentence offsets.

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

### setEncodingType

The encoding type used by the API to calculate sentence offsets.

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

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

### static::build

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `document` | `https://docs.cloud.google.com/php/docs/reference/cloud-language/latest/V1.Document` Required. Input document. |
| `encodingType` | `int` The encoding type used by the API to calculate sentence offsets. For allowed values, use constants defined on [EncodingType](https://docs.cloud.google.com/php/docs/reference/cloud-language/latest/V1.EncodingType) |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-language/latest/V1.AnalyzeSentimentRequest` |   |

### static::buildFromDocument

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `document` | `https://docs.cloud.google.com/php/docs/reference/cloud-language/latest/V1.Document` Required. Input document. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-language/latest/V1.AnalyzeSentimentRequest` |   |