Google Apps Chat V1 Client - Class Icon (0.3.0)

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

An icon displayed in a widget on a card. For an example in Google Chat apps, see Add an icon .

Supports built-in and custom icons. Google Workspace Add-ons and Chat apps :

Generated from protobuf message google.apps.card.v1.Icon

Namespace

Google \ Apps \ Card \ V1

Methods

__construct

Constructor.

Parameters
Name
Description
data
array

Optional. Data for populating the Message object.

↳ known_icon
string

Display one of the built-in icons provided by Google Workspace. For example, to display an airplane icon, specify AIRPLANE . For a bus, specify BUS . For a full list of supported icons, see built-in icons .

↳ icon_url
string

Display a custom icon hosted at an HTTPS URL. For example: "iconUrl": "https://developers.google.com/workspace/chat/images/quickstart-app-avatar.png" Supported file types include .png and .jpg .

↳ material_icon
Google\Apps\Card\V1\MaterialIcon

Display one of the Google Material Icons . For example, to display a checkbox icon , use "material_icon": { "name": "check_box" } Google Chat apps :

↳ alt_text
string

Optional. A description of the icon used for accessibility. If unspecified, the default value Button is provided. As a best practice, you should set a helpful description for what the icon displays, and if applicable, what it does. For example, A user's account portrait , or Opens a new browser tab and navigates to the Google Chat developer documentation at https://developers.google.com/workspace/chat . If the icon is set in a Button , the altText appears as helper text when the user hovers over the button. However, if the button also sets text , the icon's altText is ignored.

↳ image_type
int

The crop style applied to the image. In some cases, applying a CIRCLE crop causes the image to be drawn larger than a built-in icon.

getKnownIcon

Display one of the built-in icons provided by Google Workspace.

For example, to display an airplane icon, specify AIRPLANE . For a bus, specify BUS . For a full list of supported icons, see built-in icons .

Returns
Type
Description
string

hasKnownIcon

setKnownIcon

Display one of the built-in icons provided by Google Workspace.

For example, to display an airplane icon, specify AIRPLANE . For a bus, specify BUS . For a full list of supported icons, see built-in icons .

Parameter
Name
Description
var
string
Returns
Type
Description
$this

getIconUrl

Display a custom icon hosted at an HTTPS URL.

For example:

 "iconUrl":
"https://developers.google.com/workspace/chat/images/quickstart-app-avatar.png" 

Supported file types include .png and .jpg .

Returns
Type
Description
string

hasIconUrl

setIconUrl

Display a custom icon hosted at an HTTPS URL.

For example:

 "iconUrl":
"https://developers.google.com/workspace/chat/images/quickstart-app-avatar.png" 

Supported file types include .png and .jpg .

Parameter
Name
Description
var
string
Returns
Type
Description
$this

getMaterialIcon

Display one of the Google Material Icons .

For example, to display a checkbox icon , use

 "material_icon": {
  "name": "check_box"
} 

Google Chat apps :

Returns
Type
Description

hasMaterialIcon

setMaterialIcon

Display one of the Google Material Icons .

For example, to display a checkbox icon , use

 "material_icon": {
  "name": "check_box"
} 

Google Chat apps :

Parameter
Name
Description
Returns
Type
Description
$this

getAltText

Optional. A description of the icon used for accessibility.

If unspecified, the default value Button is provided. As a best practice, you should set a helpful description for what the icon displays, and if applicable, what it does. For example, A user's account portrait , or Opens a new browser tab and navigates to the Google Chat developer documentation at https://developers.google.com/workspace/chat . If the icon is set in a Button , the altText appears as helper text when the user hovers over the button. However, if the button also sets text , the icon's altText is ignored.

Returns
Type
Description
string

setAltText

Optional. A description of the icon used for accessibility.

If unspecified, the default value Button is provided. As a best practice, you should set a helpful description for what the icon displays, and if applicable, what it does. For example, A user's account portrait , or Opens a new browser tab and navigates to the Google Chat developer documentation at https://developers.google.com/workspace/chat . If the icon is set in a Button , the altText appears as helper text when the user hovers over the button. However, if the button also sets text , the icon's altText is ignored.

Parameter
Name
Description
var
string
Returns
Type
Description
$this

getImageType

The crop style applied to the image. In some cases, applying a CIRCLE crop causes the image to be drawn larger than a built-in icon.

Returns
Type
Description
int

setImageType

The crop style applied to the image. In some cases, applying a CIRCLE crop causes the image to be drawn larger than a built-in icon.

Parameter
Name
Description
var
int
Returns
Type
Description
$this

getIcons

Returns
Type
Description
string
Create a Mobile Website
View Site in Mobile | Classic
Share by: