Google Apps Chat V1 Client - Class Annotation (0.6.1)

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

Output only. Annotations associated with the plain-text body of the message.

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.

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

getType

The type of this annotation.

Returns
Type Description
int

setType

The type of this annotation.

Parameter
Name Description
var int
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.

Returns
Type Description
int

setLength

Length of the substring in the plain-text message body this annotation corresponds to.

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

getMetadata

Returns
Type Description
string