0.31.0 (latest) 0.30.0 0.29.0 0.28.0 0.27.0 0.23.0 0.20.0 0.19.0 0.18.0 0.17.1 0.16.1 0.15.0 0.14.0 0.13.1 0.12.1 0.11.2 0.10.0 0.9.0 0.8.1 0.7.2 0.6.1 0.5.0 0.4.0 0.3.0 0.2.0 0.1.4 Reference documentation and code samples for the Google Apps Chat V1 Client class Annotation.

Annotations can be associated with the plain-text body of the message or
with chips that link to Google Workspace resources like Google Docs or Sheets
with `start_index` and `length` of 0. To add basic formatting to a text
message, see [Format text
messages](https://developers.google.com/workspace/chat/format-messages).

Example plain-text message body:

```php
Hello \@FooBot how are you!"
```

The corresponding annotations metadata:

```php
"annotations":[{
  "type":"USER_MENTION",
  "startIndex":6,
  "length":7,
  "userMention": {
    "user": {
      "name":"users/{user}",
      "displayName":"FooBot",
      "avatarUrl":"https://goo.gl/aeDtrS",
      "type":"BOT"
    },
    "type":"MENTION"
   }
}]
```

Generated from protobuf message `google.chat.v1.Annotation`

## Namespace

Google \\ Apps \\ Chat \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ type` | `int` The type of this annotation. |
| `↳ start_index` | `int` Start index (0-based, inclusive) in the plain-text message body this annotation corresponds to. |
| `↳ length` | `int` Length of the substring in the plain-text message body this annotation corresponds to. If not present, indicates a length of 0. |
| `↳ user_mention` | `UserMentionMetadata` The metadata of user mention. |
| `↳ slash_command` | `SlashCommandMetadata` The metadata for a slash command. |
| `↳ rich_link_metadata` | `RichLinkMetadata` The metadata for a rich link. |
| `↳ custom_emoji_metadata` | `CustomEmojiMetadata` The metadata for a custom emoji. |

### getType

The type of this annotation.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [AnnotationType](https://docs.cloud.google.com/php/docs/reference/apps-chat/latest/Chat.V1.AnnotationType.md.txt). |

### setType

The type of this annotation.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [AnnotationType](https://docs.cloud.google.com/php/docs/reference/apps-chat/latest/Chat.V1.AnnotationType.md.txt). |

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

### getStartIndex

Start index (0-based, inclusive) in the plain-text message body this
annotation corresponds to.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### hasStartIndex

### clearStartIndex

### setStartIndex

Start index (0-based, inclusive) in the plain-text message body this
annotation corresponds to.

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

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

### getLength

Length of the substring in the plain-text message body this annotation
corresponds to. If not present, indicates a length of 0.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### setLength

Length of the substring in the plain-text message body this annotation
corresponds to. If not present, indicates a length of 0.

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

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

### getUserMention

The metadata of user mention.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `UserMentionMetadata|null` |   |

### hasUserMention

### setUserMention

The metadata of user mention.

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

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

### getSlashCommand

The metadata for a slash command.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `SlashCommandMetadata|null` |   |

### hasSlashCommand

### setSlashCommand

The metadata for a slash command.

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

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

### getRichLinkMetadata

The metadata for a rich link.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `RichLinkMetadata|null` |   |

### hasRichLinkMetadata

### setRichLinkMetadata

The metadata for a rich link.

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

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

### getCustomEmojiMetadata

The metadata for a custom emoji.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `CustomEmojiMetadata|null` |   |

### hasCustomEmojiMetadata

### setCustomEmojiMetadata

The metadata for a custom emoji.

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

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

### getMetadata

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