Google Apps Chat V1 Client - Class Annotation (0.13.0)

Reference documentation and code samples for the Google Apps Chat V1 Client class Annotation.

Output only. 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.

Example plain-text message body:

Hello @FooBot how are you!"

The corresponding annotations metadata:

"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.

setType

The type of this annotation.

Parameter
Name Description
var int

Enum of type AnnotationType.

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